Hi,
On 2018-07-10 09:54:28 +0900, Michael Paquier wrote:
> > > Also, ERRCODE_FEATURE_NOT_SUPPORTED doesn't quite seem right. How about
> > > ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE?
> >
> > +1 to both of Andres' suggestions.
>
> Those indeed sound better. What do you think of the attached?
Looks generally good. One remark:
> + /* A slot whose restart_lsn has never been reserved cannot be advanced */
> + if (XLogRecPtrIsInvalid(MyReplicationSlot->data.restart_lsn))
> + {
> + ReplicationSlotRelease();
> + ereport(ERROR,
> + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("cannot advance replication slot that has not previously reserved WAL")));
> + }
Why is the ReplicationSlotRelease() needed here? Souldn't the error
handling code do so automatically?
Greetings,
Andres Freund