Re: BUG #18139: Causing FATAL error on database using function last() or first()

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pyrotarlu74(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18139: Causing FATAL error on database using function last() or first()
Date: 2023-09-28 19:36:18
Message-ID: CAKFQuwbmjHAhnh4O8zZonXRttgKLgyhB4-9v=pTYKgZscsBnLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Sep 28, 2023 at 11:33 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18139
> Logged by: Paul Gazagne
> Email address: pyrotarlu74(at)gmail(dot)com
> PostgreSQL version: 14.9
> Operating system: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
> Description:
>
> If I use the function last/first on this dataset,

This isn't a bug since these functions don't exist and all of your examples
error out on that account. You need to provide the definition of the
function you are using - and the bug likely belongs to whomever wrote the
function.

The seemingly equivalent COALESCE "function" does indeed produce the
expected type mismatch error for all those queries.

select
coalesce(value_t,value) as thatsok
from test t
where id between 2 and 4;

ERROR: COALESCE types text and numeric cannot be matched
LINE 2: coalesce(value_t,value) as thatsok

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2023-09-28 21:10:33 Re: Broken type checking for empty subqueries
Previous Message Tom Lane 2023-09-28 18:50:05 Re: BUG #18139: Causing FATAL error on database using function last() or first()