Storing Configuration settings for a database?

Поиск
Список
Период
Сортировка
От D. Dante Lorenso
Тема Storing Configuration settings for a database?
Дата
Msg-id 4014FE38.4020303@lorenso.com
обсуждение исходный текст
Ответы Re: Storing Configuration settings for a database?  (Richard Huxton <dev@archonet.com>)
Re: Storing Configuration settings for a database?  (Eric Ridge <ebr@tcdi.com>)
Re: Storing Configuration settings for a database?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Список 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@lorenso.com



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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: FAQ (disk space)
Следующее
От: "D. Dante Lorenso"
Дата:
Сообщение: Casting varchar to interval.?