Storing Configuration settings for a database?

From: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Storing Configuration settings for a database?
Date: 2004-01-26 11:47:04
Message-ID: 4014FE38.4020303@lorenso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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]
...

My question is ... can this be done in PG, should it be done, and what's
the best way to store the data? I can flatten the tree heirarchy if
necessary to yeild something like:

section1.key1 = value1
section1.key2 = "Value Two"
section1.multi word key3 = 12345
...

Since PG stores different datatypes it'd be ideal to have integers be
ints and strings as varchar etc, but to do this means I'd have to define
a separate column for each config option and I'd end up with only one
row of data.

If I use two columns instead like KEY / VALUE, then all values must be of
the same datatype (probably VARCHAR) and setting or reading values will
require casts and parsing of data constantly by applications using the
configs.

Who has built something similar to what I'm attempting, and what do you
recommend?

Dante

----------
D. Dante Lorenso
dante(at)lorenso(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message D. Dante Lorenso 2004-01-26 12:57:30 Casting varchar to interval.?
Previous Message Martijn van Oosterhout 2004-01-26 11:21:24 Re: FAQ (disk space)