Re: [PATCH] Logical decoding support for sequence advances - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: [PATCH] Logical decoding support for sequence advances
Date
Msg-id CAMsr+YHSxwZA-xHsgNLpA_DbTywVQYDX8CUjBZ9Sbr=d7XcJgQ@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Logical decoding support for sequence advances  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
On 14 December 2015 at 16:19, Craig Ringer <craig@2ndquadrant.com> wrote:
 
Attached a slightly updated version. It just has less spam in the regression tests, by adding a new option to test_decoding to show sequences, which it doesn't enable except in sequence specific tests.

Whoops, the patch as written is wrong. I used Form_pg_sequence's sequence_name field to get the sequence name. This seems to be a vestigial field with no useful purpose except taking up space; in particular, it's not updated when ALTER SEQUENCE ... RENAME TO is used to rename a sequence. The sequence's pg_class entry is updated but the sequence_name in the sequence page is not.

Since the sequence_name is written to WAL with each sequence recovery position advance, isn't used anywhere, and can be wrong, shouldn't it just be removed from Form_pg_sequence entirely? Or at least replaced with the sequence's pg_class entry oid?

I could always fix ALTER SEQUENCE to update sequence_name, but it seems pretty pointless to have it at all.

In any case I'll need to update this patch. Which will be fun, since the sequence oid doesn't seem to be written to the xlog record, just the HeapTuple header and Form_pg_sequence, and the redo is handled by doing a page replacement. I'd like to update Form_pg_sequence to store oid not sequence_name at the same time but that makes all this a dramatically more intrusive change that's rather less likely to be accepted.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Using quicksort for every external sort run
Next
From: Peter Geoghegan
Date:
Subject: Re: Re: Reusing abbreviated keys during second pass of ordered [set] aggregates