The following bug has been logged on the website:
Bug reference: 19469
Logged by: HaoGang Mao
Email address: haogangmao@gmail.com
PostgreSQL version: 17.3
Operating system: OS: Linux (Docker)
Description:
An open cursor can continue returning tuples built with the old physical
layout of a named composite type. If that type is changed in the same
transaction (for example ALTER TYPE ... ALTER ATTRIBUTE ... TYPE), a later
FETCH may format the tuple using updated descriptor and output metadata.
Minimal Reproduction SQL:
```sql
CREATE TYPE foo AS (a INT, b INT);
BEGIN;
DECLARE c CURSOR FOR
SELECT (i, power(2, 30))::foo
FROM generate_series(1,10) i;
FETCH c;
ALTER TYPE foo ALTER ATTRIBUTE b TYPE TEXT;
FETCH c;
COMMIT;
```