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 1tMWeZ-004mBb-PI for pgsql-general@arkaria.postgresql.org; Sat, 14 Dec 2024 18:14:11 +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 1tMWeX-005XIW-7C for pgsql-general@arkaria.postgresql.org; Sat, 14 Dec 2024 18:14:10 +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 1tMWeW-005XIO-Sd for pgsql-general@lists.postgresql.org; Sat, 14 Dec 2024 18:14:10 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tMWeV-002pOr-Gx for pgsql-general@lists.postgresql.org; Sat, 14 Dec 2024 18:14:08 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5f31f8f4062so1081036eaf.3 for ; Sat, 14 Dec 2024 10:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734200046; x=1734804846; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=KDco4qpZE/BTaK+fZ2Xh6BsIrLqNIFhrpyOF5k3Fqs0=; b=UNdRszmGaaxPyK8eJSAkYCsnQaUiO1Ira/BNsaj++MLyoxq5SiMZxRwsVceogC/X4A XIEK3Ae7rRhRH6SENpbnIyL1SgLyXJ934dQAI0eCTxJElm7Jdx7Xwx8TgdO3uSLIl5Er ojF27PLUjZJITWX52HFqALNoMFrX70D7GAjNdTXr3R3hPGgokTl2B7SWdaX+BMm747oz B+NpNAqKSXK72pbEYsjC7H+Q4YamGnvz5cMnJkAXakOblE0YHwiYam5YfYswDTUgqrw4 9Jyfhe2m7hcQimWtlH9Jhkn3WfF4ePzjrzkCdauhwN6x4og3ndNWOBkolb0e7lAowxT3 qnhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734200046; x=1734804846; h=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=KDco4qpZE/BTaK+fZ2Xh6BsIrLqNIFhrpyOF5k3Fqs0=; b=RUoA8xYMLSj01CQ9KXtQDaUfZHhYv6xzo9+r5u26EvAQAmvuhXpPWjbXcRqKL6ei+v JBm0FczWNFcURA2k/giq0q/Ud9ppWzgL9C3rQJxWD2kJZ6Wb6jaYFGwIQ9j2HuS3pu1U iYL+sg3W0niMr0Xl9DCT3JeJ7yUByfWa2XkEgNsiExAOip92+9WlhH9VhAZkoBzZ/foW JC6q7P7NtbHrJuulQu6OSOF8NyKxiiZ/mx6GvNP6BsrWxDG3xQhSmRWsCi0IzMrw/0Kt M3RaGbuJfXW02dVQN05Xmfwi7SZzXkTGn/HkxF8jNqC6E2sM/IAUr+cTNZwud08S6l45 6Flw== X-Gm-Message-State: AOJu0Yydpu8RAsdUXKhQswBJ7xVygyr+Qy5aZxdyE4n2a/rBE5vSIJJH 9Bsajr9Lz4jXD2CFuwLUIcYTql0FRsDPPIVFGvOLnsGVDvygkrMi4Hkd6FcBBIaYIPzFvCu5FMR olkhQbhbQRA3mqFds7K3wgPL0rzsv/96Q X-Gm-Gg: ASbGncvChVuDJeI7zok8zpMwcsW/tqgEISvX1Qv72lvRkWNL3u+jb+Z5YkIFEbZITac bV351cjB/+ERmtsLIPIVoTuNgM9+4PqImp1uU1hc= X-Google-Smtp-Source: AGHT+IGEQW1hodrj9OqtqRSPP27jdM33rlhf0gZDRQPdS+DsyKbL0rI06VeGnMhJ+n4Wn+e6g29culwkB/DR6R+ef0o= X-Received: by 2002:a05:6870:3c08:b0:284:ff51:58ad with SMTP id 586e51a60fabf-2a3ac8b7939mr4284015fac.27.1734200046414; Sat, 14 Dec 2024 10:14:06 -0800 (PST) MIME-Version: 1.0 References: <20241214142827.fa730433d412246d424436e3@magnetkern.de> <1387150.1734195709@sss.pgh.pa.us> In-Reply-To: <1387150.1734195709@sss.pgh.pa.us> From: Ron Johnson Date: Sat, 14 Dec 2024 13:13:55 -0500 Message-ID: Subject: Re: Allowed to return possibly TOASTed datums? To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000bc714006293ee9b3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000bc714006293ee9b3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 14, 2024 at 12:02=E2=80=AFPM Tom Lane wrote= : > Jan Behrens writes: > > Is it allowed to use the following function, assuming the data type is > > TOASTable? > > > PG_FUNCTION_INFO_V1(mytype_pos); > > Datum mytype_pos(PG_FUNCTION_ARGS) { > > PG_RETURN_DATUM(GETARG_DATUM(0)); > > } > > Absolutely. You can find things equivalent to that in the > core code, I think. > (I'm not a developer, so this is a curiosity question, not a challenge.) Since the purpose of TOAST is just (I think) to store "large field values" on disk by dividing into multiple chunks, what would be the purpose of returning the TOASTed value to Jan's function? -- Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000bc714006293ee9b3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Dec 14, 2024 at 12:02=E2=80=AFPM = Tom Lane <tgl@sss.pgh.pa.us>= wrote:
Jan Behrens <jbe-mlist@magnetkern.de> writ= es:
> Is it allowed to use the following function, assuming the data type is=
> TOASTable?

> PG_FUNCTION_INFO_V1(mytype_pos);
> Datum mytype_pos(PG_FUNCTION_ARGS) {=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 =C2=A0 =C2=A0
>=C2=A0 =C2=A0PG_RETURN_DATUM(GETARG_DATUM(0));
> }

Absolutely.=C2=A0 You can find things equivalent to that in the
core code, I think.

(I'm not a developer, so this is a curiosity question, not = a challenge.)

Since the purpose o= f TOAST is just (I think) to store "large field values" on disk b= y dividing into multiple chunks, what would be the purpose of returning the= TOASTed value to Jan's function?

--
Death to <Redact= ed>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
--000000000000bc714006293ee9b3--