BUG #17706: ALTER TYPE leads to crash

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: s(dot)shinderuk(at)postgrespro(dot)ru
Subject: BUG #17706: ALTER TYPE leads to crash
Date: 2022-12-07 20:16:30
Message-ID: 17706-fa10a46c1ac9ce5a@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: 17706
Logged by: Sergey Shinderuk
Email address: s(dot)shinderuk(at)postgrespro(dot)ru
PostgreSQL version: 15.1
Operating system: Ubuntu 22.04
Description:

With PL/pgSQL:

create type foo as (a int, b int);

create function bar() returns record as $$
declare
r foo := row(123, 2^30);
begin
alter type foo alter attribute b type text;
return r;
end;
$$ language plpgsql;

postgres=# select bar();
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

LOG: server process (PID 394076) was terminated by signal 11: Segmentation
fault

(Here 2^30 is interpreted as a string length.)

With a cursor:

postgres=# create type foo as (a int, b int);
CREATE TYPE
postgres=# begin;
BEGIN
postgres=*# declare c cursor for select (i, 2^30)::foo from
generate_series(1,10) i;
DECLARE CURSOR
postgres=*# fetch c;
row
----------------
(1,1073741824)
(1 row)

postgres=*# fetch c;
row
----------------
(2,1073741824)
(1 row)

postgres=*# alter type foo alter attribute b type text;
ALTER TYPE
postgres=*# fetch c;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2022-12-07 22:52:20 Re: Bug in jsonb_path_exists (maybe _match) one-element scalar/variable jsonpath handling
Previous Message Jeff Davis 2022-12-07 17:44:15 Re: CREATE COLLATION without LOCALE throws error in v15