pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18139: Causing FATAL error on database using function last() or first()
3+ messages / 3 participants
[nested] [flat]
* BUG #18139: Causing FATAL error on database using function last() or first()
@ 2023-09-28 17:02 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 2 replies; 3+ messages in thread
From: PG Bug reporting form @ 2023-09-28 17:02 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: pyrotarlu74@gmail.com
The following bug has been logged on the website:
Bug reference: 18139
Logged by: Paul Gazagne
Email address: pyrotarlu74@gmail.com
PostgreSQL version: 14.9
Operating system: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
Description:
How to reproduce the error :
Setup table and dataset :
CREATE TABLE test (
id int4 not null,
value numeric(20, 6) NULL,
value_t text NULL
);
INSERT INTO test (id)
VALUES (1);
INSERT INTO test (id,value,value_t)
VALUES (2,2,'it is 2');
INSERT INTO test (id)
VALUES (3);
INSERT INTO test (id,value,value_t)
VALUES (4,4,'it is 4');
INSERT INTO test (id)
VALUES (5);
If I use the function last/first on this dataset, if the first rows parsed
by the function contain null values, it cause FATAL error on database.
Examples :
These queries work fine :
select
last(value_t,value) as thatsok
from test t
where id between 2 and 4;
select
last(value_t,value) as thatsok
from test t
where id between 2 and 5;
select
first(value_t,value) as thatsok
from test t
where id between 2 and 4;
select
first(value_t,value) as thatsok
from test t
where id between 2 and 5;
These ones cause FATAL error :
select
last(value_t,value) as fatal_error
from test t
where id between 1 and 5;
select
first(value_t,value) as fatal_error
from test t
where id between 1 and 5;
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #18139: Causing FATAL error on database using function last() or first()
@ 2023-09-28 18:50 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2023-09-28 18:50 UTC (permalink / raw)
To: pyrotarlu74@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> If I use the function last/first on this dataset, if the first rows parsed
> by the function contain null values, it cause FATAL error on database.
There is no last() nor first() function built into Postgres.
I surmise that you are using a buggy extension, in which case
you need to report this to the extension's author.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #18139: Causing FATAL error on database using function last() or first()
@ 2023-09-28 19:36 David G. Johnston <david.g.johnston@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
1 sibling, 0 replies; 3+ messages in thread
From: David G. Johnston @ 2023-09-28 19:36 UTC (permalink / raw)
To: pyrotarlu74@gmail.com; pgsql-bugs@lists.postgresql.org
On Thu, Sep 28, 2023 at 11:33 AM PG Bug reporting form <
noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18139
> Logged by: Paul Gazagne
> Email address: pyrotarlu74@gmail.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.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2023-09-28 19:36 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 17:02 BUG #18139: Causing FATAL error on database using function last() or first() PG Bug reporting form <noreply@postgresql.org>
2023-09-28 18:50 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-09-28 19:36 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox