Re: Bug in ALTER COLUMN/TYPE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in ALTER COLUMN/TYPE
Date: 2004-08-04 13:54:11
Message-ID: 21055.1091627651@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2004-08-04 14:14:21 Re: Bug in ALTER COLUMN/TYPE
Previous Message Andrew Dunstan 2004-08-04 12:21:26 Re: pgxs: build infrastructure for extensions v4