Re: How to properly use TRIM()? - Mailing list pgsql-general

From David G. Johnston
Subject Re: How to properly use TRIM()?
Date
Msg-id CAKFQuwakY0c3x=2o=gQ6Cr7jQ=DgE_snL1cHf8Oj+irO1fmjEQ@mail.gmail.com
Whole thread
In response to How to properly use TRIM()?  (Igor Korot <ikorot01@gmail.com>)
Responses Re: How to properly use TRIM()?
Re: How to properly use TRIM()?
help debugging an issue with selectivity
List pgsql-general
On Saturday, March 7, 2026, Igor Korot <ikorot01@gmail.com> 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 = c.relname AND c.oid = idx.indexrelid AND t.oid =
idx.indrelid AND n.oid = c.relnamespace AND idx.indisprimary AND
n.nspname = 'public' AND t.relname = '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 “how does one turn an empty array into the null value?”  Nullif 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.

pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: How to properly use TRIM()?
Next
From: Igor Korot
Date:
Subject: Re: How to properly use TRIM()?