]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: don't throw errors on COPY_BOTH results 1219/head
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 24 Nov 2025 14:27:51 +0000 (15:27 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 24 Nov 2025 18:34:30 +0000 (19:34 +0100)
commit7d1175efc28420c92ad02288f5210db10cc6b3ca
tree46ff79cedf02caff88515d33614520633d72c649
parent1c764973abfe466437d5c3d5c7a8a83e59dd105a
fix: don't throw errors on COPY_BOTH results

This change only allows to execute a `START_REPLICATION` command on a
suitable configured database, i.e. the following commands would work:

    conn = psycopg.connect(DSN, replication="database", autocommit=True)
    conn.execute(
        """
        START_REPLICATION SLOT "my_replication_slot"
        LOGICAL 0/0 (proto_version '1',publication_names 'my_publication')
        """)
    <psycopg.Cursor [COPY_BOTH] [ACTIVE] at 0x...>

instead of gettgin an error such as  "COPY cannot be used with this method".

Please check https://github.com/psycopg/psycopg/issues/71#issuecomment-3393722855
for the description of the db configuration required to make this command work.

No further support for logical replication is planned at this moment, but this
change allows to play with replication without needing to go down at libpq
level to execute replication commands.
psycopg/psycopg/_cursor_base.py