pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
2+ messages / 2 participants
[nested] [flat]

* Re: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
@ 2003-01-22 09:53  Ludwig Lim <lud_nowhere_man@yahoo.com>
  parent: David Durst <ddurst@larubber.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Ludwig Lim @ 2003-01-22 09:53 UTC (permalink / raw)
  To: ddurst@larubber.com; +Cc: pgsql-sql


--- David Durst <ddurst@larubber.com> 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
@ 2003-01-22 10:11  David Durst <ddurst@larubber.com>
  0 siblings, 1 reply; 2+ messages in thread

From: David Durst @ 2003-01-22 10:11 UTC (permalink / raw)
  To: pgsql-sql

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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-01-22 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22 10:11 NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index David Durst <ddurst@larubber.com>
2003-01-22 09:53 ` Ludwig Lim <lud_nowhere_man@yahoo.com>

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