From: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
---|---|
To: | Julien Rouhaud <rjuju123(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: SQL-standard function body |
Date: | 2021-06-07 08:52:10 |
Message-ID: | 993a2fe6-93b9-3364-21bb-6e2d8c0fde13@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 06.06.21 09:32, Julien Rouhaud wrote:
> On Sat, Jun 05, 2021 at 09:44:18PM -0700, Noah Misch wrote:
>> I get a NULL pointer dereference if the function body has a doubled semicolon:
>>
>> create function f() returns int language sql begin atomic select 1;; end;
>
> You don't even need a statements to reproduce the problem, a body containing
> only semi-colon(s) will behave the same.
>
> Attached patch should fix the problem.
Your patch filters out empty statements at the parse transformation
phase, so they are no longer present when you dump the body back out.
So your edits in the test expected files don't fit.
I suggest we just prohibit empty statements at the parse stage. I don't
see a strong reason to allow them, and if we wanted to, we'd have to do
more work, e.g., in ruleutils.c to print them back out correctly.
Attachment | Content-Type | Size |
---|---|---|
0001-Prevent-empty-statement-in-unquoted-SQL-function-bod.patch | text/plain | 2.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2021-06-07 09:03:49 | Re: installcheck failure in indirect_toast with default_toast_compression = lz4 |
Previous Message | Kyotaro Horiguchi | 2021-06-07 08:32:31 | Re: Duplicate history file? |