简体   繁体   中英

Upload backup of PostgreSQL DB

During upload of back-up database I run the command:

pg_restore 20150401.backup > backup.txt

This gives me the following warrning:

pg_restore: [archiver] WARNING: don't know how to set owner for object MATERIALIZED VIEW

And indeed when backup is up the materilzed view doesn't exists. So I need to run it's creation code in a query manualy. This is very inconvenient.

I'm runing PostgreSQL 9.3.3

Is there a way to fix this problem? Was this issue addressed in future releases?

you can get the definition querying it, eg:

create view:

t=# create materialized view so55 as select * from pg_tables where tablename like 'gt%';
SELECT 0

get ddl:

t=# \pset format unaligned
Output format is unaligned.
t=# select concat('create view ',schemaname,'.',matviewname,' as ',definition) from pg_matviews where matviewname = 'so55';
concat
create view public.so55 as  SELECT pg_tables.schemaname,
    pg_tables.tablename,
    pg_tables.tableowner,
    pg_tables.tablespace,
    pg_tables.hasindexes,
    pg_tables.hasrules,
    pg_tables.hastriggers
   FROM pg_tables
  WHERE (pg_tables.tablename ~~ 'gt%'::text);
(1 row)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM