Skip site navigation (1) Skip section navigation (2)

Re: primary key query

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Shuying Wang <wang(dot)shuying(dot)lists(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: primary key query
Date: 2005-11-03 01:04:00
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
On Thu, Nov 03, 2005 at 11:46:58AM +1100, Shuying Wang wrote:
> Why is relname 'eligibility_type' and not 'enumerations.eligibility_type'?

pg_class.relname stores only the relation name; if you want the
schema name then join pg_class.relnamespace and pg_namespace.oid
and refer to pg_namespace.nspname.  Another way would be to cast
'schemaname.relationname' to regclass and compare it to pg_class.oid:

FROM pg_class c ...
WHERE c.oid = 'enumerations.eligibility_type'::regclass
  AND ...

Michael Fuhr

In response to

pgsql-novice by date

Next:From: williamDate: 2005-11-04 00:41:51
Subject: Unable to login for first time ....
Previous:From: Michael DeanDate: 2005-11-03 00:47:10
Subject: help

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group