Tom Lane írta: > Alvaro Herrera <alvhe...@commandprompt.com> 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. > > regards, tom lane >
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? Best regards, Zoltán Böszörményi -- Bible has answers for everything. Proof: "But let your communication be, Yea, yea; Nay, nay: for whatsoever is more than these cometh of evil." (Matthew 5:37) - basics of digital technology. "May your kingdom come" - superficial description of plate tectonics ---------------------------------- Zoltán Böszörményi Cybertec Schönig & Schönig GmbH http://www.postgresql.at/
diff -dcrpN pgsql.orig/src/backend/tcop/pquery.c pgsql.1/src/backend/tcop/pquery.c *** pgsql.orig/src/backend/tcop/pquery.c 2010-01-03 12:54:25.000000000 +0100 --- pgsql.1/src/backend/tcop/pquery.c 2010-01-12 15:16:32.000000000 +0100 *************** ProcessQuery(PlannedStmt *plan, *** 205,211 **** switch (queryDesc->operation) { case CMD_SELECT: ! strcpy(completionTag, "SELECT"); break; case CMD_INSERT: if (queryDesc->estate->es_processed == 1) --- 205,212 ---- switch (queryDesc->operation) { case CMD_SELECT: ! snprintf(completionTag, COMPLETION_TAG_BUFSIZE, ! "SELECT %u", queryDesc->estate->es_processed); break; case CMD_INSERT: if (queryDesc->estate->es_processed == 1) *************** PortalRunMulti(Portal portal, bool isTop *** 1324,1337 **** */ if (completionTag && completionTag[0] == '\0') { if (portal->commandTag) strcpy(completionTag, portal->commandTag); if (strcmp(completionTag, "INSERT") == 0) ! strcpy(completionTag, "INSERT 0 0"); else if (strcmp(completionTag, "UPDATE") == 0) ! strcpy(completionTag, "UPDATE 0"); else if (strcmp(completionTag, "DELETE") == 0) ! strcpy(completionTag, "DELETE 0"); } } --- 1325,1349 ---- */ if (completionTag && completionTag[0] == '\0') { + Oid lastOid = InvalidOid; + uint32 processed = 0; + + if (portal->queryDesc && portal->queryDesc->estate) + { + lastOid = portal->queryDesc->estate->es_lastoid; + processed = portal->queryDesc->estate->es_processed; + } + if (portal->commandTag) strcpy(completionTag, portal->commandTag); if (strcmp(completionTag, "INSERT") == 0) ! sprintf(completionTag, "INSERT %u %u", lastOid, processed); else if (strcmp(completionTag, "UPDATE") == 0) ! sprintf(completionTag, "UPDATE %u", processed); else if (strcmp(completionTag, "DELETE") == 0) ! sprintf(completionTag, "DELETE %u", processed); ! else if (strcmp(completionTag, "SELECT") == 0) ! sprintf(completionTag, "SELECT %u", processed); } } diff -dcrpN pgsql.orig/src/interfaces/libpq/fe-exec.c pgsql.1/src/interfaces/libpq/fe-exec.c *** pgsql.orig/src/interfaces/libpq/fe-exec.c 2010-01-03 12:54:41.000000000 +0100 --- pgsql.1/src/interfaces/libpq/fe-exec.c 2010-01-12 15:05:06.000000000 +0100 *************** PQcmdTuples(PGresult *res) *** 2753,2758 **** --- 2753,2759 ---- p++; } else if (strncmp(res->cmdStatus, "DELETE ", 7) == 0 || + strncmp(res->cmdStatus, "SELECT ", 7) == 0 || strncmp(res->cmdStatus, "UPDATE ", 7) == 0) p = res->cmdStatus + 7; else if (strncmp(res->cmdStatus, "FETCH ", 6) == 0)
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers