Re: PREPARE(d) statements and modifying columns

From: Kris Jurka <books(at)ejurka(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: PREPARE(d) statements and modifying columns
Date: 2004-10-28 06:31:25
Message-ID: Pine.BSO.4.56.0410280127490.12225@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


I'd like to re-raise this bug I reported some time ago and got no response
on. Generally any plain sql commands shouldn't crash the backend and I
don't like a query reporting incorrect results.

On Sun, 27 Jun 2004, Kris Jurka wrote:

> There are problems when a prepared statement's underlying table's column's
> type is modified. With 7.5 and using the new ALTER TYPE it causes a
> backend crash. Using the old ADD/UPDATE/DROP/RENAME method causes
> incorrect data to be returned.
>
> CREATE TABLE mytab (a int);
> INSERT INTO mytab VALUES (1);
> PREPARE mystat AS SELECT a FROM mytab;
>
> and then:
>
> ALTER TABLE mytab ALTER COLUMN a TYPE bigint USING (a+1);
> EXECUTE mystat;
>
> or:
>
> ALTER TABLE mytab ADD COLUMN b bigint;
> UPDATE mytab SET b = a+1;
> ALTER TABLE mytab DROP COLUMN a;
> ALTER TABLE mytab RENAME COLUMN b TO a;
> EXECUTE mystat;
>
> Kris Jurka
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-10-28 12:49:49 BUG #1298: 22021: invalid byte sequence for encoding \"UNICODE\": 0xe16d61"
Previous Message Scott Eade 2004-10-28 02:20:54 PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working on UNION query