RE: sequencesync worker race with REFRESH SEQUENCES

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'vignesh C' <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: sequencesync worker race with REFRESH SEQUENCES
Date: 2026-07-21 11:37:07
Message-ID: OS9PR01MB12149C5AC91BB56D5CB4B96B2F5C22@OS9PR01MB12149.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Vignesh,

Thanks for attaching the patch. I think there is a corner case that ALTER
SERVER command changes the connection to the pre-PG19 server.

Firstly, we can create a server for connecting to the PG19 server:
CREATE SERVER server ... OPTIONS (...);

Then we can use the SERVER in the subscription definition:
CREATE SUBSCRIPTION sub SERVER server ...;

After that, we can alter the SERVER to connect to the PG18 server:
ALTER SERVER server OPTION (SET dbname 'postgres' port '5434');

If users run the ALTER SUBSCRITPION REFRESH SEQUENCES command, it could succeed
but the worker will raise the ERROR periodically.

```
ERROR: invalid query response
DETAIL: Expected 11 fields, got 10 fields.
LOG: background worker "logical replication sequencesync worker" (PID 2269290) exited with exit code 1
```

Above can be reported because pg_get_sequence_data() has been available since
PG18 but the returned datatype was different.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-07-21 11:54:57 Re: ci: namespace ccache by PostgreSQL major version
Previous Message Shlok Kyal 2026-07-21 11:28:14 Re: [PATCH] Preserve replication origin OIDs in pg_upgrade