From: | David Adams <dpadams(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC |
Date: | 2023-03-13 04:56:49 |
Message-ID: | CAPXPcQv85n4ek+9YeyaDQLhsaHJ0b0RhcokHd6GZXMJ0XNgJLQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Thanks for the answer, a user error would be best case for me as then I can
fix it.
I was hoping that cutting down my real routines to a simple example
wouldn't introduce errors, maybe it did. The form I'm following is shown
the docs like so:
```
BEGIN ATOMIC
statement;
statement;
...
statement;
END
```
My code is
```
BEGIN ATOMIC
return 'atomic';
END;
```
Apart from the final semi-colon, it's exactly the same form, as far as I
can see. Taking the semi-colon out doesn't change anything.
In this toy example, `BEGIN ATOMIC` serves no purpose. In my real code,
`BEGIN ATOMIC` is *very* helpful, as it puts table and column refernces
into the autoamtic dependency tree.
Not sure what I'm missing here, hope it really is something simple.
On Mon, Mar 13, 2023 at 3:47 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Sunday, March 12, 2023, David Adams <dpadams(at)gmail(dot)com> wrote:
>
>>
>> DROP FUNCTION IF EXISTS tools.tell_me_how_atomic();
>> CREATE OR REPLACE FUNCTION tools.tell_me_how_atomic()
>>
>> RETURNS text
>>
>> LANGUAGE SQL
>>
>> BEGIN ATOMIC
>>
>> return 'atomic';
>>
>> END;
>>
>>
> Not a bug, user-error.
>
> https://www.postgresql.org/docs/current/sql-createfunction.html
>
> There are two valid function body forms defined under “sql_body”. Yours
> is neither of those. Rewrite your body using one of those forms. Removing
> being/end would make sense for this example.
>
> David J.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-03-13 04:59:22 | Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC |
Previous Message | David Adams | 2023-03-13 04:49:26 | Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC |