Re: Leading comments and client applications
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Philip Semanchuk <philip@americanefficient.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Date: 2022-03-25T15:59:01Z
Lists: pgsql-general
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
Commits
-
psql: include intra-query "--" comments in what's sent to the server.
- 83884682f4df 15.0 cited