Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tf0dE-00GvE1-SX for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2025 17:53:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tf0dD-00FcaL-Tg for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2025 17:53:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tf0dD-00FcaD-Kv for pgsql-hackers@lists.postgresql.org; Mon, 03 Feb 2025 17:53:11 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tf0dA-0034kL-37 for pgsql-hackers@lists.postgresql.org; Mon, 03 Feb 2025 17:53:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 513Hr6uu413598; Mon, 3 Feb 2025 12:53:06 -0500 From: Tom Lane To: Pavel Borisov cc: Michel Pelletier , Andrey Borodin , Pavel Stehule , pgsql-hackers@lists.postgresql.org Subject: Re: Using Expanded Objects other than Arrays from plpgsql In-reply-to: References: <1342498.1729444411@sss.pgh.pa.us> <1445998.1729482404@sss.pgh.pa.us> <2062830.1729625620@sss.pgh.pa.us> <2265411.1729699470@sss.pgh.pa.us> <2354718.1729737539@sss.pgh.pa.us> <2581216.1729794746@sss.pgh.pa.us> <1948345.1730500073@sss.pgh.pa.us> <3797606.1732045516@sss.pgh.pa.us> <141738! 9.1736964543@sss.pgh.pa.us> <3363452.1737483125@sss.pgh.pa.us> <0AC229FA-A3F1-43FD-B0DC-A46A73FEAFF7@yandex-team.ru> <931398.1737905825@sss.pgh.pa.us> <38A31221-C1C4-4846-9709-D66ACD76E87A@yandex-team.ru> <46876.1737918281@sss.pgh.pa.us> <3682021.1738288421@sss.pgh.pa.us> <256915.1738533419@sss.pgh.pa.us> Comments: In-reply-to Pavel Borisov message dated "Mon, 03 Feb 2025 15:42:04 +0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <413596.1738605186.1@sss.pgh.pa.us> Date: Mon, 03 Feb 2025 12:53:06 -0500 Message-ID: <413597.1738605186@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Borisov writes: > Minor notes on the patches: > If dump_* functions could use the newly added walker, the code would > look better. I suppose the main complication is that dump_* functions > contain a lot of per-statement prints/formatting. So maybe a way to > implement this is to put these statements into the existing tree > walker i.e. plpgsql_statement_tree_walker_impl() and add an argument > bool dump_debug into it. So in effect called with dump_debug=false > plpgsql_statement_tree_walker_impl() would walk silent, and with > dump_debug=false it would walk and print what is supposed to be > printed currently in dump_* functions. Maybe there are other problems > besides this? I'm not thrilled with that idea, mainly because it would add overhead to the performance-relevant cases (mark and free) to benefit a rarely used debugging feature. I'm content to leave the debug code out of this for now --- it seems to me that it's serving a different master and doesn't have to be unified with the other routines. > For exec_check_rw_parameter(): > I think renaming expr->expr_simple_expr to sexpr saves few bytes but > doesn't makes anything simpler, so if possible I'd prefer using just > expr->expr_simple_expr with necessary casts. Furtermore in this > function mostly we use cast results fexpr, opexpr and sbsref of > expr->expr_simple_expr that already has separate names. Hmm, I thought it looked cleaner like this, but I agree beauty is in the eye of the beholder. Anybody else have a preference? > Transferring target param as int paramid looks completely ok. But we > have unconditional checking Assert(paramid == expr->target_param + 1), > so it looks as a redundant split as of now. Do we plan a true split > and removal of this assert in the future? We've already fetched the target variable using the paramid (cf plpgsql_param_eval_var_check), so I think checking that the expression does match it seems like a useful sanity check. Agreed, it shouldn't ever not match, but that's why that's just an Assert. > Thanks for creating and working on this patch! Thanks for reviewing it! regards, tom lane