Re: Bug in MERGE's test for tables with rules

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug in MERGE's test for tables with rules
Date: 2022-11-23 15:32:47
Message-ID: 3708173.1669217567@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> While playing around with rules and MERGE, I noticed that there is a
> bug in the way that it detects whether the target table has rules ---
> it uses rd_rel->relhasrules, which can be incorrect, since it might be
> set for a table that doesn't currently have rules, but did in the
> recent past.

> So it actually needs to examine rd_rules. Technically, I think that it
> would be sufficient to just test whether rd_rules is non-NULL, but I
> think it's more robust and readable to check rd_rules->numLocks, as in
> the attached patch.

+1 for the code change. Not quite sure the added test case is worth
the cycles.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-11-23 15:59:15 Re: [PATCH] minor optimization for ineq_histogram_selectivity()
Previous Message Tom Lane 2022-11-23 15:30:45 Re: Another multi-row VALUES bug