Re: limit table to one row

From: Brandon Metcalf <brandon(at)geronimoalloys(dot)com>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: limit table to one row
Date: 2009-06-04 20:23:28
Message-ID: Pine.LNX.4.58L.0906041521360.17533@cedar.geronimoalloys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

r == richard(dot)broersma(at)gmail(dot)com writes:

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

r> Sure just add a check constraint along the lines of:

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

Got it. Currently, it doesn't have a column for an ID, but I can add
one if this is the only way.

--
Brandon

In response to

Responses

Browse pgsql-general by date

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