Skip to content

Instantly share code, notes, and snippets.

@np422
Created October 9, 2012 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save np422/3857234 to your computer and use it in GitHub Desktop.
Save np422/3857234 to your computer and use it in GitHub Desktop.
select
c.relhasrules,
c.relkind,
c.relhasoids,
c.relname,
u.nspname
from
pg_catalog.pg_namespace u,
pg_catalog.pg_class c
where
u.oid =c.relnamespace and
c.relname = 'sm_param' and
u.nspname = 'sm_owner';
-- Table "pg_catalog.pg_namespace"
-- Column | Type | Modifiers
-- ------------------+-----------+-----------
-- nspname | name | not null -- Name of the namespace
-- Table "pg_catalog.pg_class"
-- Column | Type | Modifiers
-- ------------------+-----------+-----------
-- relname | name | not null -- Name of the table, index, view, etc.
-- relhasrules | boolean | not null -- True if table has (or once had) rules;
-- relkind | "char" | not null -- r = ordinary table, i = index, S = sequence, v = view, c = composite type, t = TOAST table, f = foreign table
-- relhasoids | boolean | not null -- True if we generate an OID for each row of the relation
-- relnamespace | oid | not null -- The OID of the namespace that contains this relation , pg_namespace.oid
-- xtest=# select c.relhasrules, c.relkind, c.relhasoids, c.relname, u.nspname from
-- pg_catalog.pg_namespace u, pg_catalog.pg_class c where u.oid =c.relnamespace
-- and c.relname = 'sm_param' and u.nspname = 'centralen';
-- relhasrules | relkind | relhasoids | relname | nspname
-- -------------+---------+------------+---------+---------
-- (0 rows)
-- xtest=# select c.relhasrules, c.relkind, c.relhasoids, c.relname, u.nspname from
-- pg_catalog.pg_namespace u, pg_catalog.pg_class c where u.oid =c.relnamespace
-- and c.relname = 'sm_param' and u.nspname = 'sm_owner';
-- relhasrules | relkind | relhasoids | relname | nspname
-- -------------+---------+------------+----------+----------
-- f | r | f | sm_param | sm_owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment