public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Pavel Stehule <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Missing can't-assign-to-constant checks in plpgsql
Date: Sat, 30 Apr 2022 11:57:55 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFj8pRA=DQKUz-4yhvtaWGpy0qujoJyySspMZZJ1TeKJeVs86A@mail.gmail.com>
References: <[email protected]>
	<CAFj8pRA=DQKUz-4yhvtaWGpy0qujoJyySspMZZJ1TeKJeVs86A@mail.gmail.com>

Pavel Stehule <[email protected]> writes:
> čt 28. 4. 2022 v 23:52 odesílatel Tom Lane <[email protected]> napsal:
>> Perhaps the OPEN change is a little too aggressive, since if
>> you give the refcursor variable some non-null initial value,
>> OPEN won't change it; in that usage a CONSTANT marking could
>> be allowed.  But I really seriously doubt that anybody out
>> there is marking such variables as constants, so I thought
>> throwing the error at compile time was better than postponing
>> it to runtime so we could handle that.
>> 
>> Regardless of which way we handle that point, I'm inclined to
>> change this only in HEAD.  Probably people wouldn't thank us
>> for making the back branches more strict.

> +1

After sleeping on it, I got cold feet about breaking arguably
legal code, so I made OPEN check at runtime instead.  Which
was probably a good thing anyway, because it made me notice
that exec_stmt_forc() needed a check too.  AFAICS there are no
other places in pl_exec.c that are performing assignments to
variables not checked at parse time.

Pushed that way.

			regards, tom lane






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Missing can't-assign-to-constant checks in plpgsql
  In-Reply-To: <[email protected]>

* 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