QUOTE_IDENT Function
The QUOTE_IDENT function returns the specified string as a double quoted string so that it can be used as an identifier in a SQL statement. Appropriately doubles any embedded double quotes.
QUOTE_IDENT adds double quotes only where necessary to create a valid identifier, when the string contains non-identifier characters or would otherwise be folded to lowercase. To always return a single-quoted string, use QUOTE_LITERAL.
Syntax
QUOTE_IDENT(string)
Argument
- string
-
The input parameter can be a CHAR or VARCHAR string.
Return Type
The QUOTE_IDENT function returns the same type string as the input parameter.
Example
The following example returns the CATNAME column surrounded by quotes:
select catid, quote_ident(catname) from category order by 1,2; catid | quote_ident -------+------------- 1 | "MLB" 2 | "NHL" 3 | "NFL" 4 | "NBA" 5 | "MLS" 6 | "Musicals" 7 | "Plays" 8 | "Opera" 9 | "Pop" 10 | "Jazz" 11 | "Classical" (11 rows)