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

From Ryan Bradetich
Subject Re: [HACKERS] Sequences....
Date
Msg-id 199903170449.VAA20289@hpb50023.boi.hp.com
Whole thread Raw
Responses Re: [HACKERS] Sequences....
List pgsql-hackers
I've finished that patch for the serial->sequences but I am not happy with it.  

I don't think belive my proposed idea is the correct approach.  I still want to work on this 
idea, but I'm not sure how to proceed.

Here are my thoughts:

1.  If I use my proposed idea, everything works great until you dump/reload the table.  The dump 
doesn't store the data type as serial, but as int with a default and a sequence.  So when the 
table gets reloaded, the relationship nolonger exists.  (I think I finally understand the dump 
issues now Tom :))

2.  Tom suggested reference counting the seqence in one of his email's  (I know it was for this 
purpose, but I still liked the idea). I thought about this for a while, and concluded that this 
is probably not the correct solution since the sequence can be accessed from something else 
besides the default values. 

3.  Vadim pointed out that sequences and tables are really seperate entities and now that I 
understand them better, I agree with him.  The serial type is not really a type, but a shortcut 
to create a int4 data type, a key, and a sequence in one command.

I have two current thoughts on how to proceed from here... I want to toss them out, get some 
more feedback ... rediscover that I haven't really thought them out well enought and do this all 
over again :)

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.

2. Create a new data type serial.  I haven't thought idea out much, and need to investigate it 
some more. I'm thinking it would be binary equivilent with the int4 type, and use most of the 
existing seqence code, but not put the seqence name entry in the pg_class system table.  Does 
this sound like a feasible idea? 

Thanks for your input.

-Ryan


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [HACKERS] Problems with >2GB tables on Linux 2.0
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: Developers Globe (FINAL)