Re: limit table to one row

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Brandon Metcalf <brandon(at)geronimoalloys(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: limit table to one row
Date: 2009-06-06 18:29:36
Message-ID: 12808.1244312976@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Sat, Jun 6, 2009 at 2:07 PM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> If you're willing to use a trigger, just insert the one allowed row
>> and then install a trigger that throws error for any insert or delete
>> attempt ...

> what if you need to delete then insert? :-)

Hmm ... I supposed the requirement was "always exactly one row".
If it's "always zero or one row", then you're right.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2009-06-06 19:03:21 Re: NOT NULL with CREATE TYPE
Previous Message Merlin Moncure 2009-06-06 18:12:04 Re: limit table to one row