Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D90114762AE for ; Tue, 22 Oct 2002 00:29:18 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 084DD4761AF for ; Tue, 22 Oct 2002 00:29:17 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9M4TLhR015119; Tue, 22 Oct 2002 00:29:22 -0400 (EDT) To: Casey Allen Shobe Cc: pgsql-admin@postgresql.org Subject: Re: Cannot reference system table In-reply-to: <200210212050.15495.cshobe@secureworks.net> References: <200210212050.15495.cshobe@secureworks.net> Comments: In-reply-to Casey Allen Shobe message dated "Mon, 21 Oct 2002 20:50:15 -0400" Date: Tue, 22 Oct 2002 00:29:21 -0400 Message-ID: <15118.1035260961@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/177 X-Sequence-Number: 6035 Casey Allen Shobe 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