I was porting over to Postgresql (client requirement) and ran into a rather nasty issue.
Apparently 'cast' is a reserved word in Postgres and you cannot have a field by that name, you can however declare it as long as it is double quoted.
Eg. bad: cast varchar(256),
good: "cast" varchar(256)

However, the problem is that all of the built in Postgres handling for queries do not wrap field names in double quotes.
So all prepared statements involving this table fail in pg_query() with syntax errors as cast is a reserved word.

Workaround is to simply rename the field to something else but cast for example makes sense if your making a node about TV shows, or movies.

Comments

Cvbge’s picture

Hi,
thank you for your report.

I do not see a way to automatically wrap all column names with quotes.

There are a lot of reserved words (in postgres and in mysql and in other databases).
Correct way is, as you said, to rename the fields to something else.

Drupal core does not use 'cast' column name.

Please reassign this bug to the project that uses 'cast' column name.

proxyissues’s picture

Actually this came up during development of a custom module, I have not yet encountered a downloadable module that uses it yet.
So I guess it can be resolved as "won't fix"

chx’s picture

Status: Active » Closed (won't fix)

there is nothing to fix.