Search Postgresql Archives

Re: sequence aliases?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 06, 2005 at 12:15:45AM -0500, Greg Stark wrote:
> 
> Tom Lane <tgl@xxxxxxxxxxxxx> writes:
> 
> > My advice to the Rails people would be to fix whatever it is in their
> > code that is assuming a particular sequence name, or indeed assuming
> > a sequence at all...
> 
> Well how else do you find the id of the last inserted record without assuming
> a sequence?

I suppose using something like:

select currval( pg_get_serial_sequence( 'table','col' ) );

That avoids hardcoding the sequence id. Not assuming a sequences at all
may be trickier.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment: pgpYV5iZs0DiJ.pgp
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux