We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
[2023-01-08 10:09:58.
967] [018912] [localhost_5432] [PGSQL]
SELECT d.datname, d.oid, pg_get_userbyid(d.datdba) AS owner, shobj_description(d.oid, 'pg_database') AS comment, t.spcname, d.datacl, d.datlastsysoid, d.encoding, pg_encoding_to_char(d.encoding) AS encodingname FROM pg_database d LEFT JOIN pg_tablespace t ON d.dattablespace=t.oid
SELECT c.oid, obj_description(c.oid), c.relhasoids AS hasoids, n.nspname AS schemaname, c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, t.spcname AS "tablespace", c.relhasindex AS hasindexes, c.relhasrules AS hasrules, c.relhastriggers AS hastriggers, c.relacl, c.reltuples, ((SELECT count(*) FROM pg_inherits WHERE inhparent = c.oid) > 0) AS inhtable, i2.relname AS inhtablename, c.reloptions AS param, c.relpersistence AS unlogged 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_inherits i INNER JOIN pg_class c2 ON i.inhparent = c2.oid) i2 ON i2.inhrelid = c.oid WHERE (c.relkind = 'r'::"char") AND n.nspname = 'public'
SELECT col.table_name, col.column_name, col.character_maximum_length, col.is_nullable, col.numeric_precision, col.numeric_scale, col.datetime_precision, col.ordinal_position, b.atttypmod, b.attndims, col.data_type AS col_type, et.typelem, et.typlen, et.typtype, nbt.nspname AS elem_schema , bt.typname AS elem_name, b.atttypid, col.udt_schema, col.udt_name, col.column_default AS col_default, col.domain_catalog, col.domain_schema, col.domain_name, col_description(c.oid, col.ordinal_position) AS comment, b.attacl, coll.collname FROM information_schema.columns AS col LEFT JOIN pg_namespace ns ON ns.nspname = col.table_schema LEFT JOIN pg_class c ON col.table_name = c.relname AND c.relnamespace = ns.oid LEFT JOIN pg_attrdef a ON c.oid = a.adrelid AND col.ordinal_position = a.adnum LEFT JOIN pg_attribute b ON b.attrelid = c.oid AND b.attname = col.column_name LEFT JOIN pg_type et ON et.oid = b.atttypid LEFT JOIN pg_collation coll ON coll.oid = b.attcollation LEFT JOIN pg_type bt ON et.typelem = bt.oid LEFT JOIN pg_namespace nbt ON bt.typnamespace = nbt.oid WHERE col.table_schema = 'public' AND col.table_name = 'accounts' ORDER BY col.table_name, col.ordinal_position
SELECT c.oid, c.conname, c.contype, c.condeferrable, c.condeferred, c.conkey, c.confupdtype, c.confdeltype, c.consrc, t.relname, fns.nspname AS foreign_schema, f.relname AS foreign_table, ts.spcname, i.reloptions AS param, am.amname, c.conexclop, pg_get_expr(ci.indpred, ci.indexrelid, true) where_predicate, obj_description(c.oid) AS comment FROM pg_constraint c LEFT JOIN pg_namespace ns ON (c.connamespace = ns.oid) LEFT JOIN pg_class t ON (c.conrelid = t.oid) LEFT JOIN pg_class i ON (c.conname = i.relname) AND (c.connamespace = i.relnamespace) LEFT JOIN pg_class f ON (c.confrelid = f.oid) LEFT JOIN pg_namespace fns ON (f.relnamespace = fns.oid) LEFT JOIN pg_tablespace ts ON (i.reltablespace = ts.oid) LEFT JOIN pg_am am ON (i.relam = am.oid) LEFT JOIN pg_index ci ON (c.conindid = ci.indexrelid) WHERE ns.nspname = 'public' AND t.relname = 'accounts' ORDER BY t.relname, i.oid
SELECT t.relname, fns.nspname AS foreign_schema, f.relname AS foreign_table, c.conname, c.confkey, a.attname AS foreign_field, a.attnum FROM pg_constraint c LEFT JOIN pg_namespace ns ON (c.connamespace = ns.oid) LEFT JOIN pg_class t ON (c.conrelid = t.oid) INNER JOIN pg_class f ON (c.confrelid = f.oid) LEFT JOIN pg_namespace fns ON (f.relnamespace = fns.oid) INNER JOIN pg_attribute a ON (a.attrelid = f.oid) WHERE a.attnum > 0 AND ns.nspname = 'public' AND t.relname = 'accounts' ORDER BY t.relname, c.conname, a.attnum