Re: Single Row Table?

From: Tim Penhey <tim(at)penhey(dot)net>
To: Yateen Joshi <yjoshi(at)starentnetworks(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Single Row Table?
Date: 2004-08-30 21:12:12
Message-ID: 4133982C.7090709@penhey.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yateen Joshi 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?
>
>
>
> Thanks and regards,
>
>
>
> Yateen V. Joshi
>
>
>
You could try:

id INT PRIMARY KEY NOT NULL DEFAULT(1) CHECK (id = 1),

Tim

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Benjamin Smith 2004-08-30 23:28:21 Conditional foreign key?
Previous Message Josué Maldonado 2004-08-30 21:02:56 update trigger performance