Variable in PostgreSQL 7.4.x

From: Michal Hlavac <hlavki(at)medium13(dot)sk>
To: pgsql-general(at)postgresql(dot)org
Subject: Variable in PostgreSQL 7.4.x
Date: 2004-05-04 14:39:55
Message-ID: 4097AB3B.6010503@medium13.sk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vikram Kulkarni 2004-05-04 14:51:30 Re: 7.4.2 Regression tests: test stats loops indefinately...
Previous Message Jean-Luc Lachance 2004-05-04 14:25:37 Re: help building datetime from varchars