Revision 12245
Added by Aaron Marcuse-Kubitza almost 11 years ago
util.sql | ||
---|---|---|
2080 | 2080 |
CREATE FUNCTION schema(table_ regclass) RETURNS text |
2081 | 2081 |
LANGUAGE sql STABLE |
2082 | 2082 |
AS $_$ |
2083 |
SELECT nspname::text |
|
2084 |
FROM pg_class |
|
2085 |
JOIN pg_namespace ON pg_namespace.oid = relnamespace |
|
2086 |
WHERE pg_class.oid = $1 |
|
2083 |
SELECT util.schema(relnamespace) FROM pg_class WHERE oid = $1 |
|
2087 | 2084 |
$_$; |
2088 | 2085 |
|
2089 | 2086 |
|
... | ... | |
2094 | 2091 |
CREATE FUNCTION schema(type regtype) RETURNS text |
2095 | 2092 |
LANGUAGE sql STABLE |
2096 | 2093 |
AS $_$ |
2097 |
SELECT nspname::text |
|
2098 |
FROM pg_type |
|
2099 |
JOIN pg_namespace ON pg_namespace.oid = typnamespace |
|
2100 |
WHERE pg_type.oid = $1 |
|
2094 |
SELECT util.schema(typnamespace) FROM pg_type WHERE oid = $1 |
|
2101 | 2095 |
$_$; |
2102 | 2096 |
|
2103 | 2097 |
|
Also available in: Unified diff
schemas/util.sql: schema(regtype), schema(regclass): use new schema(pg_namespace_oid oid)