Re: I want to send comments to the backend! - Mailing list pgsql-interfaces

From Greg Stark
Subject Re: I want to send comments to the backend!
Date
Msg-id 87isuc73zs.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: I want to send comments to the backend!  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-interfaces
Tom Lane <tgl@sss.pgh.pa.us> writes:

> I think he's complaining that psql strips out the comments before
> sending stuff to the backend.  Unfortunately, most of the world probably
> considers that a feature, not a bug.

I don't know why this user wants them but I can give one example of why one
might want to have comments get processed by the backend:

In my previous project we had the database wrapper functions insert the file
and line number where the call to the wrapper functions were made in sql
comments in the query.

This was **invaluable** for tracking down problems when the only evidence was
information in the logs or query cache. It was so valuable and so easy that I
definitely intend to reimplement it on my current project and on any future
projects.

> I'm quite certain that libpq does not strip comments, so the complaint
> isn't strictly accurate...

Happy news. But a plea to any interface implementors: *Please* don't even
consider stripping comments from queries, It would be most annoying for at
least this user.

--
greg



pgsql-interfaces by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] Bug #904: Deallocating of prepared statement
Next
From: Daniel Bruce Lynes
Date:
Subject: Re: Handling Blobs with libpq