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

Immutable

Syntax

QUOTE_IDENT( string )

Parameters

string

String to quote.

Notes

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)