Table renaming does not propagate to views

Поиск
Список
Период
Сортировка
От Jordan Deitch
Тема Table renaming does not propagate to views
Дата
Msg-id 1536941897.1054461.1508319136.2C8C7EE2@webmail.messagingengine.com
обсуждение исходный текст
Ответы Re: Table renaming does not propagate to views  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi Hackers -

It appears only the oid of the relations used in a view are captured in the view definition, not the relations' name
itself.The effect this has is that relation renaming does not propagate to views. I would like to assert that they
should.

The user has stated their intention in the view to reference a particular relation by name, not by oid, and so
materializingthe oid is defective behavior.
 

The following procedure demonstrates:

---------------------------
begin;
create table public.test (id varchar(255));
insert into public.test(id) values ('12/12/2009');


create table public.test_new (id varchar(50));
insert into public.test_new(id) select * from test;

create view public.test_v as select count(*) from test;

select * from public.test_v; <------ returns 1

alter table public.test rename to test_depricated;
alter table public.test_new rename to test;

insert into public.test(id) values ('12/12/2010');


select * from public.test_v; <------ (erroneously) returns 1


rollback;
---------------------------

Thanks!


-- 
Jordan Deitch
https://id.rsa.pub/


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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: ssl tests README and certs
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Avoid extra Sort nodes between WindowAggs when sorting can be reused