From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2010-02-22 14:16:23 |
Message-ID: | 20100222141622.GE2188@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Albe Laurenz | 2010-02-22 14:44:08 | Re: What is unsecure postgres languages? How to disable them? |
Previous Message | M C | 2010-02-22 14:06:01 |