Re: Schema variables - new implementation for Postgres 15

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Erik Rijkers <er(at)xs4all(dot)nl>, Gilles Darold <gilles(at)darold(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Schema variables - new implementation for Postgres 15
Date: 2021-11-17 16:05:57
Message-ID: CAFj8pRA+V4umZEhjaUkQpww0Wh=-oPUBhGsiMdojHFOo-nQRvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

8) immutable variables without a default value
>
> IMO this case should not be allowed. On 2021/08/29 you wrote:
>
> I thought about this case, and I have one scenario, where this
> behaviour can be useful. When the variable is declared as IMMUTABLE
> NOT NULL without not null default, then any access to the content of
> the variable has to fail. I think it can be used for detection,
> where and when the variable is first used. So this behavior is
> allowed just because I think, so this feature can be interesting for
> debugging. If this idea is too strange, I have no problem to disable
> this case.
>

I checked code, and this case is disallowed already

postgres=# CREATE IMMUTABLE VARIABLE xx AS int NOT NULL;
ERROR: IMMUTABLE NOT NULL variable requires default expression

Regards

Pavel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-11-17 16:07:04 Re: Granting SET and ALTER SYSTE privileges for GUCs
Previous Message Mark Dilger 2021-11-17 15:57:41 Re: Granting SET and ALTER SYSTE privileges for GUCs