Foreign keys

From: "Jacob Vennervald Madsen" <jvm(at)gopinocchio(dot)com>
To: "Postgresql List (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Foreign keys
Date: 2002-04-22 12:50:10
Message-ID: AA6075F044E39D4DBBA876CA427A0E0203D7C2@gop-server.GOP-server.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All

I'm having a problem with Postgresql v. 7.2.
When I create a table and add a foreign key as a table constraint I get
a parse error, but when I add it as a column constraint it works.
This is what I've tried:

CREATE TABLE "alarm_schedule" (
"alarm_schedule_id" SERIAL NOT NULL,
"day_of_week" int2 NOT NULL,
"user_id" int4 NOT NULL,
"send_email" bool NOT NULL,
"send_sms" bool NOT NULL,
PRIMARY KEY ("alarm_schedule_id"),
FOREIGN KEY "user_id" REFERENCES smartlight_user ("user_id")
);

I get this error:
2002-04-22 13:04:53 [21193] ERROR: parser: parse error at or near """
ERROR: parser: parse error at or near """

But when I do this:

CREATE TABLE "alarm_schedule" (
"alarm_schedule_id" SERIAL NOT NULL,
"day_of_week" int2 NOT NULL,
"user_id" int4 NOT NULL REFERENCES smartlight_user ("user_id"),
"send_email" bool NOT NULL,
"send_sms" bool NOT NULL,
PRIMARY KEY ("alarm_schedule_id")
);

It works.

Any ideas?

Note: If you receive this twice it's because I sent it to
pgsql-general(at)postgres(dot)org first.
But it's been hours since I sent it so I figured I'd try
pgsql-general(at)postgresql(dot)org instaed.

Best regards,
Jacob Vennervald Madsen
Systems Developer

GoPinocchio
Norrebrogade 45
DK-2200 Copenhagen
www.gopinocchio.com
+45 26750106

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2002-04-22 13:15:22 Re: Foreign keys
Previous Message Tille, Andreas 2002-04-22 11:59:22 Locale settings