Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 10:54 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > > > https://github.com/postgres/postgres/commit/344a225cb9d42f20df063e4d0e0d4559c5de7910 > > (I haven't figured out what the official way to reference a commit is, I > use the GitHub clone for research so

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-20 Thread David G. Johnston
On Wed, Apr 20, 2022 at 10:45 AM Bryn Llewellyn wrote: > > t...@sss.pgh.pa.us wrote: > > > > > In any case, Bryn's right, the combination of a SET clause and a > PARALLEL clause is implemented incorrectly in AlterFunction. > > I'm taking what I've read in the responses to mean that the testcase

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-20 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > >> david.g.johns...@gmail.com wrote: >> >> Might I suggest the following... > > Actually, the reason proconfig is handled differently is that it's a > variable-length field, so it can't be represented in the C struct that we > overlay onto the catalog tuple...

Re: Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Tom Lane
"David G. Johnston" writes: > Might I suggest the following: > + /* > + * For each action, modify procForm to type-safely set the new value. > + * However, because the SET clause is repeatable we handle it > + * a bit differently, modifying the underlying tuple directly. So > + * make sure to

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread David G. Johnston
On Tue, Apr 19, 2022 at 7:47 PM Julien Rouhaud wrote: > > On Tue, Apr 19, 2022 at 07:21:19PM -0700, David G. Johnston wrote: > > On Tue, Apr 19, 2022 at 7:07 PM Bryn Llewellyn > wrote: > > > > > > *alter function s1.f()security invokerset timezone = 'UTC'stable* > > > *parallel safe* > > > *;*

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Julien Rouhaud
On Tue, Apr 19, 2022 at 11:06:30PM -0400, Tom Lane wrote: > Julien Rouhaud writes: > > On Wed, Apr 20, 2022 at 10:47:07AM +0800, Julien Rouhaud wrote: > >> > >> AFAICT the problem is that SET / RESET part is messing with the > >> HeapTuple, so you can't use the procForm reference afterwards.

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Tom Lane
Julien Rouhaud writes: > On Wed, Apr 20, 2022 at 10:47:07AM +0800, Julien Rouhaud wrote: >> >> AFAICT the problem is that SET / RESET part is messing with the >> HeapTuple, so you can't use the procForm reference afterwards. Simply >> processing parallel_item before set_items fixes the problem,

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Julien Rouhaud
On Wed, Apr 20, 2022 at 10:47:07AM +0800, Julien Rouhaud wrote: > > AFAICT the problem is that SET / RESET part is messing with the HeapTuple, so > you can't use the procForm reference afterwards. Simply processing > parallel_item before set_items fixes the problem, as in the attached. This

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Julien Rouhaud
Hi, On Tue, Apr 19, 2022 at 07:21:19PM -0700, David G. Johnston wrote: > On Tue, Apr 19, 2022 at 7:07 PM Bryn Llewellyn wrote: > > > *SUMMARY* > > > > This part of the syntax diagram for "alter function": > > > > *ALTER FUNCTION name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] > >

Re: Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Tom Lane
"David G. Johnston" writes: > On Tue, Apr 19, 2022 at 7:07 PM Bryn Llewellyn > wrote: >> This is the bug. > While I haven't experimented with this for confirmation, what you are > proposing here (set + parallel safe) is an impossible runtime > combination (semantic rule) but perfectly valid to

Re: Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread David G. Johnston
On Tue, Apr 19, 2022 at 7:07 PM Bryn Llewellyn wrote: > *SUMMARY* > > This part of the syntax diagram for "alter function": > > *ALTER FUNCTION name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] > action [ … ]* > > says that the first "action" can be followed (without punctuation) by >

Unexpected result from ALTER FUNCTION— looks like a bug

2022-04-19 Thread Bryn Llewellyn
SUMMARY This part of the syntax diagram for "alter function": ALTER FUNCTION name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] action [ … ] says that the first "action" can be followed (without punctuation) by zero, one, or many other actions. A semantic rule says that no particular