On 16 Oct 2002 at 9:19, Josh Berkus wrote:
<snip>
> Instead of using the row_oid for the standard tables, though, consider
> doing this:
>
> 1) Create a table-independant sequence, "global_seq"
> 2) Make the primary key of each significant table DEFAULT NEXTVAL
> ('global_seq') instead of SERIAL.
> 3) Reference the primary keys in your blobs table, instead of the OID.
>
> The above will work as well as using the OID, without the potential
> headaches and with a greater degree of control.
<snip>
I hadn't thought of that approach. Sounds like a workable solution, but
then again, so does the OID way. I allways prefer to keep things as
simple as possible, using the most commonly applicated method.
Both OIDs and sequences exist and should do the job, but the question
is, which one is more reliable? Which one will keep it's current
syntax, functionality etc. longest? The db I'm designing will be the
core of my companies IT and will be in use for at least 5 years (the
current one is into its 7th) and a lot can change in that time. That's
why these decisions are so important now, on what horse do I put my
money?
I'll have a closer look at sequences, thanks for sharing your solution!