RefLib

Reference library for AI

Back

postgresql_16:7.1.12.3 Examples

PostgreSQL 16 > Reference > SQL Commands > ALTER FUNCTION > Examples

To rename the function sqrt for type integer to square_root: ALTER FUNCTION sqrt(integer) RENAME TO square_root;

To change the owner of the function sqrt for type integer to joe: ALTER FUNCTION sqrt(integer) OWNER TO joe;

To change the schema of the function sqrt for type integer to maths: ALTER FUNCTION sqrt(integer) SET SCHEMA maths;

To mark the function sqrt for type integer as being dependent on the extension mathlib: ALTER FUNCTION sqrt(integer) DEPENDS ON EXTENSION mathlib;

To adjust the search path that is automatically set for a function: ALTER FUNCTION check_password(text) SET search_path = admin, pg_temp;

To disable automatic setting of search_path for a function: ALTER FUNCTION check_password(text) RESET search_path; The function will now execute with whatever search path is used by its caller.

Back