Re: Cannot reference system table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Casey Allen Shobe <cshobe(at)secureworks(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Cannot reference system table
Date: 2002-10-22 04:29:21
Message-ID: 15118.1035260961@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Casey Allen Shobe <cshobe(at)secureworks(dot)net> writes:
> create table "schemes" (
> ...
> "user_id" integer not null references "pg_user" ("usesysid"),
> ...
> ERROR: Referenced relation "pg_user" is not a table

> As you can hopefully see, I need to reference the postgres user table
> for data integrity. Can this be done?

Nope :-(. The immediate cause of that complaint is that pg_user isn't
a table; it's only a view on pg_shadow. But even if you'd referenced
pg_shadow, the command would have been rejected. The difficulty is that
foreign-key constraints require triggers, and we don't support
user-defined triggers on system catalogs. (That would imply the ability
to run arbitrary user-defined code during system catalog updates, which
has a ton of problems that I won't enumerate here.)

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Stein, Jochen 2002-10-22 06:57:51 Newbie question about pg_xlog
Previous Message Casey Allen Shobe 2002-10-22 00:50:15 Cannot reference system table