Re: Quick question - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: Quick question
Date
Msg-id GNELIHDDFBOCMGBFGEFOCEGGCAAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: Quick question  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Quick question
Re: Quick question
List pgsql-hackers
> I think there are two completely different issues here: one is what
> name to use for the auto-generated sequence, and the other is whether
> (when) to drop the sequence if the table is dropped.  Fixing the
> latter issue would reduce but not entirely eliminate the issue of
> name collisions.

Hmmm?  No way - see below.

> IIRC, the major objection to the notion of adding random hash characters
> to the auto-generated names was that people wanted to be able to predict
> the names.  There was a long discussion about this a couple years back
> when we settled on the present algorithm.  Please search the archives
> a bit if you want to re-open that issue.

I will search the archives, but I'll explain my thoughts here a well.

Well, what's the problem with appending a number - that's how index names
get generated.

This is my horrible schema that forced me to abandon using SERIAL in favour
of explicit CREATE SEQUENCE statements:

BEGIN;

-- Categories of foods
CREATE TABLE medidiets_categories_foods (category_id SERIAL,description varchar(255) NOT NULL,PRIMARY KEY(category_id)
);

-- Categories of recipes
CREATE TABLE medidiets_categories_rec (category_id SERIAL,description varchar(255) NOT NULL,PRIMARY KEY(category_id)
);

COMMIT;

Both of these SERIALs are given the same name - it's a real pain.

Chris



pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Quick question
Next
From: Tom Lane
Date:
Subject: Re: Quick question