set session - custom variable to store user id
Before version 9.2, you needed to add your custom class variable to custom_variable_classes
parameter in postgresql.conf
, like:
custom_variable_classes = 'myapp'
In 9.2, this requirement has been removed:
Remove the custom_variable_classes parameter (Tom Lane)
The checking provided by this setting was dubious. Now any setting can be prefixed by any class name.
So, since 9.2 you can just set your custom class variable as you are doing currently, no need to worry about changing postgresql.conf
.