'UNIQUE'

From: Ben Clewett <B(dot)Clewett(at)roadrunner(dot)uk(dot)com>
To:
Cc: pgsql-novice(at)postgresql(dot)org
Subject: 'UNIQUE'
Date: 2003-03-17 14:33:41
Message-ID: 3E75DCC5.9040208@roadrunner.uk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

To describe an optional 1:1 reference I am using the 'UNIQUE' keyword:

key_foo INT UNIQUE,
FOREIGN KEY (key_foo) REFERENCES ....

Does 'UNIQUE' allow multiple 'NULL' entries?

Ie:

key_foo
-------
1
2
NULL
9
8
NULL
4
NULL

If as I expect, this is not the case, could anybody recommend another
way of forming an optional 1:1 reference?

--------x-------X-------x--------

I have a problem of 'stale' data. I want to produce combo-box's of
selectable options, which are PK's of a table. In order to enhance the
system, I want to be lazy and store the values in the control. To do
this I need some way of telling when the source table / view is out of
date and the data has changed.

I could set up Triggers to amend some lookup table containing a
timestamp of the change for a table. But I am wondering if PostgreSQL
stores the last write timestamp to a table somewhere where it can be
checked easily?

Thanks again,

Ben Clewett.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-03-17 14:51:45 Re: 'UNIQUE'
Previous Message David Haines 2003-03-17 02:43:11 Postmaster.pid & Unix domain socket errors, OS X