pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Cannot reference system table
2+ messages / 2 participants
[nested] [flat]

* Cannot reference system table
@ 2002-10-22 00:50  Casey Allen Shobe <cshobe@secureworks.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Casey Allen Shobe @ 2002-10-22 00:50 UTC (permalink / raw)
  To: pgsql-admin

create table	"schemes" (
	"id"		integer		not null unique default nextval('schemes_scheme_id_seq'),
	"user_id"	integer		not null references "pg_user" ("usesysid"),
	"scheme_name"	varchar(32)	not null unique,
	"expired"	boolean		not null default false,
	primary key	("id")
);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'schemes_pkey' 
for table 'schemes'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
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?

Also, what can I do before creating the table to eliminate those notices?

Thanks,

-- 
Casey Allen Shobe / Network Security Analyst & PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
cshobe@secureworks.net / http://www.secureworks.net
Content is my own and does not necessarily represent my company.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Cannot reference system table
@ 2002-10-22 04:29  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Casey Allen Shobe <cshobe@secureworks.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-10-22 04:29 UTC (permalink / raw)
  To: Casey Allen Shobe <cshobe@secureworks.net>; +Cc: pgsql-admin

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-10-22 04:29 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-22 00:50 Cannot reference system table Casey Allen Shobe <cshobe@secureworks.net>
2002-10-22 04:29 ` Tom Lane <tgl@sss.pgh.pa.us>

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