Does anyone know why this works this way? When I tried in other stored procedures and text is normally replaced with the value that is specified as stored procedure parameter.
CREATE OR REPLACE FUNCTION setUserId(userId text)
returns void AS $$
BEGIN
SET session "myapp.userId" = userId;
END
$$ LANGUAGE plpgsql;
app=# select * from setUserId('myuserId');
setuserid
-----------
(1 row)
app=# select current_setting('myapp.userId');
current_setting
-----------------
userid
(1 row)
app=#