pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Primary key
4+ messages / 4 participants
[nested] [flat]

* Primary key
@ 2007-09-19 14:37 Carol Walter <walterc@indiana.edu>
  2007-09-19 15:20 ` Re: Primary key Niklas Johansson <spot@tele2.se>
  2007-09-19 15:26 ` Re: Primary key Richard Broersma Jr <rabroersma@yahoo.com>
  2007-09-19 16:35 ` Re: Primary key Igor Neyman <ineyman@perceptron.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Carol Walter @ 2007-09-19 14:37 UTC (permalink / raw)
  To: pgsql-admin

Hello,

Does postgres allow compound or composite keys for primary keys?  I  
thought I read someplace that it didn't.  Now, I can't find a  
reference to it.

Carol



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

* Re: Primary key
  2007-09-19 14:37 Primary key Carol Walter <walterc@indiana.edu>
@ 2007-09-19 15:20 ` Niklas Johansson <spot@tele2.se>
  2 siblings, 0 replies; 4+ messages in thread

From: Niklas Johansson @ 2007-09-19 15:20 UTC (permalink / raw)
  To: Carol Walter <walterc@indiana.edu>; +Cc: pgsql-admin


On 19 sep 2007, at 16.37, Carol Walter wrote:
> Does postgres allow compound or composite keys for primary keys?  I  
> thought I read someplace that it didn't.  Now, I can't find a  
> reference to it.

Yes, it does.

http://www.postgresql.org/docs/8.2/interactive/ddl- 
constraints.html#AEN2080


Sincerely,

Niklas Johansson




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

* Re: Primary key
  2007-09-19 14:37 Primary key Carol Walter <walterc@indiana.edu>
@ 2007-09-19 15:26 ` Richard Broersma Jr <rabroersma@yahoo.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Richard Broersma Jr @ 2007-09-19 15:26 UTC (permalink / raw)
  To: Carol Walter <walterc@indiana.edu>; pgsql-admin

--- Carol Walter <walterc@indiana.edu> wrote:

> Does postgres allow compound or composite keys for primary keys?  I  
> thought I read someplace that it didn't.  Now, I can't find a  
> reference to it.

It does.  composite key are defined as a table constraint:
http://www.postgresql.org/docs/8.2/interactive/sql-createtable.html

This link illistrates syntax with this example:

CREATE TABLE films (
    code        char(5),
    title       varchar(40),
    did         integer,
    date_prod   date,
    kind        varchar(10),
    len         interval hour to minute,
    CONSTRAINT code_title PRIMARY KEY(code,title)
);

Regards,
Richard Broersma Jr.



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

* Re: Primary key
  2007-09-19 14:37 Primary key Carol Walter <walterc@indiana.edu>
@ 2007-09-19 16:35 ` Igor Neyman <ineyman@perceptron.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Igor Neyman @ 2007-09-19 16:35 UTC (permalink / raw)
  To: Carol Walter <walterc@indiana.edu>; pgsql-admin

Yes, PG allows  compound or composite keys for primary keys.

Igor

-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Carol Walter
Sent: Wednesday, September 19, 2007 10:37 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] Primary key

Hello,

Does postgres allow compound or composite keys for primary keys?  I
thought I read someplace that it didn't.  Now, I can't find a reference
to it.

Carol

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings




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


end of thread, other threads:[~2007-09-19 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-19 14:37 Primary key Carol Walter <walterc@indiana.edu>
2007-09-19 15:20 ` Niklas Johansson <spot@tele2.se>
2007-09-19 15:26 ` Richard Broersma Jr <rabroersma@yahoo.com>
2007-09-19 16:35 ` Igor Neyman <ineyman@perceptron.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