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 1tfHWG-0013II-HF for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Feb 2025 11:55:09 +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 1tfHWF-0038Ij-DE for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Feb 2025 11:55:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfHWF-0038Ib-3j for pgsql-hackers@lists.postgresql.org; Tue, 04 Feb 2025 11:55:07 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfHWD-0037AK-0B for pgsql-hackers@lists.postgresql.org; Tue, 04 Feb 2025 11:55:06 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ab7430e27b2so239740266b.3 for ; Tue, 04 Feb 2025 03:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738670104; x=1739274904; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qgWM80sXqbZJCLb1qeIirRP48HB1wtel2Fe/VjStTwE=; b=FEa2AcTJL17niXtUOWJkZtYr5j9ymqXW04SyKGDVJrs++jDgABYXe5U7ywVPo05FIW VjXQ2W0CkvaIwxcloqrdQhyglPQZlVMAbmcSC3qk7CnirfJTbCye0jvIxUocA5P4NSk3 PoUgqhtiMt6JeRswoEwIgYR9x68AekR0zd/EpWfWrU+6hVPYrAjWsRsbyi6SQ6k48MGs pUwZGezLLIEjex8MNMktC8E27SrWag5opFALwZUbYKbMjDWDklb9aamYPX1n+ay6LYUQ usOGR7hGXZwwwCudF5exunzKzkwCWmOwjFE0d4gh87aeHDCK2kB6WYWe8m/0hFgPkD9d PwFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738670104; x=1739274904; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qgWM80sXqbZJCLb1qeIirRP48HB1wtel2Fe/VjStTwE=; b=bkU/p10PWLqs3JnV6dFWjhw/ugk+WIWT/Y9F//opgg5rwNL+D5qsreoWHLblGRIQeV euzYS0BjAKjmppkfgkEfvQmcUN+ZXkAlDtz4U3jx+446jEBOk7+ct3ap6qcSGxiMs44A gsVmP0A3VUTKsA5ltzYY4pN/nphdQnB8p2sTlS4BsyfYCIvfe5hpL1rxOBe/mNdupej8 uoTVj8et3J1k87hYSsMKPVOBeoz4VS64PzeOhSAd8JpjWzdhB/WSMwbOGPLRj0dIfMGa tWYnbUNVVLpGZPvrBlBRYqUYiX9+VDdbT3FjEMyTU6vvfns0eKAdVu1Sfe6wlx/l1yid YLzA== X-Forwarded-Encrypted: i=1; AJvYcCXPhjfx+Z8lGumLZ7r3QxQd7TB+TPznWLV4eWbm246mNeSTGURh1dg2Ot0hOyknr0BUp4MfSRUrf5fJEI1k@lists.postgresql.org X-Gm-Message-State: AOJu0YzyQYYLT3pWRtQlYacn37C44ANZ/sLpsdbUXjqsis1n77ukGIMI 8WjHOxDYXrMVcaogsmM5tRo3XcNUecWUyWNQ3M7uQ7b7eiqyc7Vf7GOlLZ1ReuL5eZ0TWBegdqK ESq7rvp7KJ+5O2e+6u+9HUP+FBi4= X-Gm-Gg: ASbGncsJgdMQRgKGgDagc7cyY7VP2SYyG/HWL6aKDDI854yrDN5vPDz0B6EoY2WcNtb 83S8v3o7Jn//ck5g3HIq3NKy2ILUlRqChrPBQRWRmK8jHuJb+ofVCFXenx9pVHLMoMsN97dOYKc 8= X-Google-Smtp-Source: AGHT+IGSB+kgrfoJrKyuEobABxEdaBMMpEbBzOaqU3UfhSCgzK0bWNGAL90MwuR7/gd3/T0iZs5lVw8h/IR60kRcl6A= X-Received: by 2002:a17:906:1853:b0:ab6:dd6b:c337 with SMTP id a640c23a62f3a-ab6dd6bc372mr2460957766b.10.1738670103679; Tue, 04 Feb 2025 03:55:03 -0800 (PST) MIME-Version: 1.0 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> <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> <413597.1738605186@sss.pgh.pa.us> In-Reply-To: <413597.1738605186@sss.pgh.pa.us> From: Pavel Borisov Date: Tue, 4 Feb 2025 15:54:52 +0400 X-Gm-Features: AWEUYZkBTcJC4sZbxt9jTcpjXph-D29daXN8gSRMjywLhFjdse-EClygG0RREdk Message-ID: Subject: Re: Using Expanded Objects other than Arrays from plpgsql To: Tom Lane Cc: Michel Pelletier , Andrey Borodin , Pavel Stehule , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Tom! On Mon, 3 Feb 2025 at 21:53, Tom Lane wrote: > > 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. Makes sense. > > 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. There are no problems with these. Regards, Pavel Borisov