SQL adaptation guide For PostgreSQL 8.x.y, 9.x.y / Data manipulation |
The ANSI string delimiter character is the single quote ( 'string'). Double quotes are used to delimit database object names ("object-name").
Example: WHERE "tabname"."colname" = 'string'
Informix® allows double quotes as string delimiters, but PostgreSQL doesn't. This is important since many BDL programs use that character to delimit the strings in SQL commands.
The PostgreSQL database interface can automatically replace all double quotes by single quotes.
Escaped string delimiters can be used inside strings like following:
'This is a single quote: ''' 'This is a single quote: \'' "This is a double quote: """ "This is a double quote: \""
Database object names cannot be delimited by double quotes because the database interface cannot determine the difference between a database object name and a quoted string. For example, if the program executes the SQL statement:
WHERE "tabname"."colname" = "string"
replacing all double quotes by single quotes would produce:
WHERE 'tabname'.'colname' = 'string'
This would produce an error since 'tabname'.'colname' is not allowed by PostgreSQL.
Although double quotes are replaced automatically in SQL statements, you should use only single quotes to enforce portability.