Skip to content

Diferent results on SELECT query #1973

@jenanni

Description

@jenanni

I have a table "users" whit this rows:

user_id user_name
1 Jhon
2 Paul

And other table "tests" with this rows:

test_id created_by_user_id modified_by_user_id
1 1 2

at psql shell, I send the following query:

SELECT test_id, created.user_name, modified.user_name FROM tests LEFT JOIN users as created ON tests.created_by_user_id = created.user_id LEFT JOIN users as modified ON tests.modified_by_user_id = modified.user_id

as expected, I have thr following result:

test_id created modified
1 Jhon Paul

but using pg-node whit the same query as:

const result = await client.query('SELECT test_id, created.user_name, modified.user_name FROM tests LEFT JOIN users as created ON tests.created_by_user_id = created.user_id LEFT JOIN users as modified ON tests.modified_by_user_id = modified.user_id')

in result.rows I have this:

test_id created modified
1 Jhon Jhon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions