Search code examples
sqlpostgresqlstring-constant

SQL WHERE - Column (value) does not exist


I'm attempting to do the most basic WHERE statement in psql and I'm getting a strange error:

ERROR:  column "rom_tut" does not exist
LINE 1: SELECT * FROM pg_roles WHERE rolname="rom_tut";

Why is it complaining that the value isn't a column?


Solution

  • use single quote for string value because double quote means column name

    SELECT * FROM pg_roles WHERE rolname='rom_tut'