patternsqlModerate
Can't list users - "select * from user" returns only one row with one column
Viewed 0 times
fromcancolumnwithuserusersrowonereturnsselect
Problem
I have a heroku postgres add-on database with a user table. However, when I attempt to
The table name is definitely
Thoughts?
select * from user, all I get is:current_user
----------------
rtsjlhdfptlaqd
(1 row)The table name is definitely
user. There is no users table. There are definitely a bunch of users in my app, but I can't seem to list them. Thoughts?
Solution
Ok this is kind of a stupid question, but I'll leave it in case someone else makes a similarly dumb mistake.
For the record, I'm not the one who created a set of models including
Postgres has its own table
For the record, I'm not the one who created a set of models including
user instead of users.Postgres has its own table
user which it holds postgres users in. When you select from user what you're getting is the result of the postgres user table. What you have to do instead is select from "user" where user is in double quotes.Context
StackExchange Database Administrators Q#73136, answer score: 10
Revisions (0)
No revisions yet.