Re: Remove unused for_all_tables field from AlterPublicationStmt

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove unused for_all_tables field from AlterPublicationStmt
Date: 2025-09-26 15:02:05
Message-ID: 202509261459.qrj5czst6xl5@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Sep-26, Chao Li wrote:

> I agree to remove the field from AlterPublicationStmt, but I think we
> should retain "Assert(!stmt)”. Because Assert() is a way to detect
> programming bug. During development and debug builds, it prints a
> diagnostic message which is helpful for identifying bugs. Without the
> Assert(!stmt), it will just silently discard the bug by “if (stmt)” in
> case that stmt happens to be NULL.

CreatePublication() calls this with an empty stmt, so if you keep the
assertion, the program would crash (unless that callsite is dead code,
in which case it should probably be modified as well). In any case,
such a simple assertion is not very useful: the program would crash
anyway as soon as we tried to dereference stmt, which is exactly the
same the assertion would do.

I'm going to bet that Masahiko has the code right.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Thou shalt check the array bounds of all strings (indeed, all arrays), for
surely where thou typest "foo" someone someday shall type
"supercalifragilisticexpialidocious" (5th Commandment for C programmers)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-09-26 15:08:10 Re: Avoiding roundoff error in pg_sleep()
Previous Message Tom Lane 2025-09-26 15:00:13 Re: Mark function arguments of type "Datum *" as "const Datum *" where possible