Some codes refer slot()->{'slot_name'} but it is not defined

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Some codes refer slot()->{'slot_name'} but it is not defined
Date: 2025-04-03 03:15:06
Message-ID: OSCPR01MB149667EC4E738769CA80B7EA5F5AE2@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear hackers,

Cluster.pm defines a function slot()which requires a slot_name as a key
and returns attributes of the given slot, as a hash-ref. ISTM, the hash
does not contain 'slot_name'.

However, I found that some codes access it by using a key 'slot_name'. ISTM it always
becomes 'undef' thus any tests are meaningless.

It looks like that existing codes want to check the existing of given logical slots.
So, it is enough to search with key 'plugin'. The valid value is set if exists, otherwise ''.

How do you think?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
0001-Fix-invalid-referring-of-hash-ref-for-replication-sl.patch application/octet-stream 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2025-04-03 03:28:09 Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning
Previous Message Amit Kapila 2025-04-03 02:57:56 Re: Fix slot synchronization with two_phase decoding enabled