[EMAIL PROTECTED] wrote:
I have implemented a solution for global variables implemented in plpython and I need implement this in c :)
The below listed tarball is out of date at this point, but I have updated code laying around if someone really wanted it:
http://www.joeconway.com/sessfunc.tar.gz I've used variations of this over the years on several projects. I've also (mis)used custom configs, e.g. in a plpgsql function: 8<---------------------------- EXECUTE 'set myvars.var1 to ''' || p_var1 || ''''; 8<---------------------------- and in your "get session var" C function: 8<---------------------------- #define GET_SESSVAR_BY_NAME(SESS_VAR_NAME) \ do { \ SESS_VAR_NAME = GetConfigOptionByName("myvars." #SESS_VAR_NAME, \ NULL); \ if (!SESS_VAR_NAME) \ elog(ERROR, "Missing session variable: " #SESS_VAR_NAME); \ } while (0) char *var1 = GET_SESSVAR_BY_NAME(var1); 8<---------------------------- Joe -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers