From: Tom Lane <tgl@sss.pgh.pa.us>
To: Casey Allen Shobe <cshobe@secureworks.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: Cannot reference system table
Date: Tue, 22 Oct 2002 00:29:21 -0400
Message-ID: <15118.1035260961@sss.pgh.pa.us> (raw)
In-Reply-To: <200210212050.15495.cshobe@secureworks.net>
References: <200210212050.15495.cshobe@secureworks.net>
Casey Allen Shobe <cshobe@secureworks.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, cshobe@secureworks.net
Subject: Re: Cannot reference system table
In-Reply-To: <15118.1035260961@sss.pgh.pa.us>
References: <200210212050.15495.cshobe@secureworks.net> <15118.1035260961@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox