From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | dante(at)lorenso(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Storing Configuration settings for a database? |
Date: | 2004-01-26 15:48:11 |
Message-ID: | 200401261548.11852.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Monday 26 January 2004 11:47, D. Dante Lorenso wrote:
> I want to store config file keys and values in my PG database
> in order to 1) be able to INSERT/UPDATE/DELETE configuration settings
> without a flat file and 2) give access to the config settings with
> my web application.
>
> Right now, my java application uses a config file similar to an .INI
> file with the following format:
>
> [section1]
> key1 = value1
> key2 = "Value Two"
> multi word key3 = 12345
> [section2]
> Who has built something similar to what I'm attempting, and what do you
> recommend?
I tend to have something like:
CREATE TABLE config_settings AS (
section varchar(64),
item varchar(64),
type varchar(16),
value text,
PRIMARY KEY (section,item)
);
In general, two levels (section,item) seem enough, but it's trivial to add
another. I cast the value from text => my desired type in the app (or raise
an exception if there is a problem).
Oh - I frequently add a "notes" or "description" column to for instructions on
what value should go in.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2004-01-26 15:51:15 | Re: Casting varchar to interval.? |
Previous Message | Richard Huxton | 2004-01-26 15:39:23 | Re: I can't upgrade to PostgreSQL 7.4 in RedHat 9.0 |