pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: cnliou@eurosport.com
To: pgsql-sql@postgresql.org
Subject: Re: Limit A Table To 1 Row
Date: Tue, 06 Aug 2002 20:52:31 -0700
Message-ID: <web-1603081@davinci.ethosmedia.com> (raw)
In-Reply-To: <200208070329.32fc@th00.opsion.fr>

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 TEXT NULL
);

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





view thread (4+ messages)  latest in thread

Message-ID: <web-1603081@davinci.ethosmedia.com>
Permalink:  ../web-1603081@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-1603081@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, cnliou@eurosport.com
  Subject: Re: Limit A Table To 1 Row
  In-Reply-To: <web-1603081@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox