Search Postgresql Archives

Re: limit table to one row

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 4, 2009 at 1:23 PM, Brandon Metcalf
<brandon@xxxxxxxxxxxxxxxxxx> wrote:

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


Actually any column with a unique index on it will work.  It doesn't
have to be primary key or even a serial id.


ANSI-SQL 92 allows for the following syntax:

CONSTRAINT Only_one_row
   CHECK( 1 >= (SELECT COUNT(*) FROM _this_table;));

However, I have yet to find a RDBMS (PostgreSQL included) that
supports select statements in a table's check constraint.


-- 
Regards,
Richard Broersma Jr.

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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux