Re: Single Row Table?

Поиск
Список
Период
Сортировка
От Tim Penhey
Тема Re: Single Row Table?
Дата
Msg-id 4133982C.7090709@penhey.net
обсуждение исходный текст
Ответ на Single Row Table?  ("Yateen Joshi" <yjoshi@starentnetworks.com>)
Ответы Re: Single Row Table?  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-general
Yateen Joshi wrote:

Hi,

 

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.

How can I do that? Can I add any constraints? Or do I need to write a separate trigger for the same?

 

Thanks and regards,

 

Yateen V. Joshi

 

You could try:

    id INT PRIMARY KEY NOT NULL DEFAULT(1) CHECK (id = 1),

Tim

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: aggregates with complex type as state and init condition
Следующее
От: Josué Maldonado
Дата:
Сообщение: update trigger performance