pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Hammond <drew@xyzzy.dhs.org>
To: Kevin Brannen <kevinb@nurseamerica.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: is it easy to change the create sequence algorithm?
Date: Fri, 21 Jun 2002 17:34:59 -0400
Message-ID: <3D139C03.4090503@xyzzy.dhs.org> (raw)
References: <3D0FCD63.8030505@nurseamerica.net>

Well, the quickest solution I can think of off hand is to not use 
SERIAL.  Instead, do it manually, like this:

DROP SEQUENCE my_seq;

CREATE SEQUENCE my_seq;

DROP TABLE my_table;

CREATE TABLE my_table (

    my_table_id INTEGER DEFAULT nextval('my_seq') PRIMARY KEY,

    ...

);


Kevin Brannen wrote:

> I see in the docs that when I create a column that is of type SERIAL, 
> the engine automatically creates the sequence for me, named 
> TABLE_COLUMN_seq.  That's great until the table name + column name 
> lengths are > 27 chars, then it starts chopping, and you guessed it, I 
> have multiple table/column combinations that don't differ until after 
> that length.
>
> Is there a way to influence the "create sequence" generator with a 
> directive, hint, set value, whatever, to be something else?  (e.g. 
> COLUMN_seq if I guarantee all the columns are unique)
>
> Yes I know that I could create the sequence myself, but the engine 
> does such a good job. :-)
>
> Thanks,
> Kevin
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org





view thread (3+ messages)

Message-ID: <3D139C03.4090503@xyzzy.dhs.org>
Permalink:  ../3D139C03.4090503@xyzzy.dhs.org/
Also on:    postgresql.org/message-id/3D139C03.4090503@xyzzy.dhs.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: drew@xyzzy.dhs.org, kevinb@nurseamerica.net
  Subject: Re: is it easy to change the create sequence algorithm?
  In-Reply-To: <3D139C03.4090503@xyzzy.dhs.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox