From: | CSN <cool_screen_name90001(at)yahoo(dot)com> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, CSN <cool_screen_name90001(at)yahoo(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: sequence aliases? |
Date: | 2005-11-06 19:51:40 |
Message-ID: | 20051106195140.24192.qmail@web52906.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
--- Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> On Sun, Nov 06, 2005 at 12:15:45AM -0500, Greg Stark
> wrote:
> >
> > Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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' ) );
I like that better than the current 'table_col_seq'.
Perhaps just currval('table', 'col'). Or perhaps
tables could be made to have a default sequence (one
that's associated with the primary key).
CSN
>
> That avoids hardcoding the sequence id. Not assuming
> a sequences at all
> may be trickier.
>
> Have a nice day,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org>
> 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.
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2005-11-06 20:35:24 | Re: Question about 8.1 release news |
Previous Message | vishal saberwal | 2005-11-06 19:11:13 | Re: Replicating databases |