Re: Specific Database Vars

From: Adrian von Bidder <avbidder(at)fortytwo(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Specific Database Vars
Date: 2010-04-21 08:07:28
Message-ID: 201004211007.37156@fortytwo.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Tuesday 20 April 2010 15.50:35 Glus Xof wrote:

> I know that can use one-row tables but,
>
> I'd like to know if it's possible to define variables attached to one
> specific database,

Yes, one row tables :-)

What I usually do for those random values is a table like "GlobalParameters"
or similar (with three text rows: key, value, type) so I can avoid having 20
separate one row, one column tables for various settings. Defining a
trigger to coerce the value to the desired type is trivial, so your
application can depend on not having completely bogus values in these
settings.

A more esoteric possibility would be to define functions that return a
constant value.

> & saveables when the database tables are dumped.

Not exactly sure what you mean here. If you use pg_dump, usually the whole
db is dumped (table definition, data, sequences, functions, ...)

cheers
-- vbi

--
Wenn ein englisches Flugzeug mit deutschen Passagieren über der Grenze
zwischen Frankreich und Spanien abstürzt ... wo werden dann die
Überlebenden begraben?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian von Bidder 2010-04-21 08:11:48 Re: Specific database vars, again...
Previous Message Yan Cheng CHEOK 2010-04-21 07:38:35 Re: unable to start postgresql server services (Windows XP/Professional/Service Pack3)