RefLib

Reference library for AI

Back

postgresql_16:6.6.3.2 ALIAS

PostgreSQL 16 > Server Programming > PL/pgSQL — SQL Procedural Language > Declarations > ALIAS

newname ALIAS FOR oldname;

The ALIAS syntax is more general than is suggested in the previous section: you can declare an alias for any variable, not just function parameters. The main practical use for this is to assign a different name for variables with predetermined names, such as NEW or OLD within a trigger function.

Examples: DECLARE prior ALIAS FOR old; updated ALIAS FOR new;

Since ALIAS creates two different ways to name the same object, unrestricted use can be confusing. It's best to use it only for the purpose of overriding predetermined names.

Back