mirror of
https://github.com/postgres/postgres.git
synced 2025-08-09 17:03:00 +03:00
Change the relkind for partitioned tables from 'P' to 'p'.
Seven of the eight other relkind codes are lower-case, so it wasn't consistent for this one to be upper-case. Fix it while we still can. Historical notes: the reason for the lone exception, i.e. sequences being 'S', is that 's' was once used for "special" relations. Also, at one time the partitioned-tables patch used both 'P' and 'p', but that got changed, leaving only a surprising choice behind. This also fixes a couple little bits of technical debt, such as type_sanity.sql not knowing that 'm' is a legal value for relkind. Discussion: https://postgr.es/m/27899.1488909319@sss.pgh.pa.us
This commit is contained in:
@@ -1758,12 +1758,15 @@
|
|||||||
<entry><type>char</type></entry>
|
<entry><type>char</type></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>
|
<entry>
|
||||||
<literal>r</> = ordinary table, <literal>P</> = partitioned table,
|
<literal>r</> = ordinary table,
|
||||||
<literal>i</> = index
|
<literal>i</> = index,
|
||||||
<literal>S</> = sequence, <literal>v</> = view,
|
<literal>S</> = sequence,
|
||||||
|
<literal>t</> = TOAST table,
|
||||||
|
<literal>v</> = view,
|
||||||
<literal>m</> = materialized view,
|
<literal>m</> = materialized view,
|
||||||
<literal>c</> = composite type, <literal>t</> = TOAST table,
|
<literal>c</> = composite type,
|
||||||
<literal>f</> = foreign table
|
<literal>f</> = foreign table,
|
||||||
|
<literal>p</> = partitioned table
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
@@ -365,7 +365,7 @@ CREATE VIEW attributes AS
|
|||||||
ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default')
|
ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default')
|
||||||
|
|
||||||
WHERE a.attnum > 0 AND NOT a.attisdropped
|
WHERE a.attnum > 0 AND NOT a.attisdropped
|
||||||
AND c.relkind in ('c')
|
AND c.relkind IN ('c')
|
||||||
AND (pg_has_role(c.relowner, 'USAGE')
|
AND (pg_has_role(c.relowner, 'USAGE')
|
||||||
OR has_type_privilege(c.reltype, 'USAGE'));
|
OR has_type_privilege(c.reltype, 'USAGE'));
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ CREATE VIEW check_constraints AS
|
|||||||
AND a.attnum > 0
|
AND a.attnum > 0
|
||||||
AND NOT a.attisdropped
|
AND NOT a.attisdropped
|
||||||
AND a.attnotnull
|
AND a.attnotnull
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
AND pg_has_role(r.relowner, 'USAGE');
|
AND pg_has_role(r.relowner, 'USAGE');
|
||||||
|
|
||||||
GRANT SELECT ON check_constraints TO PUBLIC;
|
GRANT SELECT ON check_constraints TO PUBLIC;
|
||||||
@@ -525,7 +525,7 @@ CREATE VIEW column_domain_usage AS
|
|||||||
AND a.attrelid = c.oid
|
AND a.attrelid = c.oid
|
||||||
AND a.atttypid = t.oid
|
AND a.atttypid = t.oid
|
||||||
AND t.typtype = 'd'
|
AND t.typtype = 'd'
|
||||||
AND c.relkind IN ('r', 'v', 'f', 'P')
|
AND c.relkind IN ('r', 'v', 'f', 'p')
|
||||||
AND a.attnum > 0
|
AND a.attnum > 0
|
||||||
AND NOT a.attisdropped
|
AND NOT a.attisdropped
|
||||||
AND pg_has_role(t.typowner, 'USAGE');
|
AND pg_has_role(t.typowner, 'USAGE');
|
||||||
@@ -564,7 +564,7 @@ CREATE VIEW column_privileges AS
|
|||||||
pr_c.relowner
|
pr_c.relowner
|
||||||
FROM (SELECT oid, relname, relnamespace, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).*
|
FROM (SELECT oid, relname, relnamespace, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).*
|
||||||
FROM pg_class
|
FROM pg_class
|
||||||
WHERE relkind IN ('r', 'v', 'f', 'P')
|
WHERE relkind IN ('r', 'v', 'f', 'p')
|
||||||
) pr_c (oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable),
|
) pr_c (oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable),
|
||||||
pg_attribute a
|
pg_attribute a
|
||||||
WHERE a.attrelid = pr_c.oid
|
WHERE a.attrelid = pr_c.oid
|
||||||
@@ -586,7 +586,7 @@ CREATE VIEW column_privileges AS
|
|||||||
) pr_a (attrelid, attname, grantor, grantee, prtype, grantable),
|
) pr_a (attrelid, attname, grantor, grantee, prtype, grantable),
|
||||||
pg_class c
|
pg_class c
|
||||||
WHERE pr_a.attrelid = c.oid
|
WHERE pr_a.attrelid = c.oid
|
||||||
AND relkind IN ('r', 'v', 'f', 'P')
|
AND relkind IN ('r', 'v', 'f', 'p')
|
||||||
) x,
|
) x,
|
||||||
pg_namespace nc,
|
pg_namespace nc,
|
||||||
pg_authid u_grantor,
|
pg_authid u_grantor,
|
||||||
@@ -629,7 +629,8 @@ CREATE VIEW column_udt_usage AS
|
|||||||
WHERE a.attrelid = c.oid
|
WHERE a.attrelid = c.oid
|
||||||
AND a.atttypid = t.oid
|
AND a.atttypid = t.oid
|
||||||
AND nc.oid = c.relnamespace
|
AND nc.oid = c.relnamespace
|
||||||
AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'f', 'P')
|
AND a.attnum > 0 AND NOT a.attisdropped
|
||||||
|
AND c.relkind in ('r', 'v', 'f', 'p')
|
||||||
AND pg_has_role(coalesce(bt.typowner, t.typowner), 'USAGE');
|
AND pg_has_role(coalesce(bt.typowner, t.typowner), 'USAGE');
|
||||||
|
|
||||||
GRANT SELECT ON column_udt_usage TO PUBLIC;
|
GRANT SELECT ON column_udt_usage TO PUBLIC;
|
||||||
@@ -738,7 +739,7 @@ CREATE VIEW columns AS
|
|||||||
CAST('NEVER' AS character_data) AS is_generated,
|
CAST('NEVER' AS character_data) AS is_generated,
|
||||||
CAST(null AS character_data) AS generation_expression,
|
CAST(null AS character_data) AS generation_expression,
|
||||||
|
|
||||||
CAST(CASE WHEN c.relkind IN ('r', 'P') OR
|
CAST(CASE WHEN c.relkind IN ('r', 'p') OR
|
||||||
(c.relkind IN ('v', 'f') AND
|
(c.relkind IN ('v', 'f') AND
|
||||||
pg_column_is_updatable(c.oid, a.attnum, false))
|
pg_column_is_updatable(c.oid, a.attnum, false))
|
||||||
THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable
|
THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable
|
||||||
@@ -753,7 +754,8 @@ CREATE VIEW columns AS
|
|||||||
|
|
||||||
WHERE (NOT pg_is_other_temp_schema(nc.oid))
|
WHERE (NOT pg_is_other_temp_schema(nc.oid))
|
||||||
|
|
||||||
AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'f', 'P')
|
AND a.attnum > 0 AND NOT a.attisdropped
|
||||||
|
AND c.relkind IN ('r', 'v', 'f', 'p')
|
||||||
|
|
||||||
AND (pg_has_role(c.relowner, 'USAGE')
|
AND (pg_has_role(c.relowner, 'USAGE')
|
||||||
OR has_column_privilege(c.oid, a.attnum,
|
OR has_column_privilege(c.oid, a.attnum,
|
||||||
@@ -789,7 +791,7 @@ CREATE VIEW constraint_column_usage AS
|
|||||||
AND d.objid = c.oid
|
AND d.objid = c.oid
|
||||||
AND c.connamespace = nc.oid
|
AND c.connamespace = nc.oid
|
||||||
AND c.contype = 'c'
|
AND c.contype = 'c'
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
AND NOT a.attisdropped
|
AND NOT a.attisdropped
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
@@ -805,7 +807,7 @@ CREATE VIEW constraint_column_usage AS
|
|||||||
AND a.attnum = ANY (CASE c.contype WHEN 'f' THEN c.confkey ELSE c.conkey END)
|
AND a.attnum = ANY (CASE c.contype WHEN 'f' THEN c.confkey ELSE c.conkey END)
|
||||||
AND NOT a.attisdropped
|
AND NOT a.attisdropped
|
||||||
AND c.contype IN ('p', 'u', 'f')
|
AND c.contype IN ('p', 'u', 'f')
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
|
|
||||||
) AS x (tblschema, tblname, tblowner, colname, cstrschema, cstrname)
|
) AS x (tblschema, tblname, tblowner, colname, cstrschema, cstrname)
|
||||||
|
|
||||||
@@ -841,7 +843,7 @@ CREATE VIEW constraint_table_usage AS
|
|||||||
WHERE c.connamespace = nc.oid AND r.relnamespace = nr.oid
|
WHERE c.connamespace = nc.oid AND r.relnamespace = nr.oid
|
||||||
AND ( (c.contype = 'f' AND c.confrelid = r.oid)
|
AND ( (c.contype = 'f' AND c.confrelid = r.oid)
|
||||||
OR (c.contype IN ('p', 'u') AND c.conrelid = r.oid) )
|
OR (c.contype IN ('p', 'u') AND c.conrelid = r.oid) )
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
AND pg_has_role(r.relowner, 'USAGE');
|
AND pg_has_role(r.relowner, 'USAGE');
|
||||||
|
|
||||||
GRANT SELECT ON constraint_table_usage TO PUBLIC;
|
GRANT SELECT ON constraint_table_usage TO PUBLIC;
|
||||||
@@ -1058,7 +1060,7 @@ CREATE VIEW key_column_usage AS
|
|||||||
AND r.oid = c.conrelid
|
AND r.oid = c.conrelid
|
||||||
AND nc.oid = c.connamespace
|
AND nc.oid = c.connamespace
|
||||||
AND c.contype IN ('p', 'u', 'f')
|
AND c.contype IN ('p', 'u', 'f')
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
AND (NOT pg_is_other_temp_schema(nr.oid)) ) AS ss
|
AND (NOT pg_is_other_temp_schema(nr.oid)) ) AS ss
|
||||||
WHERE ss.roid = a.attrelid
|
WHERE ss.roid = a.attrelid
|
||||||
AND a.attnum = (ss.x).x
|
AND a.attnum = (ss.x).x
|
||||||
@@ -1774,7 +1776,7 @@ CREATE VIEW table_constraints AS
|
|||||||
WHERE nc.oid = c.connamespace AND nr.oid = r.relnamespace
|
WHERE nc.oid = c.connamespace AND nr.oid = r.relnamespace
|
||||||
AND c.conrelid = r.oid
|
AND c.conrelid = r.oid
|
||||||
AND c.contype NOT IN ('t', 'x') -- ignore nonstandard constraints
|
AND c.contype NOT IN ('t', 'x') -- ignore nonstandard constraints
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
AND (NOT pg_is_other_temp_schema(nr.oid))
|
AND (NOT pg_is_other_temp_schema(nr.oid))
|
||||||
AND (pg_has_role(r.relowner, 'USAGE')
|
AND (pg_has_role(r.relowner, 'USAGE')
|
||||||
-- SELECT privilege omitted, per SQL standard
|
-- SELECT privilege omitted, per SQL standard
|
||||||
@@ -1804,7 +1806,7 @@ CREATE VIEW table_constraints AS
|
|||||||
AND a.attnotnull
|
AND a.attnotnull
|
||||||
AND a.attnum > 0
|
AND a.attnum > 0
|
||||||
AND NOT a.attisdropped
|
AND NOT a.attisdropped
|
||||||
AND r.relkind IN ('r', 'P')
|
AND r.relkind IN ('r', 'p')
|
||||||
AND (NOT pg_is_other_temp_schema(nr.oid))
|
AND (NOT pg_is_other_temp_schema(nr.oid))
|
||||||
AND (pg_has_role(r.relowner, 'USAGE')
|
AND (pg_has_role(r.relowner, 'USAGE')
|
||||||
-- SELECT privilege omitted, per SQL standard
|
-- SELECT privilege omitted, per SQL standard
|
||||||
@@ -1854,7 +1856,7 @@ CREATE VIEW table_privileges AS
|
|||||||
) AS grantee (oid, rolname)
|
) AS grantee (oid, rolname)
|
||||||
|
|
||||||
WHERE c.relnamespace = nc.oid
|
WHERE c.relnamespace = nc.oid
|
||||||
AND c.relkind IN ('r', 'v', 'P')
|
AND c.relkind IN ('r', 'v', 'p')
|
||||||
AND c.grantee = grantee.oid
|
AND c.grantee = grantee.oid
|
||||||
AND c.grantor = u_grantor.oid
|
AND c.grantor = u_grantor.oid
|
||||||
AND c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER')
|
AND c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER')
|
||||||
@@ -1898,7 +1900,7 @@ CREATE VIEW tables AS
|
|||||||
|
|
||||||
CAST(
|
CAST(
|
||||||
CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY'
|
CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY'
|
||||||
WHEN c.relkind IN ('r', 'P') THEN 'BASE TABLE'
|
WHEN c.relkind IN ('r', 'p') THEN 'BASE TABLE'
|
||||||
WHEN c.relkind = 'v' THEN 'VIEW'
|
WHEN c.relkind = 'v' THEN 'VIEW'
|
||||||
WHEN c.relkind = 'f' THEN 'FOREIGN TABLE'
|
WHEN c.relkind = 'f' THEN 'FOREIGN TABLE'
|
||||||
ELSE null END
|
ELSE null END
|
||||||
@@ -1911,7 +1913,7 @@ CREATE VIEW tables AS
|
|||||||
CAST(nt.nspname AS sql_identifier) AS user_defined_type_schema,
|
CAST(nt.nspname AS sql_identifier) AS user_defined_type_schema,
|
||||||
CAST(t.typname AS sql_identifier) AS user_defined_type_name,
|
CAST(t.typname AS sql_identifier) AS user_defined_type_name,
|
||||||
|
|
||||||
CAST(CASE WHEN c.relkind IN ('r', 'P') OR
|
CAST(CASE WHEN c.relkind IN ('r', 'p') OR
|
||||||
(c.relkind IN ('v', 'f') AND
|
(c.relkind IN ('v', 'f') AND
|
||||||
-- 1 << CMD_INSERT
|
-- 1 << CMD_INSERT
|
||||||
pg_relation_is_updatable(c.oid, false) & 8 = 8)
|
pg_relation_is_updatable(c.oid, false) & 8 = 8)
|
||||||
@@ -1923,7 +1925,7 @@ CREATE VIEW tables AS
|
|||||||
FROM pg_namespace nc JOIN pg_class c ON (nc.oid = c.relnamespace)
|
FROM pg_namespace nc JOIN pg_class c ON (nc.oid = c.relnamespace)
|
||||||
LEFT JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON (c.reloftype = t.oid)
|
LEFT JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON (c.reloftype = t.oid)
|
||||||
|
|
||||||
WHERE c.relkind IN ('r', 'v', 'f', 'P')
|
WHERE c.relkind IN ('r', 'v', 'f', 'p')
|
||||||
AND (NOT pg_is_other_temp_schema(nc.oid))
|
AND (NOT pg_is_other_temp_schema(nc.oid))
|
||||||
AND (pg_has_role(c.relowner, 'USAGE')
|
AND (pg_has_role(c.relowner, 'USAGE')
|
||||||
OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER')
|
OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER')
|
||||||
@@ -2442,7 +2444,7 @@ CREATE VIEW view_column_usage AS
|
|||||||
AND dt.refclassid = 'pg_catalog.pg_class'::regclass
|
AND dt.refclassid = 'pg_catalog.pg_class'::regclass
|
||||||
AND dt.refobjid = t.oid
|
AND dt.refobjid = t.oid
|
||||||
AND t.relnamespace = nt.oid
|
AND t.relnamespace = nt.oid
|
||||||
AND t.relkind IN ('r', 'v', 'f', 'P')
|
AND t.relkind IN ('r', 'v', 'f', 'p')
|
||||||
AND t.oid = a.attrelid
|
AND t.oid = a.attrelid
|
||||||
AND dt.refobjsubid = a.attnum
|
AND dt.refobjsubid = a.attnum
|
||||||
AND pg_has_role(t.relowner, 'USAGE');
|
AND pg_has_role(t.relowner, 'USAGE');
|
||||||
@@ -2520,7 +2522,7 @@ CREATE VIEW view_table_usage AS
|
|||||||
AND dt.refclassid = 'pg_catalog.pg_class'::regclass
|
AND dt.refclassid = 'pg_catalog.pg_class'::regclass
|
||||||
AND dt.refobjid = t.oid
|
AND dt.refobjid = t.oid
|
||||||
AND t.relnamespace = nt.oid
|
AND t.relnamespace = nt.oid
|
||||||
AND t.relkind IN ('r', 'v', 'f', 'P')
|
AND t.relkind IN ('r', 'v', 'f', 'p')
|
||||||
AND pg_has_role(t.relowner, 'USAGE');
|
AND pg_has_role(t.relowner, 'USAGE');
|
||||||
|
|
||||||
GRANT SELECT ON view_table_usage TO PUBLIC;
|
GRANT SELECT ON view_table_usage TO PUBLIC;
|
||||||
@@ -2673,7 +2675,7 @@ CREATE VIEW element_types AS
|
|||||||
a.attnum, a.atttypid, a.attcollation
|
a.attnum, a.atttypid, a.attcollation
|
||||||
FROM pg_class c, pg_attribute a
|
FROM pg_class c, pg_attribute a
|
||||||
WHERE c.oid = a.attrelid
|
WHERE c.oid = a.attrelid
|
||||||
AND c.relkind IN ('r', 'v', 'f', 'c', 'P')
|
AND c.relkind IN ('r', 'v', 'f', 'c', 'p')
|
||||||
AND attnum > 0 AND NOT attisdropped
|
AND attnum > 0 AND NOT attisdropped
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
@@ -136,7 +136,7 @@ CREATE VIEW pg_tables AS
|
|||||||
C.relrowsecurity AS rowsecurity
|
C.relrowsecurity AS rowsecurity
|
||||||
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
|
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
|
||||||
LEFT JOIN pg_tablespace T ON (T.oid = C.reltablespace)
|
LEFT JOIN pg_tablespace T ON (T.oid = C.reltablespace)
|
||||||
WHERE C.relkind IN ('r', 'P');
|
WHERE C.relkind IN ('r', 'p');
|
||||||
|
|
||||||
CREATE VIEW pg_matviews AS
|
CREATE VIEW pg_matviews AS
|
||||||
SELECT
|
SELECT
|
||||||
@@ -294,7 +294,7 @@ CREATE VIEW pg_prepared_statements AS
|
|||||||
CREATE VIEW pg_seclabels AS
|
CREATE VIEW pg_seclabels AS
|
||||||
SELECT
|
SELECT
|
||||||
l.objoid, l.classoid, l.objsubid,
|
l.objoid, l.classoid, l.objsubid,
|
||||||
CASE WHEN rel.relkind IN ('r', 'P') THEN 'table'::text
|
CASE WHEN rel.relkind IN ('r', 'p') THEN 'table'::text
|
||||||
WHEN rel.relkind = 'v' THEN 'view'::text
|
WHEN rel.relkind = 'v' THEN 'view'::text
|
||||||
WHEN rel.relkind = 'm' THEN 'materialized view'::text
|
WHEN rel.relkind = 'm' THEN 'materialized view'::text
|
||||||
WHEN rel.relkind = 'S' THEN 'sequence'::text
|
WHEN rel.relkind = 'S' THEN 'sequence'::text
|
||||||
|
@@ -53,6 +53,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 201703081
|
#define CATALOG_VERSION_NO 201703101
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -162,10 +162,10 @@ DESCR("");
|
|||||||
#define RELKIND_SEQUENCE 'S' /* sequence object */
|
#define RELKIND_SEQUENCE 'S' /* sequence object */
|
||||||
#define RELKIND_TOASTVALUE 't' /* for out-of-line values */
|
#define RELKIND_TOASTVALUE 't' /* for out-of-line values */
|
||||||
#define RELKIND_VIEW 'v' /* view */
|
#define RELKIND_VIEW 'v' /* view */
|
||||||
|
#define RELKIND_MATVIEW 'm' /* materialized view */
|
||||||
#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */
|
#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */
|
||||||
#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */
|
#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */
|
||||||
#define RELKIND_MATVIEW 'm' /* materialized view */
|
#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */
|
||||||
#define RELKIND_PARTITIONED_TABLE 'P' /* partitioned table */
|
|
||||||
|
|
||||||
#define RELPERSISTENCE_PERMANENT 'p' /* regular table */
|
#define RELPERSISTENCE_PERMANENT 'p' /* regular table */
|
||||||
#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */
|
#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */
|
||||||
@@ -178,9 +178,10 @@ DESCR("");
|
|||||||
/* all columns are logged as replica identity */
|
/* all columns are logged as replica identity */
|
||||||
#define REPLICA_IDENTITY_FULL 'f'
|
#define REPLICA_IDENTITY_FULL 'f'
|
||||||
/*
|
/*
|
||||||
* an explicitly chosen candidate key's columns are used as identity;
|
* an explicitly chosen candidate key's columns are used as replica identity.
|
||||||
* will still be set if the index has been dropped, in that case it
|
* Note this will still be set if the index has been dropped; in that case it
|
||||||
* has the same meaning as 'd'
|
* has the same meaning as 'd'.
|
||||||
*/
|
*/
|
||||||
#define REPLICA_IDENTITY_INDEX 'i'
|
#define REPLICA_IDENTITY_INDEX 'i'
|
||||||
|
|
||||||
#endif /* PG_CLASS_H */
|
#endif /* PG_CLASS_H */
|
||||||
|
@@ -404,7 +404,7 @@ CREATE TABLE partitioned (
|
|||||||
SELECT relkind FROM pg_class WHERE relname = 'partitioned';
|
SELECT relkind FROM pg_class WHERE relname = 'partitioned';
|
||||||
relkind
|
relkind
|
||||||
---------
|
---------
|
||||||
P
|
p
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- check that range partition key columns are marked NOT NULL
|
-- check that range partition key columns are marked NOT NULL
|
||||||
|
@@ -1481,7 +1481,7 @@ pg_seclabels| SELECT l.objoid,
|
|||||||
l.classoid,
|
l.classoid,
|
||||||
l.objsubid,
|
l.objsubid,
|
||||||
CASE
|
CASE
|
||||||
WHEN (rel.relkind = ANY (ARRAY['r'::"char", 'P'::"char"])) THEN 'table'::text
|
WHEN (rel.relkind = ANY (ARRAY['r'::"char", 'p'::"char"])) THEN 'table'::text
|
||||||
WHEN (rel.relkind = 'v'::"char") THEN 'view'::text
|
WHEN (rel.relkind = 'v'::"char") THEN 'view'::text
|
||||||
WHEN (rel.relkind = 'm'::"char") THEN 'materialized view'::text
|
WHEN (rel.relkind = 'm'::"char") THEN 'materialized view'::text
|
||||||
WHEN (rel.relkind = 'S'::"char") THEN 'sequence'::text
|
WHEN (rel.relkind = 'S'::"char") THEN 'sequence'::text
|
||||||
@@ -2171,7 +2171,7 @@ pg_tables| SELECT n.nspname AS schemaname,
|
|||||||
FROM ((pg_class c
|
FROM ((pg_class c
|
||||||
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
|
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
|
||||||
LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace)))
|
LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace)))
|
||||||
WHERE (c.relkind = ANY (ARRAY['r'::"char", 'P'::"char"]));
|
WHERE (c.relkind = ANY (ARRAY['r'::"char", 'p'::"char"]));
|
||||||
pg_timezone_abbrevs| SELECT pg_timezone_abbrevs.abbrev,
|
pg_timezone_abbrevs| SELECT pg_timezone_abbrevs.abbrev,
|
||||||
pg_timezone_abbrevs.utc_offset,
|
pg_timezone_abbrevs.utc_offset,
|
||||||
pg_timezone_abbrevs.is_dst
|
pg_timezone_abbrevs.is_dst
|
||||||
|
@@ -9,7 +9,7 @@ VACUUM;
|
|||||||
\a\t
|
\a\t
|
||||||
SELECT relname, relhasindex
|
SELECT relname, relhasindex
|
||||||
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
||||||
WHERE relkind IN ('r', 'P') AND (nspname ~ '^pg_temp_') IS NOT TRUE
|
WHERE relkind IN ('r', 'p') AND (nspname ~ '^pg_temp_') IS NOT TRUE
|
||||||
ORDER BY relname;
|
ORDER BY relname;
|
||||||
a|f
|
a|f
|
||||||
a_star|f
|
a_star|f
|
||||||
|
@@ -464,7 +464,7 @@ ORDER BY 1;
|
|||||||
-- Look for illegal values in pg_class fields
|
-- Look for illegal values in pg_class fields
|
||||||
SELECT p1.oid, p1.relname
|
SELECT p1.oid, p1.relname
|
||||||
FROM pg_class as p1
|
FROM pg_class as p1
|
||||||
WHERE relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v', 'f') OR
|
WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p') OR
|
||||||
relpersistence NOT IN ('p', 'u', 't') OR
|
relpersistence NOT IN ('p', 'u', 't') OR
|
||||||
relreplident NOT IN ('d', 'n', 'f', 'i');
|
relreplident NOT IN ('d', 'n', 'f', 'i');
|
||||||
oid | relname
|
oid | relname
|
||||||
|
@@ -12,7 +12,7 @@ VACUUM;
|
|||||||
|
|
||||||
SELECT relname, relhasindex
|
SELECT relname, relhasindex
|
||||||
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
||||||
WHERE relkind IN ('r', 'P') AND (nspname ~ '^pg_temp_') IS NOT TRUE
|
WHERE relkind IN ('r', 'p') AND (nspname ~ '^pg_temp_') IS NOT TRUE
|
||||||
ORDER BY relname;
|
ORDER BY relname;
|
||||||
|
|
||||||
-- restore normal output mode
|
-- restore normal output mode
|
||||||
|
@@ -339,7 +339,7 @@ ORDER BY 1;
|
|||||||
|
|
||||||
SELECT p1.oid, p1.relname
|
SELECT p1.oid, p1.relname
|
||||||
FROM pg_class as p1
|
FROM pg_class as p1
|
||||||
WHERE relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v', 'f') OR
|
WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p') OR
|
||||||
relpersistence NOT IN ('p', 'u', 't') OR
|
relpersistence NOT IN ('p', 'u', 't') OR
|
||||||
relreplident NOT IN ('d', 'n', 'f', 'i');
|
relreplident NOT IN ('d', 'n', 'f', 'i');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user