Re: [HACKERS] Sequences.... - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Sequences....
Date
Msg-id 199903171618.LAA10133@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Sequences....  (Clark Evans <clark.evans@manhattanproject.com>)
List pgsql-hackers
> Wow. Serious effort here.
> 
> Ryan Bradetich wrote:
> > 1. Leave it as it is now.  It works, just explain to 
> > people that sequences and tables are seperate entities, 
> > and the serial type is just a shortcut.
> 
> I dislike this approach. It seems that it is hiding detail
> that is necessary for proper maintence.  It isn't that
> hard to type in the code.  IMHO, the shortcut causes more
> confusion that it helps.  So, I propose a third option:
> 
> 0.  Remove the SERIAL construct.

When they create a serial, we tell them:
ltest=> create table testx(x serial);NOTICE:  CREATE TABLE will create implicit sequence testx_x_seq forSERIAL column
testx.xNOTICE: CREATE TABLE/UNIQUE will create implicit index testx_x_key fortable testxCREATE
 

So it is not so terrible to tell them they have to delete it when
finished.  We could also add a column to pg_class which tells us this
sequence was auto-created from oid 12, and remove it when we delete a
table.  Or, we could name just try to delete a sequence that has the
name of the table with _seq at the end.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [HACKERS] Problems with >2GB tables on Linux 2.0
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Modulo syntax