Re: BUG #18333: Postgres is crashing if we have special character in the query

From: Sujeet Swaminath <sujeet(dot)cha(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18333: Postgres is crashing if we have special character in the query
Date: 2024-05-07 12:49:55
Message-ID: CABMBj-8B7B-zCBfn-iLv+1PS5O1k-xhyM+aXE1TwP-PphXn=zQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Michael,

Using the latest PostgreSQL 14 release version (14.11), I was able to
reproduce this issue by executing the provided query, resulting in a crash.
Attached are the crash dump and a sample database in tar format.

below is the login and the schema details that I have used,

> create role badsql login password 'test123' createdb valid until
> 'infinity';
> create database "TEST" with encoding='UTF8' connection limit=-1;
> \c TEST
> create schema badsql authorization badsql;
> grant all on schema badsql to badsql;
> alter user badsql set search_path = badsql;
> alter user badsql with superuser;
>

and to crash the postgres, you can use the below query.

SELECT DISTINCT htest.test_code,htest.new_nr FROM htest LEFT OUTER JOIN
> ktest on htest.new_nr = ktest.test_nr and htest.test_ek%2=ktest.test_ek;
>

Note: soon after importing the DB it will not crash, you have to exit the
psql session and start a new session, then within 5-10 execution of this
query it should crash.

Thanks,
Sujeet

On Tue, Feb 6, 2024 at 5:32 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Mon, Feb 05, 2024 at 10:30:33AM +0000, PG Bug reporting form wrote:
> > I have installed Postgres-14.10 and when executing the below query, the
> > postgres crashes. but the same query work well with PostgreSQL-14-9.
> > I have a crash dump, but not sure, how can I attach it here.
> >
> > 2024-02-05 06:08:53.936 GMT [1680576] LOG: server process (PID 2627861)
> was
> > terminated by signal 11: Segmentation fault
> > 2024-02-05 06:08:53.936 GMT [1680576] DETAIL: Failed process was
> running:
> > SELECT DISTINCT badsql.id_code,badsql.id_nr FROM badsql LEFT OUTER JOIN
> > newsql on badsql.id_nr = newsql.id_nr and
> badsql.vk_ek%2=newsql.ku_vk_ek;
>
> It is going to be hard to say what's wrong without more details, like
> a backtrace, or even better a self-contained SQL sequence that makes a
> problem reproducible. 14.11 is planned for this week, so you may want
> to give it a try and double-check if your problem is going away:
> https://www.postgresql.org/developer/roadmap/
> --
> Michael
>

Attachment Content-Type Size
crash_details.zip application/x-zip-compressed 1.0 MB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-05-07 13:58:15 Re: BUG #18457: Possible data loss needs to be evaluated
Previous Message David G. Johnston 2024-05-07 12:20:38 Re: BUG #18457: Possible data loss needs to be evaluated