BUG #17092: SELECT using LIMIT clause without ORDER BY fails when parallel query is on

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: roberto72(at)gmail(dot)com
Subject: BUG #17092: SELECT using LIMIT clause without ORDER BY fails when parallel query is on
Date: 2021-07-07 21:25:50
Message-ID: 17092-2524a756f0f764e0@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17092
Logged by: Roberto Rosa
Email address: roberto72(at)gmail(dot)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

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2021-07-07 21:32:56 Re: BUG #17088: FailedAssertion in prepagg.c
Previous Message Tom Lane 2021-07-07 21:22:17 Re: BUG #17088: FailedAssertion in prepagg.c