public inbox for [email protected]  
help / color / mirror / Atom feed
From: Yugo Nagata <[email protected]>
To: SATYANARAYANA NARLAPURAM <[email protected]>
Cc: Dean Rasheed <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Infinite Autovacuum loop caused by failing virtual generated column expression
Date: Tue, 12 May 2026 19:30:11 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHg+QDdFeuYKuX3=_-5-VvyaCkS9zgzOEjeC77dw7Wtrx_TqAA@mail.gmail.com>
References: <CAHg+QDcdkGQ4Q683Uq7ZJ0P6NcbB=F3Sh8thMSiFY9wwnSEoQQ@mail.gmail.com>
	<CAEZATCXWgYexeVm8yS6G8oFyyF=8ef9QwDt4Eyia-5hxBhjoVw@mail.gmail.com>
	<[email protected]>
	<CAHg+QDfu46gK5mqtG9fA5YnT+rc70nidPYs_TFsZk-z2bdTysQ@mail.gmail.com>
	<[email protected]>
	<CAHg+QDdFeuYKuX3=_-5-VvyaCkS9zgzOEjeC77dw7Wtrx_TqAA@mail.gmail.com>

On Sun, 3 May 2026 11:04:59 -0700
SATYANARAYANA NARLAPURAM <[email protected]> wrote:

Thank you for updating the patch!

There are a few comments on v2 patch.

In compute_expr_stats(),

+		PG_CATCH();
+		{
+			ExecDropSingleTupleTableSlot(slot);
+			FreeExecutorState(estate);
+			PG_RE_THROW();
 		}

Should we switch the context to expr_context before releasing
slot and estate? Also, should we call MemoryContextDelete(expr_context)
to release palloc'ed memory in the loop?
(In fact, the error would not be cached in compute_expr_stats(), though,
 since it would be cached in make_build_data() if any.)

Should we switch to expr_context before releasing slot and estate? 
Also, should we call MemoryContextDelete(expr_context) to release
memory allocated by palloc() in the loop?

(In practice, errors would not catched in compute_expr_stats() itself,
 since they would already be caught in make_build_data() if any.)

+       /*
+        * Wrap expression evaluation and stats computation in PG_TRY so
+        * that errors from evaluating expressions (e.g. division by zero
+        * in virtual generated columns) don't cause ANALYZE to fail
+        * entirely.  Skip the statistics object and issue a WARNING
+        * instead.

How about rewriting the comments to reflect the more general case?

Extended statistics involving virtual generated columns are a somewhat
special case, while errors in expression statistics seem more common
in practice. The same applies to the commit message as well.


Regards,
Yugo Nagata

-- 
Yugo Nagata <[email protected]>






view thread (7+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Infinite Autovacuum loop caused by failing virtual generated column expression
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox