How to allocate a global variable (to implement virutal databases) - Mailing list pgsql-hackers

From Juan Manuel Diaz Lara
Subject How to allocate a global variable (to implement virutal databases)
Date
Msg-id 20060429182418.44331.qmail@web60325.mail.yahoo.com
Whole thread Raw
Responses Re: How to allocate a global variable (to implement virutal databases)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I would like to implement a row-level security for application-level-user (the user is not a postgresql user), I wish to restrict access to rows in diferent tables based on this application-level-user. My idea is to use rules to rewrite queries based on the contents of a global variable that is set with the application-level-userid, to this end I like to set the variabale at connection-time only, and aplied to all queris by the rewrite rules.
 
I think I can write a c-function but I do not know the correct way to allocate memory with session duration, maybe simply with alloc (o should I use palloc?).
 
Or is there a solution I do not know about?
 
Thanks.


Atte.

Juan Manuel Díaz Lara


Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.

pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: Logging pg_autovacuum
Next
From: Tom Lane
Date:
Subject: Re: How to allocate a global variable (to implement virutal databases)