Re: Bug in ALTER COLUMN/TYPE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bug in ALTER COLUMN/TYPE
Date
Msg-id 21055.1091627651@sss.pgh.pa.us
Whole thread Raw
In response to Bug in ALTER COLUMN/TYPE  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: Bug in ALTER COLUMN/TYPE  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-hackers
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> I think we need to deny changing column types if a function is using the 
> table type as a return set.

I disagree.  There are many cases where it will work, and AFAIK none
in which you'll get worse than an error message.  A couple of examples
where it works:

regression=# create table test (f1 int);
CREATE TABLE
regression=# insert into test values(42);
INSERT 155117 1
regression=# create function test () returns setof test as
regression-# 'select * from test' language sql;
CREATE FUNCTION
regression=# alter table test add column f2 text default 'foo';
ALTER TABLE
regression=# select * from test();f1 | f2
----+-----42 | foo
(1 row)

regression=# alter table test alter f1 type bigint;
ALTER TABLE
regression=# select * from test();f1 | f2
----+-----42 | foo
(1 row)

regression=#
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pgxs: build infrastructure for extensions v4
Next
From: chinni
Date:
Subject: postgres and Jdbc 2.0