Thread: sequences TODO items

sequences TODO items

From
Jaime Casanova
Date:
Hi,

i'm looking for some item i can do and that have enough consensus to
make it worth the effort... :)

* Have sequence dependency track use of DEFAULT sequences, seqname.nextval?

what this means? i don't understand it...

* %Disallow changing default expression of a SERIAL column?

why? a SERIAL is not really a datatype but a short-hand to make an
integer with a nextval's sequence as default... so why making them
both (the integer type and the nextval's sequence as default) act as
if it were a single unit?
Actually, i have dropped sequences created with SERIAL because i found
that was better to me to make it manually...

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)


Re: sequences TODO items

From
Bruce Momjian
Date:
Jaime Casanova wrote:
> Hi,
> 
> i'm looking for some item i can do and that have enough consensus to
> make it worth the effort... :)
> 
> * Have sequence dependency track use of DEFAULT sequences, seqname.nextval?
> 
> what this means? i don't understand it...

The idea is to automatically add a dependency of the sequence on the
table using it as a default.

> * %Disallow changing default expression of a SERIAL column?
> 
> why? a SERIAL is not really a datatype but a short-hand to make an
> integer with a nextval's sequence as default... so why making them 
> both (the integer type and the nextval's sequence as default) act as
> if it were a single unit?
> Actually, i have dropped sequences created with SERIAL because i found
> that was better to me to make it manually...

Well, SERIAL adds dependency information, so if you drop the table, the
sequence is dropped.  If you change the default for a serial type, the
dependency on the sequence should go away.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: sequences TODO items

From
Alvaro Herrera
Date:
On Fri, Sep 02, 2005 at 04:57:52PM -0400, Bruce Momjian wrote:
> Jaime Casanova wrote:
> > Hi,
> > 
> > i'm looking for some item i can do and that have enough consensus to
> > make it worth the effort... :)
> > 
> > * Have sequence dependency track use of DEFAULT sequences, seqname.nextval?
> > 
> > what this means? i don't understand it...
> 
> The idea is to automatically add a dependency of the sequence on the
> table using it as a default.

Yeah, the point is that if you treat the sequence name as a text
literal, there's no way to track dependency information.  On the other
hand, if it were treated as, say, an OID, then we could track the
dependency.

In order to do that, we need to change the representation of the DEFAULT
for a serial column.  Instead of the seqname.nextval expression we could
use SQL:2003 syntax, which is something like "NEXT VALUE FOR seqname".

-- 
Alvaro Herrera -- Valdivia, Chile         Architect, www.EnterpriseDB.com
"Si un desconocido se acerca y te regala un CD de Ubuntu ...                                    Eso es ...  Eau de
Tux"