Re: Leading comments and client applications

2022-03-25 Thread Laurenz Albe
On Fri, 2022-03-25 at 13:35 -0600, Rob Sargent wrote: > On 3/25/22 13:30, Tom Lane wrote: > > Bob Sargent writes: > > > That story aught to be worth a $beer or two > > > > Hmm. [story] > >  Thank you for the indulgence! I clearly owe you (another) one. I think Tom prefers wine: https://postgr.es/

Re: Leading comments and client applications

2022-03-25 Thread Rob Sargent
On 3/25/22 13:30, Tom Lane wrote: Rob Sargent writes: As far as the comparison behavior goes, psql's parser strips comments that start with double dashes, for $obscure_reasons. That story aught to be worth a $beer or two Hmm. The original reasoning is lost in the mists of time; I dug in our

Re: Leading comments and client applications

2022-03-25 Thread Tom Lane
Rob Sargent writes: >> As far as the comparison behavior goes, psql's parser strips >> comments that start with double dashes, for $obscure_reasons. > That story aught to be worth a $beer or two Hmm. The original reasoning is lost in the mists of time; I dug in our git history and traced the be

Re: Leading comments and client applications

2022-03-25 Thread Philip Semanchuk
> On Mar 25, 2022, at 11:59 AM, Tom Lane wrote: > > Philip Semanchuk 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

Re: Leading comments and client applications

2022-03-25 Thread Peter J. Holzer
On 2022-03-25 11:32:24 -0400, Philip Semanchuk wrote: > 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 misunder

Re: Leading comments and client applications

2022-03-25 Thread Rob Sargent
As far as the comparison behavior goes, psql's parser strips comments that start with double dashes, for $obscure_reasons. That story aught to be worth a $beer or two The server is perfectly capable of ignoring those by itself, though. (Awhile back I tried to remove that psql behavior, but

Re: Leading comments and client applications

2022-03-25 Thread Tom Lane
Philip Semanchuk 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 wo

Re: Leading comments and client applications

2022-03-25 Thread David G. Johnston
On Fri, Mar 25, 2022 at 8:32 AM Philip Semanchuk < phi...@americanefficient.com> wrote: > > Here's the contents of foo.sql -- > > -- this is a comment > CREATE FUNCTION foo(bar text) RETURNS text AS $$ > SELECT bar > $$ > LANGUAGE sql IMMUTABLE PARALLEL SAFE > ; > > When I feed that to 'psql -

Leading comments and client applications

2022-03-25 Thread Philip Semanchuk
Hi, 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 under