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

From Scott Marlowe
Subject Re: Single Row Table?
Date
Msg-id 1093815524.5493.31.camel@localhost.localdomain
Whole thread Raw
In response to Re: Single Row Table?  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: Single Row Table?
Re: Single Row Table?
List pgsql-general
On Sun, 2004-08-29 at 15:30, Bruno Wolff III wrote:
> On Fri, Aug 27, 2004 at 13:32:07 +0530,
>   Yateen Joshi <yjoshi@starentnetworks.com> wrote:
> > Hi,
> >
> > 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.
> > How can I do that? Can I add any constraints? Or do I need to write a
> > separate trigger for the same?
>
> A simple way to force this is to add a primary key and a constraint
> that forces the primary key to be a particular value.

Is it reasonable / possible to add a check constraint something like
select count(*) from table <=1?


pgsql-general by date:

Previous
From: "Chris"
Date:
Subject: malformed array literal in 8beta1
Next
From: "Chris"
Date:
Subject: Re: malformed array literal in 8beta1