Re: 'UNIQUE' - Mailing list pgsql-novice

From Tom Lane
Subject Re: 'UNIQUE'
Date
Msg-id 6083.1047912705@sss.pgh.pa.us
Whole thread Raw
In response to 'UNIQUE'  (Ben Clewett <B.Clewett@roadrunner.uk.com>)
List pgsql-novice
Ben Clewett <B.Clewett@roadrunner.uk.com> writes:
> Does 'UNIQUE' allow multiple 'NULL' entries?

Yes; this is per SQL spec.

> But I am wondering if PostgreSQL
> stores the last write timestamp to a table somewhere where it can be
> checked easily?

No --- Postgres doesn't keep track of that at all.

For the particular situation you are describing, I don't think you
really want timestamps per se.  What you want is a trigger that will
send a NOTIFY message when the table changes.  Apps with dependent state
(like combobox entries) can LISTEN for this message and then rebuild
their local state when they get it.  This is much more efficient than
putting a timestamp someplace, because the recipients don't have to
waste cycles probing to find out if there's been an update.

            regards, tom lane

pgsql-novice by date:

Previous
From: Ben Clewett
Date:
Subject: 'UNIQUE'
Next
From: "Sugrue, Sean"
Date:
Subject: perl and postgresql