0

Every solution I see has to do with people having case sensitive column names.

The query select * from users works, but when I say select * from users where username=maxspiri, I get error column maxspiri doesn't exist. Here is my table:

enter image description here

2
  • String constants in the Postgres manual Commented Oct 4, 2022 at 5:35
  • This is because maxspiri identify as a column by psql. Change it to 'maxspiri' Commented Oct 4, 2022 at 5:37

3 Answers 3

3

Since maxspiri is a string, you need to wrap it in single quotes.

select * from users where username='maxspiri'
Sign up to request clarification or add additional context in comments.

1 Comment

This answer is correct and should be marked.
1

For anyone else looking into this:

Column names in Supabase should be wrapped in double quotes, but strings (values) should be wrapped in single quotes:

SELECT "id" from "table" WHERE "name" = 'some string value'

If your table, or column, has an uppercase in it (e.g. tableName) and if you don't wrap it in double quotes (e.g. "tableName") Supabase will convert it to lower case (e.g. tablename) and it won't find such table/column.

Comments

0

maxspiri is being treated as a column name, not as a string value. To fix this, you need to wrap string literals in single quotes. The corrected query should be

SELECT * FROM users WHERE username='maxspiri';

This ensures that PostgreSQL treats maxspiri as a string value rather than a column name.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.