Re: Single Row Table?

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Single Row Table?
Дата
Msg-id ch2ijf$iem$1@sea.gmane.org
обсуждение исходный текст
Ответ на Re: Single Row Table?  (Tim Penhey <tim@penhey.net>)
Ответы Re: Single Row Table?  (Mike Nolan <nolan@gw.tssi.com>)
Список pgsql-general
Tim Penhey wrote on 30.08.2004 23:12:

>> 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.
>>
>>
> You could try:
>
>     id INT PRIMARY KEY NOT NULL DEFAULT(1) CHECK (id = 1),
>

I like that approach :)

But should you also prevent DELETE's from that table? Otherwise you could
wind up with no rows at all. I guess that would have to be done using a rule...

Thomas

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Not able to build libpq for Windows
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Types and SRF's