gpcopy fails with SQL syntax error (SQLSTATE 42601) on \restrict commands
search cancel

gpcopy fails with SQL syntax error (SQLSTATE 42601) on \restrict commands

book

Article ID: 447326

calendar_today

Updated On:

Products

VMware Tanzu Greenplum VMware Tanzu Greenplum / Gemfire

Issue/Introduction

When running gpcopy (specifically version 2.9.5 or earlier) against a Greenplum 7.7 cluster, the utility fails during the metadata import phase with a syntax error similar to the following:

ERROR: syntax error at or near "\" (SQLSTATE 42601)

The logs indicate that gpcopy is attempting to execute \restrict or \unrestrict commands exported by pg_dump 12.22.

Cause

Greenplum 7.7.x includes pg_dump 12.22, which contains a backported security fix (CVE-2025-8714). This fix introduced \restrict and \unrestrict meta-commands into plain-text dumps to prevent malicious SQL injection during restore operations.

While these commands are valid for the psql utility, gpcopy executes dump content directly using a standard Go database driver (db.Exec()). The database engine does not recognize these backslash-prefixed meta-commands as valid SQL, leading to the 42601 syntax error.

Resolution

This issue is resolved in gpcopy 2.9.6