Are globally defined constants possible at all ? - Mailing list pgsql-general

From Bertin, Philippe
Subject Are globally defined constants possible at all ?
Date
Msg-id B9E404D03707D511BD4D00105A40C10466BBEA@wevmex01.barco.com
Whole thread Raw
Responses Re: Are globally defined constants possible at all ?  (Gregory Seidman <gss+pg@cs.brown.edu>)
List pgsql-general
Hello, all,

In a database we are developing, we use keys in several places. For several
reasons (a.o. speed), these have a type of integer. Select- statements
selecting on such a key (e.g. KindID) have a clause like "... where KindID =
3". In this case, the integer value 3 stands for "software". This is not so
very well readable, to my feeling.

Now my question : is there a decent way (e.g. *globally* defined constants,
or defines, or something else) by which we could make the above mentioned
clause sound something like "... where KindID = SOFTWARE". I've read a fair
part of the PostgreSQL documentation now, but haven't seen anything like
this exists (I'm not a 15- year experienced DBA, you see).

My intention is not to change the type of the keys (in this case e.g.
KindID), nor to redefine a constant in every *separate* function or
procedure. Any ideas on how to tackle this problem elegantly ?

TIA,

    Philippe Bertin
    Software Development Engineer Avionics


pgsql-general by date:

Previous
From: "Tyler Mitchell"
Date:
Subject: Re: Demo versions
Next
From: Andrew Sullivan
Date:
Subject: Re: Slow connection