Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbaHP-0001L1-TI for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Mar 2023 04:59:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbaHO-0006ok-E4 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Mar 2023 04:59:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbaHO-0006oT-5j for pgsql-bugs@lists.postgresql.org; Mon, 13 Mar 2023 04:59:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbaHM-0008Vg-0W for pgsql-bugs@lists.postgresql.org; Mon, 13 Mar 2023 04:59:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32D4xMfb1669794; Mon, 13 Mar 2023 00:59:22 -0400 From: Tom Lane To: David Adams cc: pgsql-bugs@lists.postgresql.org Subject: Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC In-reply-to: References: <1666633.1678682081@sss.pgh.pa.us> Comments: In-reply-to David Adams message dated "Mon, 13 Mar 2023 15:49:26 +1100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1669792.1678683562.1@sss.pgh.pa.us> Date: Mon, 13 Mar 2023 00:59:22 -0400 Message-ID: <1669793.1678683562@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Adams writes: > 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. No joy on that either ... $ cat test.sql CREATE OR REPLACE FUNCTION tell_me_how_atomic() RETURNS text LANGUAGE SQL BEGIN ATOMIC return 'atomic'; END; $ psql -f test.sql CREATE FUNCTION $ cat test.sql | psql CREATE FUNCTION > 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. Are you entirely sure you're using a new-enough psql? I can replicate your symptom if I try to use v13 psql to send this command to a v14-or-later server. regards, tom lane