Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?

Поиск
Список
Период
Сортировка
От ash
Тема Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Дата
Msg-id 874n0bk8nz.fsf@commandprompt.com
обсуждение исходный текст
Ответ на Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (David Fetter <david@fetter.org>)
Список pgsql-hackers
David Fetter <david@fetter.org> writes:
>> >
>> > Also worth considering: functions which take any part of the view
>> > as a parameter.
>> 
>> Sorry, I don't get it: do you suggest we should re-create dependent
>> functions too?
>
> I'd throw an error in cases where such functions had an obvious and
> deterministic dependency on the views, ideally having gone through all
> such functions first and enumerated them in the error message.

Then it would also make sense to start with checking function dependency
on the tables themselves, not only the joining views:

psql=> CREATE TABLE t(id INT);
CREATE TABLE
psql=> CREATE FUNCTION func1() RETURNS SETOF INT AS $$ SELECT id FROM t; $$ LANGUAGE SQL;
CREATE FUNCTION
psql=> ALTER TABLE t ALTER COLUMN id TYPE BIGINT;
ALTER TABLE
-- Would complain on func1 right away

psql=> SELECT func1();
ERROR:  return type mismatch in function declared to return integer
DETAIL:  Actual return type is bigint.
CONTEXT:  SQL function "func1" during startup

psql=> CREATE FUNCTION func2() RETURNS SETOF INT AS $$ SELECT id FROM t; $$ LANGUAGE SQL;
ERROR:  return type mismatch in function declared to return integer
DETAIL:  Actual return type is bigint.
CONTEXT:  SQL function "func2"

--
Alex



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Spreading full-page writes
Следующее
От: Matteo Beccati
Дата:
Сообщение: Re: [PATCH] Replacement for OSSP-UUID for Linux and BSD