From 0886fc6a5c75b294544263ea979b9cf6195407d9 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 8 Apr 2014 10:27:56 -0400 Subject: Add new to_reg* functions for error-free OID lookups. These functions won't throw an error if the object doesn't exist, or if (for functions and operators) there's more than one matching object. Yugo Nagata and Nozomi Anzai, reviewed by Amit Khandekar, Marti Raudsepp, Amit Kapila, and me. --- doc/src/sgml/func.sgml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 6e2fbda6c23..33e093e2ab9 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -15279,6 +15279,22 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); collation for + + to_regclass + + + + to_regproc + + + + to_regoper + + + + to_regtype + + lists functions that extract information from the system catalogs. @@ -15449,6 +15465,26 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); text get the collation of the argument + + to_regclass(rel_name) + regclass + get the oid of the named relation + + + to_regproc(func_name) + regproc + get the oid of the named function + + + to_regoper(operator_name) + regoper + get the oid of the named operator + + + to_regtype(type_name) + regtype + get the oid of the named type + @@ -15614,6 +15650,18 @@ SELECT collation for ('foo' COLLATE "de_DE"); is not of a collatable data type, then an error is raised. + + The to_regclass, to_regproc, + to_regoper and to_regtype + translate relation, function, operator, and type names to objects of + type regclass, regproc, regoper and + regtype, respectively. These functions differ from a cast from + text in that they don't accept a numeric OID, and that they return null + rather than throwing an error if the name is not found (or, for + to_regproc and to_regoper, if + the given name matches multiple objects). + + col_description -- cgit v1.2.3