Skip to content

Syntax error at or near "\" when using clone #922

@robinportigliatti

Description

@robinportigliatti

Hello,

When initializing my database with pgench to test pgcopydb I get the following error :

Source is a pg16 and target a pg17

10:39:34.379 8916 INFO   Table public.pgbench_accounts_1000 is 51 MB large, 7 COPY processes will be used, partitioning on aid.
10:39:34.380 8916 INFO   Fetched information for 1003 tables (including 1000 tables split in 7000 partitions total), with an estimated total of 400 million tuples and 50 GB on-disk
10:39:34.428 8916 INFO   Fetched information for 1002 indexes (supporting 1002 constraints)
10:39:34.430 8916 INFO   Fetching information for 0 sequences
10:39:34.473 8916 INFO   Fetched information for 1 extensions
10:39:34.823 8916 INFO   Found 0 indexes (supporting 0 constraints) in the target database
10:39:34.841 8922 INFO   STEP 1: fetch source database tables, indexes, and sequences
10:39:34.903 8926 INFO   Waiting until the pgcopydb sentinel apply is enabled
10:39:34.903 8924 INFO   Resuming streaming at LSN C/287B750 from replication slot "pgcopydb"
10:39:34.936 8924 INFO   Reported write_lsn C/287B750, flush_lsn C/287B750, replay_lsn 0/0
10:39:35.243 8922 INFO   Found 0 indexes (supporting 0 constraints) in the target database
10:39:35.272 8922 INFO   Copy the source database roles, per --roles
10:39:35.272 8922 INFO    /usr/bin/pg_dumpall --roles-only --file /tmp/workdir/schema/roles.sql --dbname 'postgres://[email protected]:5432/bench?keepalives=1&keepalives_idle=10&keepalives_interval=10&keepalives_count=60'
10:39:35.348 8922 INFO   \restrict vgMSgwHTZssD52UU23OcuCVtigHYTIxr21mlz5WaW1rhgTJxQg9MxfDmecQECxb
10:39:35.349 8922 ERROR  [TARGET 6493] ERROR:  syntax error at or near "\"
10:39:35.349 8922 ERROR  [TARGET 6493] LINE 1: \restrict vgMSgwHTZssD52UU23OcuCVtigHYTIxr21mlz5WaW1rhgTJxQg...
10:39:35.349 8922 ERROR  [TARGET 6493]         ^
10:39:35.350 8922 ERROR  [TARGET 6493] ERROR:  syntax error at or near "\"
10:39:35.350 8922 ERROR  [TARGET 6493] SQL query: \restrict vgMSgwHTZssD52UU23OcuCVtigHYTIxr21mlz5WaW1rhgTJxQg9MxfDmecQECxb
10:39:35.350 8922 ERROR  [TARGET 6493] SQL params: 
10:39:35.350 8922 ERROR  Failed to clone source database, see above for details
10:39:35.442 8916 ERROR  clone process 8922 has terminated [6]
^C10:39:35.523 8926 INFO   Apply process received a shutdown signal while waiting for apply mode, quitting now
10:39:35.523 8926 INFO   Apply process has terminated
10:39:35.524 8924 INFO   Reported write_lsn C/287B750, flush_lsn C/287B750, replay_lsn 0/0
10:39:35.525 8916 WARN   Failed to clone the source database, see above for details
10:39:35.525 8925 INFO   Transform process has terminated
10:39:35.526 8916 FATAL  Terminating all processes in our process group
10:39:35.527 8924 ERROR  Failed to update sentinel at stream flush time, see above for details
10:39:35.527 8924 WARN   Streaming got interrupted at C/287B750 after processing 0 message
10:39:35.527 8924 INFO   Prefetch process has terminated
10:39:35.885 8923 INFO   Subprocesses for prefetch, transform, and catchup have now all exited
10:39:35.885 8923 INFO   Catching-up from existing on-disk files
10:39:35.885 8923 ERROR  Failed to read the streaming context information from the source database and internal catalogs, see above for details
10:39:35.927 8916 ERROR  Sub-process 8923 exited with code 12

pgbench has been initialized like this:

sudo -u postgres pgbench --partitions=1000 -i -s 4000 bench

And here is what I execute with pgcopydb:

pgcopydb clone --source="postgresql://postgres:@192.168.80.11:5432/bench" \
--target="postgresql://postgres:@192.168.80.12:5432/bench" \
--dir=/tmp/workdir --table-jobs=3 --index-jobs=3 --restore-jobs=3 --large-objects-jobs=3 \
--split-tables-larger-than="10MB" --estimate-table-sizes --roles \
--follow --skip-vacuum --skip-analyze

Do you know what triggers this error ?

Edit : when removing --roles flags it works. It seems to come from this flag.

Robin from Dalibo,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions