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
CREATEFUNCTION statement following it to be not executed. I can't figure out if this is a bug somewhere or just a
misunderstandingon 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