# test1 pg_dump ## create table,index,view drop table test1; create table test1(id int); create index idx1_test1 on test1(id); create view view1_test1 as select * from test1; ## run pg_dump in gdb gdb pg_dump (gdb)b getTables (gdb)run -d postgres -f dump.txt ## drop index,view in Transaction-A begin; drop index idx1_test1; drop view view1_test1; commit; ## continue in gdb (gdb)continue ## correct info for index,view in dump.txt -- -- Name: view1_test1; Type: VIEW; Schema: public; Owner: postgres -- CREATE VIEW public.view1_test1 AS SELECT id FROM public.test1; -- -- Name: idx1_test1; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX idx1_test1 ON public.test1 USING btree (id); # test2 pg_get_indexdef,pg_get_viewdef ## create table,index,view drop table test1; create table test1(id int); create index idx1_test1 on test1(id); create view view1_test1 as select * from test1; ## begin Transaction-A begin transaction isolation level serializable; select pg_current_xact_id(); ## begin Transaction-B begin transaction isolation level serializable; select pg_current_xact_id(); ## drop index,view in Transaction-A drop index idx1_test1; drop view view1_test1; commit; ## SELECT pg_get_indexdef,pg_get_viewdef in Transaction-B SELECT pg_get_indexdef(oid) FROM pg_class WHERE relname = 'idx1_test1'; SELECT pg_get_viewdef(oid) FROM pg_class WHERE relname = 'view1_test1'; ## correct info from index and view postgres=*# SELECT pg_get_indexdef(oid) FROM pg_class WHERE relname = 'idx1_test1'; pg_get_indexdef ---------------------------------------------------------- CREATE INDEX idx1_test1 ON public.test1 USING btree (id) (1 row) postgres=*# SELECT pg_get_viewdef(oid) FROM pg_class WHERE relname = 'view1_test1'; pg_get_viewdef ---------------- SELECT id + FROM test1; (1 row) ## However, SELECT view1_test1 cause ERROR because view does not exist postgres=*# SELECT * FROM view1_test1; ERROR: relation "view1_test1" does not exist LINE 1: SELECT * FROM view1_test1;