Re: Limit A Table To 1 Row

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Limit A Table To 1 Row
Дата
Msg-id web-1603081@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Limit A Table To 1 Row  (<cnliou@eurosport.com>)
Ответы Re: Limit A Table To 1 Row  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Cnliou,

> Corporate table, t1, should contain exact 1 row.
> I strongly believe that there are cleaner versions
> than the following combination of trigger and rule.

Actually, your method looks quite effective and relatively simple.

However, you may want to reconsider this method of storing values in
the database.  What I do is create a table called global_admin:

CREATE TABLE global_admin (value_name VARCHAR(30) NOT NULL PRIMARY KEY,value_format VARCHAR(30) NOT NULL,admin_value
TEXTNULL
 
);

And then I can store all of my random, persistent setting data in one
table:

value_name    value_format    admin_value
'Coporation'    'Text'        'Lugini Corp., Inc.'
'Home Town'    'Text'        'Singapore'
'Timeout Interval'    'Interval'        '30 minutes'
'Max Reports'    'Integer'        '5'
etc.

-Josh Berkus




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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: SQL syntax
Следующее
От: Bhuvan A
Дата:
Сообщение: Effective usage without unique key -- suggestion