$ cat t.sql create table foo (id serial primary key, name text); insert into foo (name) values ('joe'); create view v as (select id, name from foo group by id); $ createdb test $ psql -f t.sql test psql:t.sql:1: NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq" for serial column "foo.id" psql:t.sql:1: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo" CREATE TABLE INSERT 0 1 CREATE VIEW $ pg_dump -Fc test > t.dump $ dropdb test $ createdb test $ pg_restore -j4 -d test t.dump pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 163; 1259 3870794 VIEW v joe pg_restore: [archiver (db)] could not execute query: ERROR: column "foo.name" must appear in the GROUP BY clause or be used in an aggregate function LINE 2: SELECT foo.id, foo.name FROM foo GROUP BY foo.id; ^ Command was: CREATE VIEW v AS SELECT foo.id, foo.name FROM foo GROUP BY foo.id; pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.v" does not exist Command was: ALTER TABLE public.v OWNER TO joe; WARNING: errors ignored on restore: 2