Multiple Primary Keys 
Author Message
 Multiple Primary Keys

This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C2BC87.36B78980
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,=20

How to create a table with multiple primary key?
I'm trying this manner but don't work.

CREATE TABLE A ( FIELD1 INT PRIMARY KEY, FIELD2 INT PRIMARY KEY);

and=20

CREATE TABLE A ( FIELD1 INT , FIELD2 INT , PRIMARY KEY(FIELD1, FIELD2);

But i've the following message:

ERROR: CREATE TABLE / PRIMARY KEY multiple primary keys for table 'A' are n=
ot allowed.

How to do?

Best Regards.

Isa=EDas

------=_NextPart_000_0020_01C2BC87.36B78980
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4919.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How to create a table with multiple primar=
y=20
key?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm trying this manner but don't work.</FO=
NT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>CREATE TABLE A (&nbsp;FIELD1 INT&nbsp;PRIM=
ARY KEY,=20
FIELD2 INT PRIMARY KEY);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>CREATE TABLE A (&nbsp;FIELD1 INT&nbsp;, FI=
ELD2 INT=20
, PRIMARY KEY(FIELD1, FIELD2);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>But i've the following message:</DIV>
<DIV>&nbsp;</DIV>
<DIV>ERROR: CREATE TABLE / PRIMARY KEY multiple primary keys for table 'A' =
are=20
not allowed.</DIV>
<DIV>&nbsp;</DIV>
<DIV>How to do?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Best Regards.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Isa=EDas</DIV>
<DIV>&nbsp;</DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_0020_01C2BC87.36B78980--



Sun, 03 Jul 2005 21:10:22 GMT
 Multiple Primary Keys



Quote:
>CREATE TABLE A ( FIELD1 INT PRIMARY KEY, FIELD2 INT PRIMARY KEY);
>ERROR: CREATE TABLE / PRIMARY KEY multiple primary keys for table 'A' are not allowed.

The error message says it all.

Quote:
>CREATE TABLE A ( FIELD1 INT , FIELD2 INT , PRIMARY KEY(FIELD1, FIELD2);

                                                                      ^
This should work, if you add a ) here --------------------------------+

Servus
 Manfred

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

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



Sun, 03 Jul 2005 23:09:14 GMT
 Multiple Primary Keys

Quote:

> How to create a table with multiple primary key?

What?  A table can only have one primary key, by definition.

What is it you're actually trying to accomplish?

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Sun, 03 Jul 2005 23:12:40 GMT
 Multiple Primary Keys
Thanks all by response.

Isaias

Quote:
----- Original Message -----



Sent: Wednesday, January 15, 2003 1:00 PM
Subject: Re: [GENERAL] Multiple Primary Keys

> On Wed, 15 Jan 2003 11:14:04 -0200, Isaas Cristiano Barroso


> >CREATE TABLE A ( FIELD1 INT PRIMARY KEY, FIELD2 INT PRIMARY KEY);
> >ERROR: CREATE TABLE / PRIMARY KEY multiple primary keys for table 'A' are
not allowed.

> The error message says it all.

> >CREATE TABLE A ( FIELD1 INT , FIELD2 INT , PRIMARY KEY(FIELD1, FIELD2);
>                                                                       ^
> This should work, if you add a ) here --------------------------------+

> Servus
>  Manfred

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Sun, 03 Jul 2005 23:19:41 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Strange behavior on multiple primary key behavior d

2. cannot create table with MULTIPLE PRIMARY KEYS

3. Shape recordsets with multiple primary keys?

4. Strange behavior on multiple primary key behavior

5. multiple primary keys

6. cannot create table with multiple Primary Keys

7. multiple primary keys

8. Multiple Primary Keys

9. multiple primary key on a table variable???

10. multiple primary keys

11. Multiple Primary Keys

12. Strange behavior on multiple primary key behavior deleting childr


 
Powered by phpBB® Forum Software