No primary key in pg_shadow - Mailing list pgsql-general

From Don Felgar
Subject No primary key in pg_shadow
Date
Msg-id 20021112092147.GA10050@rainier-infosys.com
Whole thread Raw
Responses Re: No primary key in pg_shadow  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

I feel like I must be missing something obvious.  I have what I am
sure must be a common problem, yet I can't find a good solution on the
web or in the PostgreSQL docs.

I recently tore out a front-end based user authentication system,
because I switched to PostgreSQL 7.2 and found that it contains
functionality similar to what I had implemented.

I reference users from other tables, for instance a table of sessions.
My problem is, there seems to be no way to have a foreign key
reference into pg_shadow as it has no unique, non-null field.

I tried creating a table that inherits from pg_shadow and has a
primary key besides, but the problem with this is that INSERT into
this table does not fully duplicate CREATE USER.  I also considered
using OID's, but these are not defined to be UNIQUE.

So it seems that my choices are either to 1) create a table inheriting
from pg_shadow, and a companion a function that re-implmenets CREATE
USER when I do an INSERT into it, or 2) use the pg_shadow.usename
elsewhere, and always watch out for situations where inconsistencies
might occur.  Neither seems very good.

Any advice?

Thanks
Don

pgsql-general by date:

Previous
From: "Ian Harding"
Date:
Subject: Re: select * from function()
Next
From: Joe Conway
Date:
Subject: Re: select * from function()