6-pg85-provide-rowcount-for-select-into-ctxdiff.patch

text/x-patch

Filename: 6-pg85-provide-rowcount-for-select-into-ctxdiff.patch
Type: text/x-patch
Part: 0
Message: [PATCH] Provide rowcount for utility SELECTs

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/backend/tcop/pquery.c 2 1
src/interfaces/libpq/fe-exec.c 1 0
diff -dcrpN pgsql.4.1/src/backend/tcop/pquery.c pgsql.6/src/backend/tcop/pquery.c
*** pgsql.4.1/src/backend/tcop/pquery.c	2009-12-15 10:15:05.000000000 +0100
--- pgsql.6/src/backend/tcop/pquery.c	2009-12-22 12:02:55.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)
diff -dcrpN pgsql.4.1/src/interfaces/libpq/fe-exec.c pgsql.6/src/interfaces/libpq/fe-exec.c
*** pgsql.4.1/src/interfaces/libpq/fe-exec.c	2009-08-07 13:06:30.000000000 +0200
--- pgsql.6/src/interfaces/libpq/fe-exec.c	2009-12-22 11:56: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)