From: Bruce Momjian Date: Tue, 30 Jan 2007 02:32:05 +0000 (+0000) Subject: Clarify paramater handling for pg_get_serial_sequence(). X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=3d74896478b3d1ce5b2eea7ec5ee94c8cc3fa28f;p=users%2Fbernd%2Fpostgres.git Clarify paramater handling for pg_get_serial_sequence(). --- diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 0d8560c66c..b98c9157da 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -9882,12 +9882,18 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); - pg_get_serial_sequence fetches the name of the - sequence associated with a column, or NULL if there is no sequence - associated with the column. The result is suitably formatted for passing - to the sequence functions (see ). - This association can be modified or removed with ALTER SEQUENCE - OWNED BY. (The function probably should have been called + pg_get_serial_sequence returns the name of the + sequence associated with a column, or NULL if no sequence is associated + with the column. The first input parameter is a table name with + optional schema, and the second parameter is a column name. Because + the first parameter is potentially a schema and table, it is not treated + as a double-quoted identifier, meaning it is lowercased by default, + while the second parameter, being just a column name, is treated as + double-quoted and has its case preserved. The function returns a value + suitably formatted for passing to the sequence functions (see ). This association can be modified or + removed with ALTER SEQUENCE OWNED BY. (The function + probably should have been called pg_get_owned_sequence; its name reflects the fact that it's typically used with serial or bigserial columns.) diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index b714d111b1..679405e9eb 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -1232,6 +1232,8 @@ pg_get_userbyid(PG_FUNCTION_ARGS) * pg_get_serial_sequence * Get the name of the sequence used by a serial column, * formatted suitably for passing to setval, nextval or currval. + * First parameter is not treated as double-quoted, second parameter + * is --- see documentation for reason. */ Datum pg_get_serial_sequence(PG_FUNCTION_ARGS)