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.96) (envelope-from ) id 1vymIK-000PiQ-2H for pgsql-general@arkaria.postgresql.org; Sat, 07 Mar 2026 07:41:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vymIH-0087Sw-2q for pgsql-general@arkaria.postgresql.org; Sat, 07 Mar 2026 07:41:50 +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.96) (envelope-from ) id 1vymIH-0087Sn-1n for pgsql-general@lists.postgresql.org; Sat, 07 Mar 2026 07:41:50 +0000 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vymIF-00000001JcG-1hys for pgsql-general@lists.postgresql.org; Sat, 07 Mar 2026 07:41:49 +0000 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-7d4cb7e10efso11151442a34.0 for ; Fri, 06 Mar 2026 23:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772869305; cv=none; d=google.com; s=arc-20240605; b=ZQAoqqWOQZ8PC4gqSBILCdP15JaeH974nN/8MtFcu3rPu/Vrkls3kuRs72QYAJmu0W 0+1XFdtlfXxNeojrD2T4uafWcSu/sqmslJJa0gsOwkZlhW6TIMGNC3uVHKlINpDFFe6l ONT3dzCwXBdtu/UxrT8pYKffYW4gfxAjju2kqbX550O4addwgpabJEtInWKwonEUNSrE mLifIcnFSQsUF8JTR/H78e/i3qkogjXhpVegBeJBW17qOfXFp1RJlpJl7scC58nXCuR0 Ca+PPLCJCO9k4jJJ7gztA3qXMdG1i1hyJkXfKX/SB0Lc2Pg37lRRjXq7XBchzc4wAuQR DpjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature; bh=6WrqU9ylYSWnhxYCbJdRFs27Y9PJ1kHhi/nYNqaONzU=; fh=MqX3/PjeIRWyveucHIwmT3MEzIvphFWgoM5FEnVDTkI=; b=P03HHrkFx4X0UvIbVU5bSlZnUQjMd7ARUzGjZSt+JtXBYlFkh+oYBWAGFiq2URJjW3 8V8SV9O/74P6HcRN/CwGW0fa0/2s5mkJXYhiO1jxUqunW1JTPro/FH6L2wbKXEZeZsQ+ qiwiEwJ1F5Ykm6UYhjlpNNkH77P02Ia947su0MwacYeKcvHb1wkO671rVbRkCcWGCMX/ eHedi7MlZj+hDKN3GJKkbWM9B2YLt21rSaXcFSoiRGtmxpnq7nC+Fzu2TfE5KgT971Uo r4B5zFJHr95xWDOtvUcvxdyOtebFVYYVD7NdtowG4R6KMT2Xhevpl+cQgMs9foReXMv/ Z3KA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772869305; x=1773474105; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6WrqU9ylYSWnhxYCbJdRFs27Y9PJ1kHhi/nYNqaONzU=; b=MuRdyh/808MwbEnbozxmv+8WlessIuLREenP2jk01yFdNtY3zM11Wz9mTXzq856ZeD GnHyaMGrz5z8XMdJwCNWCUDAXopoKDXvBVGt4WvX5dzHbMqRTNLxtCawQGC4Kts1+/u+ ggP7HFzhQnyz70OGWuurSSeaxSEZlyxvMKWvBu24bt8ZIPluVK35tPhQ+Naboq8kNTrl NfTZwbhcFPXFwdOdz7jhQmAeVyNulH1SCGXsUZkPYinTkeYyRC0VcWiMK9rWxh5SjwCf aDkEhPd3BXIxwzCp5jP+IiSQzc4pfMlZxr9N7AZB67hoZ/2/q84ovk7t2Z4j+IIWBjH+ j6JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772869305; x=1773474105; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6WrqU9ylYSWnhxYCbJdRFs27Y9PJ1kHhi/nYNqaONzU=; b=Lg9QdwgNe7vS0wRvgceQoVzP7vZZK8kW8e4Fm69tCLZj6bAuKpwEJbxTb6DEdM843E 0M7CjMD+HK5P1cd+nx8Tfrx3v3CTY5ufOMBBDuGloPlASzXZgTOw9kXJv/yrVjw/Wym/ P/+QamkNbAPP0Los13sEHR6AlVH9SGhd5EosA/eZC2TG4zXHsVVImNfYXPiilgZTSlX/ jAb3e/8UQhYlWhFv/uMvTemmh+Y7mKSGUJZuWmusCgiw+HGqe7f8x5n/0Zz5DZUxGQCS sEwFG4Q62VVQ9LGkVg2tGjys9H6mPv3fdya/3u9F7W1Z44lpPx3eyfFNAdVVjKHZxfMY kS3w== X-Gm-Message-State: AOJu0YwmHF8NXMfTNqRBYHSpTuvMgqnL60tpXuivX5Vliuk0wd5hYPBs jTH3T0R28OKhv/O+w8yHv9XPQ6bJJ43LsUseTk0riF0Ut309N/26gpRwZR79sqDC1zgLxSfSlSs arkrBmgZPTKSf04SluvngSCtlEhK2Fwk= X-Gm-Gg: ATEYQzwx9o9RuuOzJmplzQeYVjJyQb10IZki98ORSXF+bLtId2AcK5R/Rm7iMMojYY7 iidYY6H28G3rWccJbao1knjy7/Y99+dPeQSMoeFzDP3qM9XtfWBcNlQqpS1kVIHTX+gKvrow1FL ElofHDl+3VcRjXHw0d3xpYL1aQwViDVhiPYizC0xYuKewNGvfoRHSvkH5eMThbeS4k+d64GYnA6 8IvmXSfT0/8cGt/fVrb8VFv3sHqqVsoBbkF5qip4cFgvr9tNbxKt4cWgGyiljnQmClJPDSvfTmh y150Qws= X-Received: by 2002:a05:6820:2109:b0:662:fa38:ed4f with SMTP id 006d021491bc7-67b9bc87672mr3181037eaf.23.1772869305260; Fri, 06 Mar 2026 23:41:45 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a8a:1e52:0:b0:623:70c2:23fe with HTTP; Fri, 6 Mar 2026 23:41:43 -0800 (PST) In-Reply-To: References: From: "David G. Johnston" Date: Sat, 7 Mar 2026 00:41:43 -0700 X-Gm-Features: AaiRm519mMjQlrAMHp44Bel-F8QVwUb4wrzx3qaHoaEpbQ7XITdokXHqMxHNwI8 Message-ID: Subject: Re: How to properly use TRIM()? To: Igor Korot Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000002c5d7b064c6a4d54" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002c5d7b064c6a4d54 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Saturday, March 7, 2026, Igor Korot wrote: > > included, NULLIF( TRIM( c.reloptions ), '' ) AS storage FROM pg_index > idx, pg_class c, pg_namespace n, pg_class t, pg_indexes ixs WHERE > ixs.indexname =3D c.relname AND c.oid =3D idx.indexrelid AND t.oid =3D > idx.indrelid AND n.oid =3D c.relnamespace AND idx.indisprimary AND > n.nspname =3D 'public' AND t.relname =3D 'leagues'; > ERROR: function pg_catalog.btrim(text[]) does not exist > LINE 1: ...num) OFFSET idx.indnkeyatts) AS included, NULLIF( TRIM( c.re..= . > You are asking the wrong question. The right question is =E2=80=9Chow does= one turn an empty array into the null value?=E2=80=9D Nullif is correct, you j= ust need to specify an empty array (of the correct type) for the second argument. Given that error message, an array of text is the correct type. Array[]::text[] David J. --0000000000002c5d7b064c6a4d54 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Saturday, March 7, 2026, Igor Korot <ikorot01@gmail.com> wrote:
<= br> included, NULLIF( TRIM( c.reloptions ), '' ) AS storage FROM pg_ind= ex
idx, pg_class c, pg_namespace n, pg_class t, pg_indexes ixs WHERE
ixs.indexname =3D c.relname AND c.oid =3D idx.indexrelid AND t.oid =3D
idx.indrelid AND n.oid =3D c.relnamespace AND idx.indisprimary AND
n.nspname =3D 'public' AND t.relname =3D 'leagues';
ERROR:=C2=A0 function pg_catalog.btrim(text[]) does not exist
LINE 1: ...num) OFFSET idx.indnkeyatts) AS included, NULLIF( TRIM( c.re...<= br>=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=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

You are asking the wrong question.= =C2=A0 The right question is =E2=80=9Chow does one turn an empty array into= the null value?=E2=80=9D =C2=A0Nullif is correct, you just need to specify= an empty array (of the correct type) for the second argument.
Given that error message, an array of text is the correct type= .

Array[]::text[]

David J= .

--0000000000002c5d7b064c6a4d54--