From: Tom Lane <tgl@sss.pgh.pa.us>
To: Philip Semanchuk <philip@americanefficient.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Leading comments and client applications
Date: Fri, 25 Mar 2022 11:59:01 -0400
Message-ID: <3262782.1648223941@sss.pgh.pa.us> (raw)
In-Reply-To: <265623A4-F304-4E68-90D0-343F614DB2B7@americanefficient.com>
References: <265623A4-F304-4E68-90D0-343F614DB2B7@americanefficient.com>
Philip Semanchuk <philip@americanefficient.com> writes:
> I'm trying to understand a behavior where, with our Postgres client, a leading comment in a SQL script causes the CREATE FUNCTION statement following it to be not executed. I can't figure out if this is a bug somewhere or just a misunderstanding on my part. I would appreciate some help understanding.
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, philip@americanefficient.com
Subject: Re: Leading comments and client applications
In-Reply-To: <3262782.1648223941@sss.pgh.pa.us>
References: <265623A4-F304-4E68-90D0-343F614DB2B7@americanefficient.com> <3262782.1648223941@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox