PostgreSQL Functions – Valid Variable Names for Functions in PostgreSQL

plpgsqlpostgresql

I cannot find any definitive information on what constitutes a valid variable name in a PostgreSQL function.

I am assuming the function is written using plpgsql. I know I can use letters, numerals (apart from the first character) and underscores. Is there anything else?

Where is this documented?

Best Answer

This is implicitly stated in the introduction to PL/pgSQL.

Identifiers are implicitly converted to lower case unless double-quoted, just as they are in ordinary SQL commands.

So a PL/pgSQL variable has to comply with the rules for SQL identifiers