Re: limit table to one row

From: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
To: Brandon Metcalf <brandon(at)geronimoalloys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: limit table to one row
Date: 2009-06-04 20:17:49
Message-ID: 396486430906041317l1ac3092ep70d4960df8e0032d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 4, 2009 at 1:13 PM, Brandon Metcalf
<brandon(at)geronimoalloys(dot)com> wrote:
> Is there a way when creating a table to limit it to one row?  That is,
> without using a stored procedure?

Sure just add a check constraint along the lines of:

CONSTRAINT Only_one_row
CHECK( tableuniqueid = 1 ); --assuming you row has a unique id of 1

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Brodt 2009-06-04 20:18:39 Create Foreign Key Constraint on a View
Previous Message Richard Broersma 2009-06-04 20:17:34 Re: limit table to one row