QUOTE_IDENT function - Amazon Redshift

QUOTE_IDENT function

The QUOTE_IDENT function returns the specified string as a string in double quotation marks so that it can be used as an identifier in a SQL statement. Appropriately doubles any embedded double quotation marks.

QUOTE_IDENT adds double quotation marks 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.





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.


The following example returns the CATNAME column surrounded by quotation marks.

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)