On Thu, Jul 25, 2024 at 12:08 PM shveta malik <shveta.malik@gmail.com> wrote:
>
> On Thu, Jul 25, 2024 at 9:06 AM vignesh C <vignesh21@gmail.com> wrote:
> >
> > The attached v20240725 version patch has the changes for the same.
>
> Thank You for addressing the comments. Please review below issues:
>
> 1) Sub ahead of pub due to wrong initial sync of last_value for
> non-incremented sequences. Steps at [1]
> 2) Sequence's min value is not honored on sub during replication. Steps at [2]
One more issue:
3) Sequence datatype's range is not honored on sub during
replication, while it is honored for tables.
Behaviour for tables:
---------------------
Pub: create table tab1( i integer);
Sub: create table tab1( i smallint);
Pub: insert into tab1 values(generate_series(1, 32768));
Error on sub:
2024-07-25 10:38:06.446 IST [178680] ERROR: value "32768" is out of
range for type smallint
---------------------
Behaviour for sequences:
---------------------
Pub:
CREATE SEQUENCE myseq_i as integer INCREMENT 10000 START 1;
Sub:
CREATE SEQUENCE myseq_i as smallint INCREMENT 10000 START 1;
Pub:
SELECT nextval('myseq_i');
SELECT nextval('myseq_i');
SELECT nextval('myseq_i');
SELECT nextval('myseq_i');
SELECT nextval('myseq_i'); -->brings value to 40001
Sub:
ALTER SUBSCRIPTION sub1 REFRESH PUBLICATION SEQUENCES;
SELECT * from pg_sequences; -->last_val reached till 40001, while the
range is till 32767.
thanks
Shveta