Re: Unused variable found in AttrDefaultFetch - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Unused variable found in AttrDefaultFetch
Date
Msg-id CALj2ACXNBkOWPbhMu4MF9kiBORNoRmo2YvzSURD50uSRXuwPug@mail.gmail.com
Whole thread Raw
In response to Unused variable found in AttrDefaultFetch  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: Unused variable found in AttrDefaultFetch  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Sun, Apr 4, 2021 at 8:14 AM Zhihong Yu <zyu@yugabyte.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@dunslane.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



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: TRUNCATE on foreign table
Next
From: Michael Paquier
Date:
Subject: Re: Unused variable found in AttrDefaultFetch