Variable in PostgreSQL 7.4.x - Mailing list pgsql-general

From Michal Hlavac
Subject Variable in PostgreSQL 7.4.x
Date
Msg-id 4097AB3B.6010503@medium13.sk
Whole thread Raw
Responses Re: Variable in PostgreSQL 7.4.x
List pgsql-general
Hello,

I am programming web portal. I have table c_language with attributes
i_language_id INT4 PK
c_code CHAR(2) NOT NULL UNIQUE
v_name VARCHAR(32)

and tables referenced to c_language. I need create some variable, which
contain value of i_language_id during one web request.

at start of request I create temporary table f.e.:
SELECT i_language_id INTO lang FROM c_language WHERE c_code='EN';

There is stored procedure get_lang(); which only do
SELECT i_language_id FROM land;

Every view is build like f.e.:
SELECT * FROM TABLE WHERE i_language_id=get_lang();

this create, that on my application layer I need not write language
condition into every query.

but creating of temporary table in every web request is IMHO slow. Is
there another way, how to store temporary variable into postgres.

thanx, hlavki

pgsql-general by date:

Previous
From: Jean-Luc Lachance
Date:
Subject: Re: help building datetime from varchars
Next
From: Vikram Kulkarni
Date:
Subject: Re: 7.4.2 Regression tests: test stats loops indefinately...