Bug #755: Error on create a new sequence by using the create table command.

Started by PostgreSQL Bugs Listover 23 years ago3 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

S�ren Laursen (sl@scrooge.dk) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Error on create a new sequence by using the create table command.

Long Description
In postgresql 7.1 and 7.2.1:

Then using a statement like:
CREATE TABLE longtablename(
longtablenamenr serial NOT NULL UNIQUE PRIMARY KEY,....

)

and later a
CREATE TABLE longtablenamestep(
longtablenamestepnr serial NOT NULL UNIQUE PRIMARY KEY,....

)

I get an error on creating the last table. This is because the new sequence is named with the same name as the one used by the first table. The create statement is then terminated and no table is created. I would have to create the sequence my self and then create the table using statements like:
not null default nextval('"longtablename_longtablename_sq1"'::text).

Regards,

Soeren Laursen

Sample Code

No file was uploaded with this report

#2Bruce Momjian
bruce@momjian.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #755: Error on create a new sequence by using the create

7.3 will have 64 byte indentifiers, which should make this less likely.

We could randomly pick non-conflicting names, but then the serial names
would not be predicable, and because those are used by nextval(), etc,
it would be bad.

---------------------------------------------------------------------------

pgsql-bugs@postgresql.org wrote:

S���ren Laursen (sl@scrooge.dk) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Error on create a new sequence by using the create table command.

Long Description
In postgresql 7.1 and 7.2.1:

Then using a statement like:
CREATE TABLE longtablename(
longtablenamenr serial NOT NULL UNIQUE PRIMARY KEY,....

)

and later a
CREATE TABLE longtablenamestep(
longtablenamestepnr serial NOT NULL UNIQUE PRIMARY KEY,....

)

I get an error on creating the last table. This is because the new sequence is named with the same name as the one used by the first table. The create statement is then terminated and no table is created. I would have to create the sequence my self and then create the table using statements like:
not null default nextval('"longtablename_longtablename_sq1"'::text).

Regards,

Soeren Laursen

Sample Code

No file was uploaded with this report

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Rod Taylor
rbt@rbt.ca
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #755: Error on create a new sequence by using the

7.3 will partially fix this issue by extending the length of the NAME
data type.

Ie. You won't hit it until you have large (32+ character) length names.

Show quoted text

On Tue, 2002-09-03 at 16:31, pgsql-bugs@postgresql.org wrote:

Søren Laursen (sl@scrooge.dk) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Error on create a new sequence by using the create table command.

Long Description
In postgresql 7.1 and 7.2.1:

Then using a statement like:
CREATE TABLE longtablename(
longtablenamenr serial NOT NULL UNIQUE PRIMARY KEY,....

)

and later a
CREATE TABLE longtablenamestep(
longtablenamestepnr serial NOT NULL UNIQUE PRIMARY KEY,....

)

I get an error on creating the last table. This is because the new sequence is named with the same name as the one used by the first table. The create statement is then terminated and no table is created. I would have to create the sequence my self and then create the table using statements like:
not null default nextval('"longtablename_longtablename_sq1"'::text).

Regards,

Soeren Laursen

Sample Code

No file was uploaded with this report

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html