SERIAL + PRIMARY KEY = redundant indexes - Mailing list pgsql-hackers

From Tom Lane
Subject SERIAL + PRIMARY KEY = redundant indexes
Date
Msg-id 13301.926431533@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
With current sources:

regression=> create table t1 ( f1 serial primary key );
NOTICE:  CREATE TABLE will create implicit sequence t1_f1_seq for SERIAL column t1.f1
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index t1_pkey for table t1
CREATE

OK so far ...

regression=> create table t2 ( f1 serial,
regression-> primary key (f1) );
NOTICE:  CREATE TABLE will create implicit sequence t2_f1_seq for SERIAL column t2.f1
NOTICE:  CREATE TABLE/UNIQUE will create implicit index t2_f1_key for table t2
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index t2_pkey for table t2
CREATE

And, indeed, it's made two separate indexes on t2's f1 field.  This is
a bug, no?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] 6.5 TODO list
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: [SQL] plpgsql error