Search Postgresql Archives

Re: One or Both Foregin Keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dennis Gearon <gearond@fireserve.net> writes:
> I am working on a design where a location for something can have:
>     Fully qualified address with even building names, room numbers, and 
> booth numbers.
> **-OR-**
>     GPS location
> **-OR-**
>     Both

> Other than triggers, is there a way to enforce this using tables and 
> primary keys?

Put foreign key constraints on the address and GPS loc (so that they
must be either valid or NULL) and then add a CHECK constraint saying
they can't both be NULL.

			regards, tom lane

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux