Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- The VIEW which is queries when the command
- -- "SELECT * FROM information_schema.views" is issued
- --
- --
- -- information_schema. tables
- --
- -- AS you can see, it contains much of the code
- -- that will appear when you issue the command \d
- -- (see also \d+) - if you have \set ECHO_HIDDEN on
- --
- --
- SELECT
- (nc.nspname)::information_schema.sql_identifier AS table_schema,
- (c.relname)::information_schema.sql_identifier AS table_name,
- (
- CASE
- WHEN (nc.oid = pg_my_temp_schema()) THEN 'LOCAL TEMPORARY'::text
- WHEN (c.relkind = ANY (ARRAY['r'::"char", 'p'::"char"])) THEN 'BASE TABLE'::text
- WHEN (c.relkind = 'v'::"char") THEN 'VIEW'::text
- WHEN (c.relkind = 'f'::"char") THEN 'FOREIGN'::text
- ELSE NULL::text
- END)::information_schema.character_data AS table_type,
- (NULL::name)::information_schema.sql_identifier AS self_referencing_column_name,
- (NULL::character varying)::information_schema.character_data AS reference_generation,
- (
- CASE
- WHEN (t.typname IS NOT NULL) THEN current_database()
- ELSE NULL::name
- END)::information_schema.sql_identifier AS user_defined_type_catalog,
- (nt.nspname)::information_schema.sql_identifier AS user_defined_type_schema,
- (t.typname)::information_schema.sql_identifier AS user_defined_type_name,
- (
- CASE
- WHEN ((c.relkind = ANY (ARRAY['r'::"char", 'p'::"char"])) OR ((c.relkind = ANY (ARRAY['v'::"char", 'f'::"char"])) AND ((pg_relation_is_updatable((c.oid)::regclass, false) & 8) = 8))) THEN 'YES'::text
- ELSE 'NO'::text
- END)::information_schema.yes_or_no AS is_insertable_into,
- (
- CASE
- WHEN (t.typname IS NOT NULL) THEN 'YES'::text
- ELSE 'NO'::text
- END)::information_schema.yes_or_no AS is_typed,
- (NULL::character varying)::information_schema.character_data AS commit_action
- 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)))
- WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'v'::"char", 'f'::"char", 'p'::"char"])) AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(c.relowner, 'USAGE'::text) OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER'::text) OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES'::text)));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement