From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: pyrotarlu74@gmail.com
Subject: BUG #18139: Causing FATAL error on database using function last() or first()
Date: Thu, 28 Sep 2023 17:02:51 +0000
Message-ID: <18139-9f45531e1ce99975@postgresql.org> (raw)
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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, pyrotarlu74@gmail.com
Subject: Re: BUG #18139: Causing FATAL error on database using function last() or first()
In-Reply-To: <18139-9f45531e1ce99975@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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