set session - custom variable to store user id I want to store user id in custom session variable and use it (read) in trigger procedures to authorize user actions. I found something like this:

set session "myapp.user" = '12345';
...
SELECT current_setting('myapp.user');


and it seems to work - I thought that "myapp.user" should be declared in .conf file but it seems that I can create session variables on the fly (I didn't change .conf file at all).

Is there any disadvantage of doing like this?
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.