Re: proposal: session server side variables

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: session server side variables
Date: 2016-12-30 17:39:25
Message-ID: alpine.DEB.2.20.1612301824150.26892@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2016-12-30 17:46:40 Re: [PATCH] Rename pg_switch_xlog to pg_switch_wal
Previous Message Tom Lane 2016-12-30 17:18:48 Re: Broken atomics code on PPC with FreeBSD 10.3