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.1612301824150.26892@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
>>> DECLARE @var EXTERNAL
>>
>> I do not know what you mean by 'EXTERNAL'.
>
> it means "used as shared in session"

Shared by whom? There is no such thing in the proposal I have made on the 
wiki or in mails. In the proposal variables are private to the role which 
creates them.

>> It is possible to find "some" typos, depending on the code: you can check
>> that a variable is both assigned and used somewhere, otherwise it is very
>> probably a typo. Perl does that *statically*, before executing a script.
>
> "Before execution" .. I am speaking "without execution".

Before execution is also without execution. You can run "perl -c" to get 
the warning.

> theoretically, if you check all possible functions, you can find some
> issues - but you have to check all function on server.

Yes, sure. It seems to be the same with your proposal: if a hidden 
function drops and recreates a session variable with a different type, or 
changes its permission, then some static checks are void as well, that is 
life. Also, a SQL function may access and modify the variables 
unexpectedly, that would be missed by a PL/pgSQL analysis tool... There is 
no miracle.

Basically, there may be issues even if static analysis tools says that all 
is well.

> Elsewhere you cannot to find typo in DECLARE statement.

Indeed, probably there exists some class of typos that may not be found by 
some static analysis implementations on PL/pgSQL functions which uses 
basic session variables.

By the way, are you planing to contribute to the wiki?
    https://wiki.postgresql.org/wiki/Variable_Design

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Broken atomics code on PPC with FreeBSD 10.3
Next
From: David Fetter
Date:
Subject: Re: [HACKERS] [PATCH] Rename pg_switch_xlog to pg_switch_wal