Re: Table design for application options

From: -CELKO- <jcelko212_at_earthlink.net>
Date: 4 Jan 2005 07:34:08 -0800
Message-ID: <1104852848.056112.48400_at_z14g2000cwz.googlegroups.com>


>> seems a bit strange to design a table that will only ever hold one
row. <<

Why?

CREATE TABLE Constants
(lock CHAR(1) DEFAULT 'X'
CHECK (lock = 'X') UNIQUE,
pi REAL DEFAULT 3.141592653 NOT NULL,
currency_code CHAR(3) DEFAULT 'USD' NOT NULL, ..);

The lock column keeps the table to one row. If you wish to reset the constants, use this statement,

INSERT INTO Constants DEFAULT VALUES;

Make sure that the SA is the only with update privileges on the table, but that PUBLIC can read it.

>> have a table with two columns: option_name and option_value. <<

That mixes data and metadata in the schema and it is just wrong. If your options are changing every day, then the real problem is an unstable design. Received on Tue Jan 04 2005 - 16:34:08 CET

Original text of this message