pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Gerhard Häring <lists@ghaering.de>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: I want to send comments to the backend!
Date: Thu, 20 Mar 2003 12:30:54 -0500
Message-ID: <24626.1048181454@sss.pgh.pa.us> (raw)
In-Reply-To: <200303201722.h2KHMH614777@candle.pha.pa.us>
References: <200303201722.h2KHMH614777@candle.pha.pa.us>

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Yes, I see that now.  res is NULL and PQresultStatus() is returning
> PGRES_NONFATAL_ERROR.  What is strange is that "" and "\n" both return
> an OK result, so I am trying to figure out why comments are different.

The backend special-cases an input string that contains only whitespace
(look in postgres.c).  The special case doesn't apply here, though.

>> Perhaps PGRES_EMPTY_QUERY would be more appropriate?  Not sure where in
>> the chain would be best to change the behavior, though.

> Yes.

Well, we could change the backend --- but that would be a nontrivial
change, and to tell you the truth I think the special response for empty
query is a wart on the protocol anyhow.  In the long run I'd rather get
rid of it.

Or we could change PQexec to return a PGRES_EMPTY_QUERY result if it
gets nothing back from the backend except ReadyForQuery.  Question is,
does that create the possibility of masking error conditions?

Or we could just change PQresultStatus to return PGRES_EMPTY_QUERY for
a null input.  Attractive 'cause it's a one-line change, but I think it
really does create the possibility of masking errors --- application
programmer errors, mostly.

			regards, tom lane



view thread (25+ messages)  latest in thread

Message-ID: <24626.1048181454@sss.pgh.pa.us>
Permalink:  ../24626.1048181454@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24626.1048181454@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us, lists@ghaering.de
  Subject: Re: I want to send comments to the backend!
  In-Reply-To: <24626.1048181454@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox