Re: Bug in ALTER COLUMN/TYPE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug in ALTER COLUMN/TYPE
Дата
Msg-id 21055.1091627651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug in ALTER COLUMN/TYPE  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Ответы Re: Bug in ALTER COLUMN/TYPE
Список 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 по дате отправления: