Search code examples
postgresqlhstorereserved-words

postgresql : hstore key as a reserved keyword : any way around?


Using Postgresql 9.4

I have a table with a hstore field named 'references' :

Trying to do : select * from table where (references -> 'key' = 'value') results in

ERROR: syntax error at or near "references"

As it works as expected with another fieldname, I suspect it's because it's a reserved word... but I don't feel like renaming this heavily used field in my application.

So, is there any syntax to work around this problem ?


Solution

  • So, thanks to David, the solution is :

    select * from table where ( "references"->'key' = 'value' );

    where the meaning of quotes and double-quotes is important.