Re: Distinguish view and table problem

From: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
To: suzhiyang <suzhiyang(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Distinguish view and table problem
Date: 2009-12-18 16:47:15
Message-ID: 92869e660912180847j2a237962sc1163e123c1be78@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/12/18 suzhiyang <suzhiyang(at)gmail(dot)com>

> How could I get the relkind of a table(view) by its name from pg_class?
>

pg_class is (quite logically) UNIQUE on (relname, relnamespace)

SELECT c.relkind from pg_class c, pg_namespace n
where c.relnamespace = n.oid
and c.relname = 'thetable'
and n.nspname = 'theschema'

--
Filip Rembiałkowski
JID,mailto:filip(dot)rembialkowski(at)gmail(dot)com
http://filip.rembialkowski.net/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-12-18 16:51:11 Re: PATCH: Add hstore_to_json()
Previous Message Nicolas Barbier 2009-12-18 16:33:09 Re: Update on true serializable techniques in MVCC