Re: Storing Configuration settings for a database?

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

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: I can't upgrade to PostgreSQL 7.4 in RedHat 9.0
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Casting varchar to interval.?