Re: Single Row Table? - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: Single Row Table?
Date
Msg-id ch2ijf$iem$1@sea.gmane.org
Whole thread Raw
In response to Re: Single Row Table?  (Tim Penhey <tim@penhey.net>)
Responses Re: Single Row Table?  (Mike Nolan <nolan@gw.tssi.com>)
List pgsql-general
Tim Penhey wrote on 30.08.2004 23:12:

>> I have got a table which is supposed to contain only one row. It does
>> not have any primary keys defined.
>>
>> So, essentially, when a new insert happens in that table, I would like
>> it (the insert) to fail if there is already a row existing in that table.
>>
>>
> You could try:
>
>     id INT PRIMARY KEY NOT NULL DEFAULT(1) CHECK (id = 1),
>

I like that approach :)

But should you also prevent DELETE's from that table? Otherwise you could
wind up with no rows at all. I guess that would have to be done using a rule...

Thomas

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Not able to build libpq for Windows
Next
From: Tom Lane
Date:
Subject: Re: Types and SRF's