Re: Unused variable found in AttrDefaultFetch

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unused variable found in AttrDefaultFetch
Date: 2021-04-04 04:43:26
Message-ID: CALj2ACXNBkOWPbhMu4MF9kiBORNoRmo2YvzSURD50uSRXuwPug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 4, 2021 at 8:14 AM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
>
> Hi,
> I was looking at AttrDefaultFetch and saw that the variable found is never read.
>
> I think it can be removed. See attached patch.

+1 to remove it and the patch LGTM. For reference, below is the commit
that removed last usage of "found" variable:

commit 16828d5c0273b4fe5f10f42588005f16b415b2d8
Author: Andrew Dunstan <andrew(at)dunslane(dot)net>
Date: Wed Mar 28 10:43:52 2018 +1030

Fast ALTER TABLE ADD COLUMN with a non-NULL default

Currently adding a column to a table with a non-NULL default results in
a rewrite of the table. For large tables this can be both expensive and
disruptive. This patch removes the need for the rewrite as long as the

@@ -4063,10 +4125,6 @@ AttrDefaultFetch(Relation relation)

systable_endscan(adscan);
heap_close(adrel, AccessShareLock);
-
- if (found != ndef)
- elog(WARNING, "%d attrdef record(s) missing for rel %s",
- ndef - found, RelationGetRelationName(relation));
}

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-04-04 04:53:59 Re: Unused variable found in AttrDefaultFetch
Previous Message Bharath Rupireddy 2021-04-04 04:07:46 Re: TRUNCATE on foreign table