From: Jaime Casanova <jcasanov@systemguards.com.ec>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Gilles Darold <gilles@darold.net>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Subject: Re: Schema variables - new implementation for Postgres 15
Date: Sat, 11 Sep 2021 21:13:38 -0500
Message-ID: <20210912021338.GA21136@ahch-to> (raw)
In-Reply-To: <CAFj8pRDfJ4nC7MV2jK=E63_9M7Bf6+qP1sSYYQuEekWpCzbMNA@mail.gmail.com>
References: <CAFj8pRDrr1_kP84cOKLHqTG=uxmHZiggJuqjAtPqPSKtCgxr9g@mail.gmail.com>
<CAFj8pRDB4OR76HnLnpFmQAk189Ymzb0+Mc3wcaOhyBjaS-CO2A@mail.gmail.com>
<CAFj8pRD5pdT+cSjCcckTiK0p_nqUBYuujbFQ=L-GCmgQUf4vTA@mail.gmail.com>
<CAFj8pRBMxunPa7g3+w88FOJG8xrLN5wprfBe8euidQNPXjYKZQ@mail.gmail.com>
<CAFj8pRBs4FY2AZftRHDyDXtPc7APku+3ZPdA+CKcjeLXR0u=vA@mail.gmail.com>
<44b94969-5e95-6626-a241-d411c0f8e67d@darold.net>
<CAFj8pRCQX+Cry7kN8CDGgpKF2Zmd_vNafzRb-9bhR8bgoZqpGA@mail.gmail.com>
<CAFj8pRD5Hy8Os-hTtw7FSJrHDx3QW6ohKyM+R0DVCH-Fi1G8-A@mail.gmail.com>
<b8c690e9-67f7-b017-fade-d3d0bb03f891@xs4all.nl>
<CAFj8pRDfJ4nC7MV2jK=E63_9M7Bf6+qP1sSYYQuEekWpCzbMNA@mail.gmail.com>
On Fri, Sep 10, 2021 at 10:06:04AM +0200, Pavel Stehule wrote:
> Hi
>
> čt 9. 9. 2021 v 12:21 odesílatel Erik Rijkers <er@xs4all.nl> napsal:
>
> > > [schema-variables-20210909.patch]
> >
> > Hi Pavel,
> >
> > The patch applies and compiles fine but 'make check' for the
> > assert-enabled fails on 131 out of 210 tests.
> >
> > (while compiling HEAD checks run without errors for both assert-disabled
> > and assert-enabled)
> >
> >
>
> Please, check, attached patch. I fixed a routine for processing a list of
> identifiers - now it works with the identifier's node more sensitive.
> Previous implementation of strVal was more tolerant.
>
Hi Pavel,
Just noted that there is no support for REASSIGN OWNED BY:
"""
regression=# create variable random_number numeric;
CREATE VARIABLE
regression=# alter variable random_number owner to jcm;
ALTER VARIABLE
regression=# reassign owned by jcm to jaime;
ERROR: unexpected classid 9222
"""
TEMP variables are not schema variables? at least not attached to the
schema one expects:
"""
regression=# create temp variable random_number numeric ;
CREATE VARIABLE
regression=# \dV
List of variables
Schema | Name | Type | Is nullable | Is mutable | Default | Owner | Transaction
al end action
-----------+---------------+---------+-------------+------------+---------+----------+------------
--------------
pg_temp_4 | random_number | numeric | t | t | | jcasanov |
(1 row)
regression=# select public.random_number;
ERROR: missing FROM-clause entry for table "public"
LINE 1: select public.random_number;
^
"""
There was a comment that TEMP variables should be DECLAREd instead of
CREATEd, i guess that is because those have similar behaviour. At least,
I would like to see similar messages when using the ON COMMIT DROP
option in a TEMP variable:
"""
regression=# create temp variable random_number numeric on commit drop;
CREATE VARIABLE
regression=# \dV
Did not find any schema variables.
regression=# declare q cursor for select 1;
ERROR: DECLARE CURSOR can only be used in transaction blocks
"""
About that, why are you not using syntax ON COMMIT RESET instead on
inventing ON TRANSACTION END RESET? seems better because you already use
ON COMMIT DROP.
I will test more this patch tomorrow. Great work, very complete.
--
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: jcasanov@systemguards.com.ec, pavel.stehule@gmail.com, er@xs4all.nl, gilles@darold.net, pgsql-hackers@lists.postgresql.org, michael@paquier.xyz, amit.kapila16@gmail.com, tomas.vondra@2ndquadrant.com, peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, robertmhaas@gmail.com
Subject: Re: Schema variables - new implementation for Postgres 15
In-Reply-To: <20210912021338.GA21136@ahch-to>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox