Remove redundant if-else in EXPLAIN by using ExplainPropertyText

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Remove redundant if-else in EXPLAIN by using ExplainPropertyText
Date: 2025-03-20 20:24:14
Message-ID: 88a71bcd-0b5c-4d0b-8107-757e96f402d5@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Thanks to David [0], we found that the if and else branches contained
equivalent code. Since ExplainPropertyText already handles non-text
formats, the extra condition is unnecessary.

I reviewed other files related to EXPLAIN where similar patterns might
exist, but this was the only instance I found.

I’m attaching a patch with the fix. If anyone spots a similar case
elsewhere, please let me know.

[0]:
https://www.postgresql.org/message-id/CAApHDvpq2gOt3gnzkd4Ud%3DwrT7YRGrF3zb29jgWzDsYEhETrOA%40mail.gmail.com

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

Attachment Content-Type Size
v1-0001-Remove-redundant-if-else-in-EXPLAIN.patch text/x-patch 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-03-20 20:27:13 Re: Not-terribly-safe checks for CRC intrinsic support
Previous Message Nathan Bossart 2025-03-20 20:23:13 Re: optimize file transfer in pg_upgrade