On Sat, Mar 23, 2024 at 1:12 PM Bharath Rupireddy <bharath.rupireddyforpostg...@gmail.com> wrote: > > On Sat, Mar 23, 2024 at 11:27 AM Amit Kapila <amit.kapil...@gmail.com> wrote: > > > > > 2. > > +# Get last_inactive_time value after slot's creation. Note that the > > slot is still > > +# inactive unless it's used by the standby below. > > +my $last_inactive_time_1 = $primary->safe_psql('postgres', > > + qq(SELECT last_inactive_time FROM pg_replication_slots WHERE > > slot_name = '$sb_slot' AND last_inactive_time IS NOT NULL;) > > +); > > > > We should check $last_inactive_time_1 to be a valid value and add a > > similar check for logical slots. > > That's taken care by the type cast we do, right? Isn't that enough? > > is( $primary->safe_psql( > 'postgres', > qq[SELECT last_inactive_time > > '$last_inactive_time'::timestamptz FROM pg_replication_slots WHERE > slot_name = '$sb_slot' AND last_inactive_time IS NOT NULL;] > ), > 't', > 'last inactive time for an inactive physical slot is updated correctly'); > > For instance, setting last_inactive_time_1 to an invalid value fails > with the following error: > > error running SQL: 'psql:<stdin>:1: ERROR: invalid input syntax for > type timestamp with time zone: "foo" > LINE 1: SELECT last_inactive_time > 'foo'::timestamptz FROM pg_repli... >
It would be found at a later point. It would be probably better to verify immediately after the test that fetches the last_inactive_time value. -- With Regards, Amit Kapila.