From: | Bo Lorentsen <bl(at)netgroup(dot)dk> |
---|---|
To: | "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: OID Usage |
Date: | 2005-01-14 18:44:18 |
Message-ID: | 41E81302.5060102@netgroup.dk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alvaro Herrera wrote:
>You can create a function to get the sequence name attached to a table.
>Of course, you should take into account the fact that there could be
>more than one (two serial fields in a table are rare but not
>impossible), but if your tables have only one sequence you should be OK.
>
>
Are there a way to find and test if it is a primary key ?
>Something with
>
>select relname, relkind
>from pg_depend join pg_class on (oid = objid)
>where pg_depend.refobjid = 'foo'::regclass
> and relkind = 'S';
>
>
Hmm, need to play more around using the "pg_" system tables.
Are they all well documentet, or need I some guessing ?
>(only lightly tested). Then you can use that to construct your argument
>to the nextval() function.
>
>
:-)
>This doesn't happen with sequences on Postgres. The value you get is
>guaranteed to be the one the sequence generated for you.
>
>
I know, and this is one of the reasons for not using MySQL :-)
/BL
From | Date | Subject | |
---|---|---|---|
Next Message | Frank D. Engel, Jr. | 2005-01-14 18:47:54 | Re: [HACKERS] Much Ado About COUNT(*) |
Previous Message | Bo Lorentsen | 2005-01-14 18:39:16 | Re: OID Usage |