Skip to content

Unexpected results when querying a table called 'user' #28

Closed
@pifantastic

Description

@pifantastic

Queries to all other tables work as expected. When I query a table called 'user', it seems to return records from some other table, perhaps postgres' table internally representing database users.

  client.query("SELECT * FROM user", function(err, data) {
    console.log(client, err, data);
  });

returns

{ _queryQueue: [], _namedQueries: {}, _activeQuery: { text: 'SELECT * FROM user', values: [], callback: [Function], rows: [ [Object] ] }, _config: { database: 'mydb_development', user: 'mydbuser', password: 'mydbpass', host: undefined, port: 5432 }, _events: { connect: [Function], _row: [Function], _error: [Function], _readyForQuery: [Function] }, _connected: true } null { rows: [ { current_user: 'mydbuser' } ] }

However, if I duplicate my users table and name it differently, say 'user_copy', everything works as expected. The easy workaround is to just change the name of my user table.

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