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 1nXmLF-0003SZ-At for pgsql-general@arkaria.postgresql.org; Fri, 25 Mar 2022 15:59:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nXmLD-0000Qt-KF for pgsql-general@arkaria.postgresql.org; Fri, 25 Mar 2022 15:59:07 +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 1nXmLD-0000Qk-5m for pgsql-general@lists.postgresql.org; Fri, 25 Mar 2022 15:59:07 +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 1nXmL9-0002Gm-BG for pgsql-general@lists.postgresql.org; Fri, 25 Mar 2022 15:59:06 +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 22PFx1uM3262783; Fri, 25 Mar 2022 11:59:01 -0400 From: Tom Lane To: Philip Semanchuk cc: PostgreSQL General Subject: Re: Leading comments and client applications In-reply-to: <265623A4-F304-4E68-90D0-343F614DB2B7@americanefficient.com> References: <265623A4-F304-4E68-90D0-343F614DB2B7@americanefficient.com> Comments: In-reply-to Philip Semanchuk message dated "Fri, 25 Mar 2022 11:32:24 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3262781.1648223941.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 25 Mar 2022 11:59:01 -0400 Message-ID: <3262782.1648223941@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Philip Semanchuk writes: > I'm trying to understand a behavior where, with our Postgres client, a l= eading comment in a SQL script causes the CREATE FUNCTION statement follow= ing it to be not executed. I can't figure out if this is a bug somewhere o= r just a misunderstanding on my part. I would appreciate some help underst= anding. Are you certain there's actually a newline after the comment? The easiest explanation for this would be if something in the SQLAlchemy code path were munging the newline. A completely different line of thought is that the function *does* get created, but inside a transaction that never gets committed. Either way, I think this is mainly a SQLAlchemy question not a Postgres question. As far as the comparison behavior goes, psql's parser strips comments that start with double dashes, for $obscure_reasons. The server is perfectly capable of ignoring those by itself, though. (Awhile back I tried to remove that psql behavior, but it caused too much churn in our regression tests.) regards, tom lane