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 1t72Mc-00HAze-27 for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Nov 2024 00:51:38 +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 1t72MY-001uaD-KF for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Nov 2024 00:51:34 +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 1t72MY-001ua4-7l for pgsql-hackers@lists.postgresql.org; Sat, 02 Nov 2024 00:51:34 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t72MV-0042rU-Mz for pgsql-hackers@lists.postgresql.org; Sat, 02 Nov 2024 00:51:33 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-539f72c8fc1so555842e87.1 for ; Fri, 01 Nov 2024 17:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730508690; x=1731113490; 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=AuXmBALdg9dJ/qj2dMD7iXHETwwJa5Mxh+fiICU7tI8=; b=SGiTmSZUdhRBkYkPGCkpcD2O6PN1WNMjfRCbKOj3PStuQuCq+cRpsHIYt86vpftn/i YVyMtlWPCBqpRS8dTmtbrBZcVP/5tq4UxAx3l+UH6YBT0LsUXua+AepwCpn9os9JXzHR i/XfRt8bewJxkzKvPew3KoJsX8sanxhWLNJjrX7SnO+PpDjvWcXsHgXJzt2QqGd1AiRF 3YtVGxYY6yYZvaszcaMIXhhcqUwrtMLkk9zMuUW7gTgjm0qe++4lxdTFwn/m9i/J+BmJ 1qvPz5x60k+b77FprMCgQ3lqhZ293cdQxT2C3K2PoB/GET7FA192onjvtMPRsl5V80gZ fG/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730508690; x=1731113490; 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=AuXmBALdg9dJ/qj2dMD7iXHETwwJa5Mxh+fiICU7tI8=; b=iKYQK6jEaQrJO7PpCfOz70EIgcAatVgiqB6XoVd1TKWxnkTv2wHaSHH9APSs+XxONl hZRenknInqLhbkGS86ArLHWk6WE2R7/3rxWn81YohUIHvbONnZmQ/wnX6tEfF+BDjOZU 0ngzkwMFuWvi24C1rb1kSIWbSp6Of0ARunIR1LwXGUF4K6IFxiBkmoieWlIdtlXydVzl uVaClcDX7GUuKgUQgtTbmREHjb6fRxwTJ6KdQRrOOYQN7qzVqJSUQlRaX+6eMX7uKOG6 fH8X23EnuxWFIpEarQnKgOVL4dcTPw/29qUIz1XJ9TjT5Yxg6UT/mVdZPrQd/Z9PUWWn s56g== X-Gm-Message-State: AOJu0YxvMPkiF54wdAp4jTofppK4Fowvov17ZOzaAvjH9l74ejV6tyt6 YAQpNsO2NH+jcPNsMcqJeMoAJvsobAYDSjYCVR0GikFrRh2VWHnyau+UbybwOu+VygFd2nxEi7C Oblu6GIYBP5gwAhG4jX9K8vv2S7qi/D/2 X-Google-Smtp-Source: AGHT+IH1kgElO2RJpcLZMxLhaPUq/DyNhgrWp8GHMuT5yIOuSIvgS1Odx2EAz4fN8bVBBsgTcRLIATixoYBE1iQjcSo= X-Received: by 2002:a05:6512:1306:b0:537:a745:3e with SMTP id 2adb3069b0e04-53b7ed1836cmr7677573e87.45.1730508689413; Fri, 01 Nov 2024 17:51:29 -0700 (PDT) MIME-Version: 1.0 References: <1342498.1729444411@sss.pgh.pa.us> <1445998.1729482404@sss.pgh.pa.us> <2062830.1729625620@sss.pgh.pa.us> <2259890.1729696885@sss.pgh.pa.us> <2351536.1729735831@sss.pgh.pa.us> <1947217.1730499609@sss.pgh.pa.us> In-Reply-To: <1947217.1730499609@sss.pgh.pa.us> From: Michel Pelletier Date: Fri, 1 Nov 2024 17:50:52 -0700 Message-ID: Subject: Re: Using Expanded Objects other than Arrays from plpgsql To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000b6a4040625e3734f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b6a4040625e3734f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Nov 1, 2024 at 3:20=E2=80=AFPM Tom Lane wrote: > Michel Pelletier writes: > > Well, you shouldn't be using PERFORM. Not only does it not do the > right thing, but it's not optimized for expanded objects at all: > they'll get flattened both on the way into the statement and on > the way out. Try it with > > graph :=3D set_element(graph, 1, 1, 1); > RETURN nvals(graph); > Ah my bad, you mentioned that already and I missed it, here's the two backtraces with the assignment: https://gist.githubusercontent.com/michelp/20b917686149d482be2359569845f232= /raw/ca8349ae4b0469674b4b2c77f34c5a02553583a9/gistfile1.txt > > regards, tom lane > --000000000000b6a4040625e3734f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Nov 1, 2024 at 3:20=E2=80=AFPM To= m Lane <tgl@sss.pgh.pa.us> w= rote:
Michel Pelletier <pelletier.michel@gmail.com> writes:
Well, you shouldn't be using PERFORM.=C2=A0 Not only does it not do the=
right thing, but it's not optimized for expanded objects at all:
they'll get flattened both on the way into the statement and on
the way out.=C2=A0 Try it with

=C2=A0 =C2=A0 =C2=A0graph :=3D set_element(graph, 1, 1, 1);
=C2=A0 =C2=A0 =C2=A0RETURN nvals(graph);

Ah my bad, you mentioned that already and I missed it, here's the two= backtraces with the assignment:

=C2=A0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--000000000000b6a4040625e3734f--