Re: Specific Database Vars - Mailing list pgsql-general

From Adrian von Bidder
Subject Re: Specific Database Vars
Date
Msg-id 201004211007.37156@fortytwo.ch
Whole thread Raw
In response to Specific Database Vars  (Glus Xof <gtglus@gmail.com>)
List 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?

Attachment

pgsql-general by date:

Previous
From: Yan Cheng CHEOK
Date:
Subject: Re: unable to start postgresql server services (Windows XP/Professional/Service Pack3)
Next
From: Adrian von Bidder
Date:
Subject: Re: Specific database vars, again...