NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index

Поиск
Список
Период
Сортировка
Искать

NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index

От:
"David Durst" <ddurst@larubber.com>
Дата:
Can anyone tell me why postgres is creating a implicit index when
I already have a PKEY specified????

Or am I just interpreting this all wrong?

Here is the entry I am putting in:

create sequence journal_line_id_seq increment 1 start 1;

create table journal_lines ( journal_line_id int4 PRIMARY KEY DEFAULT NEXTVAL('journal_line_id_seq'), entry_id int4, account_id int4, line_type int2 CHECK (line_type >= 1 AND line_type <= 2), line_amount money, CONSTRAINT eid FOREIGN KEY(entry_id) REFERENCES journal(entry_id), CONSTRAINT aid FOREIGN KEY(account_id) REFERENCES accounts(account_id)
);

Here is the notice postgres spits out:
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
'journal_lines_pkey' for table 'journal_lines'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
CREATE TABLE




Re: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index

От:
Ludwig Lim <lud_nowhere_man@yahoo.com>
Дата:

--- David Durst  wrote:
> Can anyone tell me why postgres is creating a
> implicit index when
> I already have a PKEY specified????
> 
> Or am I just interpreting this all wrong?
 PostgreSQL uses UNIQUE INDEX to enforce PRIMARY KEY
constraint. Therefore creating a PRIMARY KEY will
automatically create a UNIQUE INDEX.

ludwig.


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

FAQ