|
|
@ -4587,14 +4587,15 @@ execq(PG_FUNCTION_ARGS) |
|
|
|
uint64 proc; |
|
|
|
uint64 proc; |
|
|
|
|
|
|
|
|
|
|
|
/* Convert given text object to a C string */ |
|
|
|
/* Convert given text object to a C string */ |
|
|
|
command = text_to_cstring(PG_GETARG_TEXT_PP(1)); |
|
|
|
command = text_to_cstring(PG_GETARG_TEXT_PP(0)); |
|
|
|
cnt = PG_GETARG_INT32(2); |
|
|
|
cnt = PG_GETARG_INT32(1); |
|
|
|
|
|
|
|
|
|
|
|
SPI_connect(); |
|
|
|
SPI_connect(); |
|
|
|
|
|
|
|
|
|
|
|
ret = SPI_exec(command, cnt); |
|
|
|
ret = SPI_exec(command, cnt); |
|
|
|
|
|
|
|
|
|
|
|
proc = SPI_processed; |
|
|
|
proc = SPI_processed; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* If some rows were fetched, print them via elog(INFO). |
|
|
|
* If some rows were fetched, print them via elog(INFO). |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -4611,7 +4612,7 @@ execq(PG_FUNCTION_ARGS) |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
for (i = 1, buf[0] = 0; i <= tupdesc->natts; i++) |
|
|
|
for (i = 1, buf[0] = 0; i <= tupdesc->natts; i++) |
|
|
|
snprintf(buf + strlen (buf), sizeof(buf) - strlen(buf), " %s%s", |
|
|
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s%s", |
|
|
|
SPI_getvalue(tuple, tupdesc, i), |
|
|
|
SPI_getvalue(tuple, tupdesc, i), |
|
|
|
(i == tupdesc->natts) ? " " : " |"); |
|
|
|
(i == tupdesc->natts) ? " " : " |"); |
|
|
|
elog(INFO, "EXECQ: %s", buf); |
|
|
|
elog(INFO, "EXECQ: %s", buf); |
|
|
|