Re: Leading comments and client applications

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Semanchuk <philip(at)americanefficient(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Leading comments and client applications
Date: 2022-03-25 15:59:01
Message-ID: 3262782.1648223941@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Philip Semanchuk <philip(at)americanefficient(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2022-03-25 16:25:30 Re: Leading comments and client applications
Previous Message David G. Johnston 2022-03-25 15:46:48 Re: Leading comments and client applications