From 9a9be16b2f7806d3d6c79c8e0c71dfdc0af4d735 Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Mon, 1 Apr 2019 10:43:50 -0400 Subject: [PATCH] search descriptions --- postgres/descriptions.sql | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 postgres/descriptions.sql diff --git a/postgres/descriptions.sql b/postgres/descriptions.sql new file mode 100644 index 0000000..aecd1b1 --- /dev/null +++ b/postgres/descriptions.sql @@ -0,0 +1,28 @@ +SELECT + c.relname table_name, + td.description table_description, + n.nspname schema_name, + a.attname As column_name, + cd.description column_description +FROM + pg_class As c + INNER JOIN pg_attribute As a ON + c.oid = a.attrelid + LEFT JOIN pg_namespace n ON + n.oid = c.relnamespace + LEFT JOIN pg_tablespace t ON + t.oid = c.reltablespace + LEFT JOIN pg_description As cd ON + cd.objoid = c.oid + AND cd.objsubid = a.attnum + LEFT JOIN pg_description As td ON + td.objoid = c.oid + AND td.objsubid = 0 +WHERE + c.relkind IN('r', 'v') + --AND a.attname = 'd07txn' + AND cd.description like '%Transaction Number%' +ORDER BY + n.nspname, + c.relname, + a.attname \ No newline at end of file