QUOTE_IDENT
Returns the given string, suitably quoted, to be used as an identifier in a SQL statement string. Quotes are added only if necessary; that is, if the string contains non-identifier characters, is a SQL keyword, such as '1time'
, 'Next week'
and 'Select'
. Embedded double quotes are doubled.
Behavior Type
Syntax
QUOTE_IDENT( string )
Parameters
string |
String to quote. |
Notes
- SQL identifiers, such as table and column names, are stored as created, and references to them are resolved using case-insensitive compares. Thus, you do not need to double-quote mixed-case identifiers.
- Vertica quotes all currently-reserved keywords, even those not currently being used.
Examples
Quoted identifiers are case-insensitive, and Vertica does not supply the quotes:
=> SELECT QUOTE_IDENT('VErtIcA'); QUOTE_IDENT ------------- VErtIcA (1 row)
=> SELECT QUOTE_IDENT('Vertica database'); QUOTE_IDENT -------------------- "Vertica database" (1 row)
Embedded double quotes are doubled:
=> SELECT QUOTE_IDENT('Vertica "!" database'); QUOTE_IDENT -------------------------- "Vertica ""!"" database" (1 row)
The following example uses the SQL keyword, SELECT; results are double quoted:
=> SELECT QUOTE_IDENT('select'); QUOTE_IDENT ------------- "select" (1 row)