Thread: Specific Database Vars

Specific Database Vars

From
Glus Xof
Date:
Hi guys,

I'm a newbie using PostgreSQL.

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,  & saveables when the database tables are dumped.

Glus

Re: Specific Database Vars

From
Adrian von Bidder
Date:
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