Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC

Поиск
Список
Период
Сортировка
От David Adams
Тема Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC
Дата
Msg-id CAPXPcQu8bUcJ3gJ3L_htXiPDpMZPh78+jncNhi+ypyiOKoxhog@mail.gmail.com
обсуждение исходный текст
Ответ на Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Thanks for the instantaneous reply.

As far as I know, the problem only shows up with reading in a file with -f or <: That's a bit different to entering the lines one by one.

psql -p 5555 -U postgres -d squid -w -v --echo-all -f "/Users/dpadams2/Desktop/PG_Bug_Tell_Me_How/tell_me_how_atomic.sql"

I've checked again, and can't find any gremlins/invisible characters in the source file, attached. And, this only happens with scripts that use BEGIN ATOMIC, and it seems to happen on all of those files.

For background, I've got my source in a directory tree, and some custom scripts and magic hinting files to let me write out a series of psql -f commands to rebuild my database from scratch. It's handy for linting, and various setup and test procedures.

On Mon, Mar 13, 2023 at 3:34 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
David Adams <dpadams@gmail.com> writes:
> CREATE OR REPLACE FUNCTION tools.tell_me_how_atomic()
> RETURNS text
> LANGUAGE SQL
> BEGIN ATOMIC
> return 'atomic';
> END;
> [ throws a syntax error ]

This works for me.  I wonder if you have some issues with bogus
invisible characters in your actual input file.  Copying and
pasting from your mail (but removing the schema name for
convenience), I got

regression=# CREATE OR REPLACE FUNCTION tell_me_how_atomic()
regression-#
regression-# RETURNS text
regression-#
regression-# LANGUAGE SQL
regression-#
regression-# BEGIN ATOMIC
regression-#
regression-# return 'atomic';
regression-#
regression-# END;
CREATE FUNCTION
regression=# select * from tell_me_how_atomic()
regression-# ;
 tell_me_how_atomic
--------------------
 atomic
(1 row)

                        regards, tom lane
Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC
Следующее
От: David Adams
Дата:
Сообщение: Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC