pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: roberto72@gmail.com
Subject: BUG #17092: SELECT using LIMIT clause without ORDER BY fails when parallel query is on
Date: Wed, 07 Jul 2021 21:25:50 +0000
Message-ID: <17092-2524a756f0f764e0@postgresql.org> (raw)

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



Message-ID: <17092-2524a756f0f764e0@postgresql.org>
Permalink:  ../17092-2524a756f0f764e0@postgresql.org/
Also on:    postgresql.org/message-id/17092-2524a756f0f764e0@postgresql.org

 · 

reply

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, roberto72@gmail.com
  Subject: Re: BUG #17092: SELECT using LIMIT clause without ORDER BY fails when parallel query is on
  In-Reply-To: <17092-2524a756f0f764e0@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