Re: - Mailing list pgsql-novice

From A. Kretschmer
Subject Re:
Date
Msg-id 20100222141622.GE2188@a-kretschmer.de
Whole thread Raw
In response to  (M C <m_c_001@hotmail.com>)
List pgsql-novice
In response to M C :
> CREATE TABLE time (
>         SensorID  VARCHAR (30) references sensorID(SensorID),
>         Time      time without time zone,
>         Date      date,
>         CONSTRAINT Time_Pkey PRIMARY KEY (SensorID, Time, Date)
> );
>
>
> So far so good. However, I now want to set up another table that uses
> time.Time_Pkey as its foreign key, but I can't see how to do it. For example,
> something like:
>
> CREATE TABLE notification (
>         Time_Fkey ??????
>         FOREIGN KEY (Time_Fkey) references time(Time_Pkey),
>         Reason    VARCHAR (30)
> );
>
> What needs to go into "??????"  ? Can I even do something like this? Or can I
> do it with indexes? If so, help please?

test=*# CREATE TABLE notification ( SensorID  VARCHAR (30), Time time without time zone, Date      date, foreign
key(SensorID,Time, Date) references time); 
CREATE TABLE


Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

pgsql-novice by date:

Previous
From: M C
Date:
Subject:
Next
From: Bruce Momjian
Date:
Subject: Re: which mailing list for bindings writers