2010/1/12 Boszormenyi Zoltan <[email protected]>:
> Tom Lane írta:
>> Alvaro Herrera <[email protected]> writes:
>>
>>> But it would be broken in very obvious ways, no?  It's not like it would
>>> be silently broken and thus escape testing ...
>>>
>>
>> Well, if we wanted to adopt that approach, we should add the count to
>> *all* SELECT tags not just a small subset.  As the patch stands it
>> seems entirely possible that a breakage would escape immediate notice.
>>
>
> Can you give me an example that would return
> plain "SELECT" after my new patch? I added
> one more change to the patch, is it enough to return
> "SELECT N" in every case now?

I just tested this, so I can say definitely: no.  I hacked psql with
the attached patch, and if you just do a plain old SELECT * FROM
table, you get back only SELECT, not SELECT N.

...Robert
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 70b9310..5b37d3d 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -698,7 +698,6 @@ static bool
 PrintQueryResults(PGresult *results)
 {
 	bool		success = false;
-	const char *cmdstatus;
 
 	if (!results)
 		return false;
@@ -709,11 +708,7 @@ PrintQueryResults(PGresult *results)
 			/* print the data ... */
 			success = PrintQueryTuples(results);
 			/* if it's INSERT/UPDATE/DELETE RETURNING, also print status */
-			cmdstatus = PQcmdStatus(results);
-			if (strncmp(cmdstatus, "INSERT", 6) == 0 ||
-				strncmp(cmdstatus, "UPDATE", 6) == 0 ||
-				strncmp(cmdstatus, "DELETE", 6) == 0)
-				PrintQueryStatus(results);
+			PrintQueryStatus(results);
 			break;
 
 		case PGRES_COMMAND_OK:
-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to