Re: [HACKERS] proposal: session server side variables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] proposal: session server side variables
Date
Msg-id alpine.DEB.2.20.1701041748410.22281@lancre
Whole thread Raw
In response to Re: [HACKERS] proposal: session server side variables  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: [HACKERS] proposal: session server side variables
List pgsql-hackers
>>  See attached scripts for instance.
>
> Your test shows so SET SESSION has not transactional behaviour - the
> transactions fails, but the value is not reverted to NULL.

There are *two* function calls, the first fails and the second succeeds. 
Here is the trace with a some comments:
 [...]
 ## SET SESSION x.x = 'null'; SET -- previous has set x.x = 'null'
 ## SELECT setupSecurityContext(3); -- first setup... function call NOTICE:  SET secured = FALSE NOTICE:  SET secured =
TRUE-- there is a SET to 'ok' just after this print -- at the end the transaction fails: ERROR:  insert or update on
table"log" violates foreign key constraint "log_sid_fkey" DETAIL:  Key (sid)=(3) is not present in table "stuff". -- no
resultis displayed from the SELECT
 
 ## SHOW x.x; nul -- the value is the initial value, it has been reverted
 ## SELECT setupSecurityContext(2); -- second setup... function call NOTICE:  SET secured = FALSE NOTICE:  SET secured
=TRUE -- trues is displayed, the function succeeded  t
 
 ## SHOW x.x; ok -- the new value is shown

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [HACKERS] [PATCH] Reload SSL certificates on SIGHUP
Next
From: Simon Riggs
Date:
Subject: Re: [HACKERS] [PATCH] PostgresNode.pm enhancements, pg_lsn helper,and some more recovery tests