Re: TRIM_ARRAY

From: "Dian M Fay" <dian(dot)m(dot)fay(at)gmail(dot)com>
To: "Vik Fearing" <vik(at)postgresfriends(dot)org>, <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: "Vik Fearing" <vikreykja(at)gmail(dot)com>
Subject: Re: TRIM_ARRAY
Date: 2021-03-02 00:02:50
Message-ID: C9MFB04FWKBB.13JGHNUNS5Z4R@lamia
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon Mar 1, 2021 at 6:53 PM EST, Vik Fearing wrote:
> > This basically does what it says, and the code looks good. The
> > documentation is out of alphabetical order (trim_array should appear
> > under cardinality rather than over)) but good otherwise.
>
> Hmm. It appears between cardinality and unnest in the source code and
> also my compiled html. Can you say more about where you're seeing the
> wrong order?

I applied the patch to the latest commit, ffd3944ab9. Table 9.52 is
ordered:

array_to_string
array_upper
trim_array
cardinality
unnest

> The problem here is that postgres needs to know what the return
> type is and it can only determine that from the input.
>
> If you give the function a typed null, it returns null as expected.
>
> > The new status of this patch is: Waiting on Author
>
> I put it back to Needs Review without a new patch because I don't know
> what I would change.

I'd thought that checking v and returning null instead of raising the
error would be more friendly, should it be possible to pass an untyped
null accidentally instead of on purpose, and I couldn't rule that out.
I've got no objections other than the docs having been displaced.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-03-02 00:12:21 Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]
Previous Message Tom Lane 2021-03-01 23:53:41 Re: TRIM_ARRAY