Re: [HACKERS] Bug in ALTER COLUMN/TYPE
Rod Taylor wrote: On Tue, 2004-08-03 at 23:36, Christopher Kings-Lynne wrote: I think we need to deny changing column types if a function is using the table type as a return set. test=# create table test (a int4); CREATE TABLE test=# create function test () returns setof test as 'select 1' language sql; What we really need is dependencies within the function body and the ability to clear the function cache (recompile). I notice we didn't have this on the TODO --- added: * Track dependencies in function bodies and recompile/invalidate -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [HACKERS] Bug in ALTER COLUMN/TYPE
On Tue, 2004-08-03 at 23:36, Christopher Kings-Lynne wrote: I think we need to deny changing column types if a function is using the table type as a return set. test=# create table test (a int4); CREATE TABLE test=# create function test () returns setof test as 'select 1' language sql; What we really need is dependencies within the function body and the ability to clear the function cache (recompile). -- rbt at sitesell dot com ---(end of broadcast)--- TIP 8: explain analyze is your friend
[HACKERS] Bug in ALTER COLUMN/TYPE
I think we need to deny changing column types if a function is using the table type as a return set. test=# create table test (a int4); CREATE TABLE test=# create function test () returns setof test as 'select 1' language sql; CREATE FUNCTION test=# alter table test alter a type bigint; ALTER TABLE test=# select * from test(); ERROR: return type mismatch in function declared to return test DETAIL: Final SELECT returns integer instead of bigint at column 1. CONTEXT: SQL function test during startup Chris ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [HACKERS] Bug in ALTER COLUMN/TYPE
Christopher Kings-Lynne [EMAIL PROTECTED] 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 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] Bug in ALTER COLUMN/TYPE
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: OK, fair enough. Chris ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [HACKERS] Bug in ALTER COLUMN/TYPE
What we really need is dependencies within the function body and the ability to clear the function cache (recompile). Can the new function validator function for pl/pgsql add dependencies perhaps? Chris ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org