mirror of https://github.com/citusdata/citus.git
Change table_checks view to use information_schema
parent
a33a5a4a6f
commit
dc5d2e5b9c
|
@ -232,11 +232,14 @@ SELECT "name" AS "Column",
|
||||||
"relid"
|
"relid"
|
||||||
FROM table_attrs;
|
FROM table_attrs;
|
||||||
CREATE VIEW table_checks AS
|
CREATE VIEW table_checks AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT cc.constraint_name AS "Constraint",
|
||||||
pg_catalog.pg_get_constraintdef(r.oid, true) AS "Definition",
|
('CHECK ' || regexp_replace(check_clause, '^\((.*)\)$', '\1')) AS "Definition",
|
||||||
conrelid AS "relid"
|
format('%I.%I', ccu.table_schema, ccu.table_name)::regclass::oid AS relid
|
||||||
FROM pg_catalog.pg_constraint r
|
FROM information_schema.check_constraints cc,
|
||||||
WHERE r.contype = 'c';
|
information_schema.constraint_column_usage ccu
|
||||||
|
WHERE cc.constraint_schema = ccu.constraint_schema AND
|
||||||
|
cc.constraint_name = ccu.constraint_name
|
||||||
|
ORDER BY cc.constraint_name ASC;
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
CREATE VIEW table_fkeys AS
|
CREATE VIEW table_fkeys AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT r.conname AS "Constraint",
|
||||||
|
@ -272,11 +275,14 @@ SELECT "name" AS "Column",
|
||||||
"relid"
|
"relid"
|
||||||
FROM table_attrs;
|
FROM table_attrs;
|
||||||
CREATE VIEW table_checks AS
|
CREATE VIEW table_checks AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT cc.constraint_name AS "Constraint",
|
||||||
pg_catalog.pg_get_constraintdef(r.oid, true) AS "Definition",
|
('CHECK ' || regexp_replace(check_clause, '^\((.*)\)$', '\1')) AS "Definition",
|
||||||
conrelid AS "relid"
|
format('%I.%I', ccu.table_schema, ccu.table_name)::regclass::oid AS relid
|
||||||
FROM pg_catalog.pg_constraint r
|
FROM information_schema.check_constraints cc,
|
||||||
WHERE r.contype = 'c';
|
information_schema.constraint_column_usage ccu
|
||||||
|
WHERE cc.constraint_schema = ccu.constraint_schema AND
|
||||||
|
cc.constraint_name = ccu.constraint_name
|
||||||
|
ORDER BY cc.constraint_name ASC;
|
||||||
\c - - - :worker_2_port
|
\c - - - :worker_2_port
|
||||||
-- create views used to describe relations
|
-- create views used to describe relations
|
||||||
CREATE VIEW table_attrs AS
|
CREATE VIEW table_attrs AS
|
||||||
|
@ -306,8 +312,11 @@ SELECT "name" AS "Column",
|
||||||
"relid"
|
"relid"
|
||||||
FROM table_attrs;
|
FROM table_attrs;
|
||||||
CREATE VIEW table_checks AS
|
CREATE VIEW table_checks AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT cc.constraint_name AS "Constraint",
|
||||||
pg_catalog.pg_get_constraintdef(r.oid, true) AS "Definition",
|
('CHECK ' || regexp_replace(check_clause, '^\((.*)\)$', '\1')) AS "Definition",
|
||||||
conrelid AS "relid"
|
format('%I.%I', ccu.table_schema, ccu.table_name)::regclass::oid AS relid
|
||||||
FROM pg_catalog.pg_constraint r
|
FROM information_schema.check_constraints cc,
|
||||||
WHERE r.contype = 'c';
|
information_schema.constraint_column_usage ccu
|
||||||
|
WHERE cc.constraint_schema = ccu.constraint_schema AND
|
||||||
|
cc.constraint_name = ccu.constraint_name
|
||||||
|
ORDER BY cc.constraint_name ASC;
|
||||||
|
|
|
@ -215,11 +215,14 @@ SELECT "name" AS "Column",
|
||||||
FROM table_attrs;
|
FROM table_attrs;
|
||||||
|
|
||||||
CREATE VIEW table_checks AS
|
CREATE VIEW table_checks AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT cc.constraint_name AS "Constraint",
|
||||||
pg_catalog.pg_get_constraintdef(r.oid, true) AS "Definition",
|
('CHECK ' || regexp_replace(check_clause, '^\((.*)\)$', '\1')) AS "Definition",
|
||||||
conrelid AS "relid"
|
format('%I.%I', ccu.table_schema, ccu.table_name)::regclass::oid AS relid
|
||||||
FROM pg_catalog.pg_constraint r
|
FROM information_schema.check_constraints cc,
|
||||||
WHERE r.contype = 'c';
|
information_schema.constraint_column_usage ccu
|
||||||
|
WHERE cc.constraint_schema = ccu.constraint_schema AND
|
||||||
|
cc.constraint_name = ccu.constraint_name
|
||||||
|
ORDER BY cc.constraint_name ASC;
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
|
|
||||||
|
@ -260,11 +263,14 @@ SELECT "name" AS "Column",
|
||||||
FROM table_attrs;
|
FROM table_attrs;
|
||||||
|
|
||||||
CREATE VIEW table_checks AS
|
CREATE VIEW table_checks AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT cc.constraint_name AS "Constraint",
|
||||||
pg_catalog.pg_get_constraintdef(r.oid, true) AS "Definition",
|
('CHECK ' || regexp_replace(check_clause, '^\((.*)\)$', '\1')) AS "Definition",
|
||||||
conrelid AS "relid"
|
format('%I.%I', ccu.table_schema, ccu.table_name)::regclass::oid AS relid
|
||||||
FROM pg_catalog.pg_constraint r
|
FROM information_schema.check_constraints cc,
|
||||||
WHERE r.contype = 'c';
|
information_schema.constraint_column_usage ccu
|
||||||
|
WHERE cc.constraint_schema = ccu.constraint_schema AND
|
||||||
|
cc.constraint_name = ccu.constraint_name
|
||||||
|
ORDER BY cc.constraint_name ASC;
|
||||||
|
|
||||||
\c - - - :worker_2_port
|
\c - - - :worker_2_port
|
||||||
|
|
||||||
|
@ -298,8 +304,11 @@ SELECT "name" AS "Column",
|
||||||
FROM table_attrs;
|
FROM table_attrs;
|
||||||
|
|
||||||
CREATE VIEW table_checks AS
|
CREATE VIEW table_checks AS
|
||||||
SELECT r.conname AS "Constraint",
|
SELECT cc.constraint_name AS "Constraint",
|
||||||
pg_catalog.pg_get_constraintdef(r.oid, true) AS "Definition",
|
('CHECK ' || regexp_replace(check_clause, '^\((.*)\)$', '\1')) AS "Definition",
|
||||||
conrelid AS "relid"
|
format('%I.%I', ccu.table_schema, ccu.table_name)::regclass::oid AS relid
|
||||||
FROM pg_catalog.pg_constraint r
|
FROM information_schema.check_constraints cc,
|
||||||
WHERE r.contype = 'c';
|
information_schema.constraint_column_usage ccu
|
||||||
|
WHERE cc.constraint_schema = ccu.constraint_schema AND
|
||||||
|
cc.constraint_name = ccu.constraint_name
|
||||||
|
ORDER BY cc.constraint_name ASC;
|
||||||
|
|
Loading…
Reference in New Issue