Global constants

Started by Mihai Gheorghiuover 24 years ago3 messagesgeneral
Jump to latest
#1Mihai Gheorghiu
tanethq@earthlink.net

Can there be anything like global constants in PG? They should be seen by
any session.
E.g.:
User rights are defined as int4's, with each bit representing an area where
they have access. Testing this would be easier if I had constants like
ISACCOUNTING, which I AND with the data in the rights field. I'd like to
define ISACCOUNTING=1024 sometime in the beginning (at server startup?).
Thank you.

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Mihai Gheorghiu (#1)
Re: Global constants

Mihai Gheorghiu writes:

Can there be anything like global constants in PG?

CREATE TABLE my_constant ( val integer );
INSERT INTO my_constant VALUES ( 1024 );

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Keary Suska
hierophant@pcisys.net
In reply to: Mihai Gheorghiu (#1)
Re: Global constants

Setting up a table would be the most manageable, but if you don't want to do
that you could create one or more functions to accomplish this.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

Show quoted text

From: "Mihai Gheorghiu" <tanethq@earthlink.net>
Date: Thu, 20 Sep 2001 16:58:04 -0400
To: <pgsql-general@postgresql.org>
Subject: [GENERAL] Global constants

Can there be anything like global constants in PG? They should be seen by
any session.
E.g.:
User rights are defined as int4's, with each bit representing an area where
they have access. Testing this would be easier if I had constants like
ISACCOUNTING, which I AND with the data in the rights field. I'd like to
define ISACCOUNTING=1024 sometime in the beginning (at server startup?).
Thank you.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly