Re: ALTER TABLE ADD COLUMN fast default - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ALTER TABLE ADD COLUMN fast default
Date
Msg-id 554951.1617639696@sss.pgh.pa.us
Whole thread Raw
In response to Re: ALTER TABLE ADD COLUMN fast default  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers
Zhihong Yu <zyu@yugabyte.com> writes:
>>     if (found != ncheck)

> Since there is check on found being smaller than ncheck inside the loop,
> the if condition can be written as:
>     if (found < ncheck)

Doesn't really seem like an improvement?  Nor am I excited about renaming
these "found" variables, considering that those names can be traced back
more than twenty years.

> +   if (found != ndef)
> +       elog(WARNING, "%d attrdef record(s) missing for rel %s",
> +            ndef - found, RelationGetRelationName(relation));

> Since only warning is logged, there seems to be some wasted space in
> attrdef. Would such space accumulate, resulting in some memory leak ?

No, it's just one palloc chunk either way.  I do not think there is
any value in adding more code to reclaim the unused array slots a
bit sooner.  (Because of aset.c's power-of-two allocation practices,
it's likely there would be zero actual space savings anyway.)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE ADD COLUMN fast default
Next
From: Justin Pryzby
Date:
Subject: Re: Have I found an interval arithmetic bug?