BUG #17092: SELECT using LIMIT clause without ORDER BY fails when parallel query is on - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17092: SELECT using LIMIT clause without ORDER BY fails when parallel query is on
Date
Msg-id 17092-2524a756f0f764e0@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17092
Logged by:          Roberto Rosa
Email address:      roberto72@gmail.com
PostgreSQL version: 13.3
Operating system:   Ubuntu 20.04.2 LTS (Kernel 5.4.0-65 x86_64)
Description:

PostgreSQL is version 13.3. Operating system is Ubuntu 20.04.2 LTS. The
table tested has 103968 records. Parameters "max_parallel_workers" and
"max_parallel_workers_per_gather" are default (8 and 2, respectively). The
table name and field were changed for privacy of the company involved.

The query (1):

SELECT *
FROM the_table
WHERE id=41
LIMIT 1

fails and reports the error:

ERROR:  invalid input syntax for type integer: ""
CONTEXT:  parallel worker

However, if we add the ORDER BY clause (2);

SELECT *
FROM the_table
WHERE id=41
ORDER BY 1
LIMIT 1

The result shown contains all the columns, as desired and expected. Also, if
we remove the WHERE clause (3)

SELECT *
FROM the_table
LIMIT 1

it shows the expected result.

As this is a production database and the application is built by an external
group of individuals, we are unable (at this moment) to change the code,
including the ORDER BY clause. So, the temporary solution was to set both
"max_parallel_workers" and "max_parallel_workers_per_gather" to 0 (zero) in
the configuration file and reload the configuration. In doing that, the
original query (1) succeeds, as all the other two queries - (2) and (3).

If some information is missing, please let me know.

Regards


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17088: FailedAssertion in prepagg.c
Next
From: Andrew Gierth
Date:
Subject: Re: BUG #17088: FailedAssertion in prepagg.c