Re: OID Usage
От | Bo Lorentsen |
---|---|
Тема | Re: OID Usage |
Дата | |
Msg-id | 41E81302.5060102@netgroup.dk обсуждение исходный текст |
Ответ на | Re: OID Usage (Alvaro Herrera <alvherre@dcc.uchile.cl>) |
Ответы |
Re: OID Usage
|
Список | 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
В списке pgsql-general по дате отправления: