public inbox for pgsql-performance@postgresql.org  
help / color / mirror / Atom feed
From: Pavel Luzanov <p.luzanov@postgrespro.ru>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Pavel Golub <pavel@gf.microolap.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] proposal: schema variables
Date: Mon, 12 Mar 2018 18:38:39 +0300
Message-ID: <ef39f19b-9d5c-78d1-6afa-adbe1288a20b@postgrespro.ru> (raw)
In-Reply-To: <CAFj8pRDLBtPM9PAVx-VFtLyZJktKL5R4hX4V4O4KvcyjbOPRbw@mail.gmail.com>
References: <CAFj8pRDY+m9OOxfO10R7J0PAkCCauM-TweaTrdsrsLGMb1VbEQ@mail.gmail.com>
	<623395617.20171113141500@gf.microolap.com>
	<CAFj8pRDdS7ViLBJ6eA93u=C_x15EBv2deiNQDGkBS=LNrjzLLw@mail.gmail.com>
	<CAFj8pRBfb-GTZSHSRVTpMzGr26-7e-_RmOmRpmuk+xuDTgC=mA@mail.gmail.com>
	<CAKFQuwa00-4HTujbnYNy_OdZ2OfjUO3AX4R91DbQ1wPBZegCfg@mail.gmail.com>
	<CAFj8pRBchBfyPKAVPnJKhDjh7r6kTJ9L1=etMt-pjdDzpsKOUA@mail.gmail.com>
	<CAFj8pRCTsxzsxX1cWgX3cjqsSZb=gqOMd3-2FdbGz5a2+shGMg@mail.gmail.com>
	<CAFj8pRA6YWwV=sZj5iSgDUixr-S+u9W2+v0BJqqxHQDXS2oZww@mail.gmail.com>
	<dde8f23f-a15f-e88b-482e-5c26cce14cca@postgrespro.ru>
	<CAFj8pRDLBtPM9PAVx-VFtLyZJktKL5R4hX4V4O4KvcyjbOPRbw@mail.gmail.com>


On 12.03.2018 09:54, Pavel Stehule wrote:
>
> 2018-03-12 7:49 GMT+01:00 Pavel Luzanov <p.luzanov@postgrespro.ru 
> <mailto:p.luzanov@postgrespro.ru>>:
>
>
>     Is there any chances that it will work on replicas?
>
> ...
>
> sure, it should to work. Now, I am try to solve a issues on concept 
> level - the LET code is based on DML code base, so probably there is 
> check for rw transactions. But it is useless for LET command.

Very, very good!

As I understand, the work on this patch now in progress and it not in 
commitfest.
Please explain what features of schema variables I can review now.

 From first post of this thread the syntax of the CREATE VARIABLE command:
CREATE [TEMP] VARIABLE [IF NOT EXISTS] name AS type
   [ DEFAULT expression ] [[NOT] NULL]
   [ ON TRANSACTION END { RESET | DROP } ]
   [ { VOLATILE | STABLE } ];

But in psql I see only:
\h create variable
Command:     CREATE VARIABLE
Description: define a new permissioned typed schema variable
Syntax:
CREATE VARIABLE [ IF NOT EXISTS ] name [ AS ] data_type ]

I can include DEFAULT clause in CREATE VARIABLE command, but the value 
not used:
postgres=# create variable i int default 0;
CREATE VARIABLE
postgres=# select i;
  i
---

(1 row)

postgres=# \d+ i
  schema variable "public.i"
  Column |  Type   | Storage
--------+---------+---------
  i      | integer | plain


BTW, I found an error in handling of table aliases:

postgres=# create variable x text;
CREATE VARIABLE
postgres=# select * from pg_class AS x where x.relname = 'x';
ERROR:  type text is not composite

It thinks that x.relname is an attribute of x variable instead of an 
alias for pg_class table.


-----
Pavel Luzanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



reply

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-performance@postgresql.org
  Cc: p.luzanov@postgrespro.ru, pavel.stehule@gmail.com, david.g.johnston@gmail.com, pavel@gf.microolap.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] proposal: schema variables
  In-Reply-To: <ef39f19b-9d5c-78d1-6afa-adbe1288a20b@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox