diff options
-rw-r--r-- | src/bin/pgbench/pgbench.c | 14 | ||||
-rw-r--r-- | src/bin/pgbench/t/001_pgbench_with_server.pl | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index a7fba6cd695..f9c305fae14 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3344,6 +3344,20 @@ readCommandResponse(CState *st, MetaCommand meta, char *varprefix) PQresultErrorMessage(res)); break; + case PGRES_COPY_IN: + case PGRES_COPY_OUT: + case PGRES_COPY_BOTH: + pg_log_error("COPY is not supported in pgbench, aborting"); + + /* + * We need to exit the copy state. Otherwise, PQgetResult() + * will always return an empty PGresult as an effect of + * getCopyResult(), leading to an infinite loop in the error + * cleanup done below. + */ + PQendcopy(st->con); + goto error; + case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: st->estatus = getSQLErrorStatus(PQresultErrorField(res, diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index 28b23cdc678..babbfff4e44 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -1546,6 +1546,16 @@ SELECT pg_advisory_unlock_all(); # Clean up $node->safe_psql('postgres', 'DROP TABLE first_client_table, xy;'); +# Test copy in pgbench +$node->pgbench( + '-t 10', + 2, + [], + [ qr{COPY is not supported in pgbench, aborting} ], + 'Test copy in script', + { + '001_copy' => q{ COPY pgbench_accounts FROM stdin } + }); # done $node->safe_psql('postgres', 'DROP TABLESPACE regress_pgbench_tap_1_ts'); |