Re: limit table to one row

Поиск
Список
Период
Сортировка
Искать
От
Brandon Metcalf
Тема
Re: limit table to one row
Дата
Msg-id
Pine.LNX.4.58L.0906041534170.17533@cedar.geronimoalloys.com
Ответ на
Re: limit table to one row (Richard Broersma)
Список
Дерево обсуждения
limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row Grzegorz Jaśkiewicz <gryzman@gmail.com>
Re: limit table to one row "Leif B. Kristensen" <leif@solumslekt.org>
Re: limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row Grzegorz Jaśkiewicz <gryzman@gmail.com>
Re: limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row Grzegorz Jaśkiewicz <gryzman@gmail.com>
Re: limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row "Octavio Alvarez" <alvarezp@alvarezp.ods.org>
Re: limit table to one row Richard Broersma <richard.broersma@gmail.com>
Re: limit table to one row Niklas Johansson <pgmailings@codecraft.se>
Re: limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row Richard Broersma <richard.broersma@gmail.com>
Re: limit table to one row Brandon Metcalf <brandon@geronimoalloys.com>
Re: limit table to one row Richard Broersma <richard.broersma@gmail.com>
Re: limit table to one row Craig Ringer <craig@postnewspapers.com.au>
Re: limit table to one row Merlin Moncure <mmoncure@gmail.com>
Re: limit table to one row Merlin Moncure <mmoncure@gmail.com>
Re: limit table to one row Tom Lane <tgl@sss.pgh.pa.us>
Re: limit table to one row Merlin Moncure <mmoncure@gmail.com>
Re: limit table to one row Tom Lane <tgl@sss.pgh.pa.us>
r == richard.broersma@gmail.com writes:

 r> On Thu, Jun 4, 2009 at 1:23 PM, Brandon Metcalf
 r>  wrote:

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


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

 r> ANSI-SQL 92 allows for the following syntax:

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

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


I had thought about a subquery in the constraint, but as you say, that
didn't work.

Thanks for the help.

-- 
Brandon
В списке pgsql-general по дате отправления
От: Richard Broersma
Дата:
Сообщение: Re: limit table to one row
От: Merlin Moncure
Дата:
FAQ