Re: [Patch] add new parameter to pg_replication_origin_session_setup

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Doruk Yilmaz <doruk(at)mixrank(dot)com>
Subject: Re: [Patch] add new parameter to pg_replication_origin_session_setup
Date: 2026-02-11 05:23:02
Message-ID: CAA4eK1KV2orcjQmdNmBO4EQQ7GXxEJ2kRy_d+1mOH-CEqtTYbg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 4, 2026 at 12:38 AM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> The new error message is not great:
>
> postgres=# select pg_replication_origin_session_setup('myorigin', 12345678);
> ERROR: could not find replication state slot for replication origin
> with OID 1 which was acquired by 12345678
>
> Firstly, replication origin is not an OID. Secondly, it's a little
> confusing because the "replication state slot" is in fact present.
> However, it's currently inactive, i.e. not "acquired" by the given PID.
>
> I propose to change that to:
>
> postgres=# select pg_replication_origin_session_setup('myorigin', 12345678);
> ERROR: replication origin with ID 1 is not active for PID 12345678
>
> That's more in line with this neighboring message:
>
> ERROR: replication origin with ID 1 is already active for PID 701228
>

+1 for the new message.

>
> I also wonder if the error code is appropriate. That error uses
> ERRCODE_OBJECT_IN_USE, but if the problem is that the origin is
> currently *not* active, that seems backwards. I didn't change that in
> the attached patch, but it's something to think about.
>

The other way to look at this is that the origin is already active for
some other pid which is not the same as what is given by the user in
the second parameter, so OBJECT_IN_USE sounds okay from that angle.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2026-02-11 06:02:50 Re: Skipping schema changes in publication
Previous Message Chao Li 2026-02-11 05:21:56 Re: log_min_messages per backend type