Session variables and C functions

From: Ivan Voras <ivoras(at)freebsd(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Session variables and C functions
Date: 2011-11-17 16:58:30
Message-ID: ja3efm$kbh$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm writing a custom C function and one of the things it needs to do is
to be configured from the SQL-land, per user session (different users
have different configurations in different sessions).

I have found (and have used) the SET SESSION command and the
current_setting() function for use with custom_variable_classes
configuration in postgresql.conf, but I'm not sure how to achieve the
same effect from C.

Ideally, the C module would create its own "custom variable class,"
named e.g. "module", then define some setting, e.g. "module.setting".
The users would then execute an SQL command such as "SET SESSION
module.setting='something'", and the module would need to pick this up
in the C function.

Any pointers to how this would be done?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Mead 2011-11-17 17:27:01 Re: monitoring sql queries
Previous Message Tomas Vondra 2011-11-17 16:46:34 Re: monitoring sql queries