While restoring -getting error if dump contain sql statementsgenerated from generated.sql file - Mailing list pgsql-hackers

From tushar
Subject While restoring -getting error if dump contain sql statementsgenerated from generated.sql file
Date
Msg-id 2678bad1-048f-519a-ef24-b12962f41807@enterprisedb.com
Whole thread Raw
Responses Re: While restoring -getting error if dump contain sql statementsgenerated from generated.sql file  (Masahiko Sawada <masahiko.sawada@2ndquadrant.com>)
List pgsql-hackers
Hi ,

We have a sql file  called 'generated.sql' under src/test/regress/sql 
folder . if we run this file on psql , take the dump and try to restore 
it on another db
we are getting error like -

psql:/tmp/x:434: ERROR:  column "b" of relation "gtest1_1" is a 
generated column
psql:/tmp/x:441: ERROR:  cannot use column reference in DEFAULT expression

These sql statements , i copied from the dump file

postgres=# CREATE TABLE public.gtest30 (
postgres(#     a integer,
postgres(#     b integer
postgres(# );
CREATE TABLE
postgres=#
postgres=# CREATE TABLE public.gtest30_1 (
postgres(# )
postgres-# INHERITS (public.gtest30);
CREATE TABLE
postgres=# ALTER TABLE ONLY public.gtest30_1 ALTER COLUMN b SET DEFAULT 
(a * 2);
ERROR:  cannot use column reference in DEFAULT expression
postgres=#

Steps to reproduce -

connect to psql - ( ./psql postgres)
create database ( create database x;)
connect to database x (\c x )
execute generated.sql file (\i ../../src/test/regress/sql/generated.sql)
take the dump of x db (./pg_dump -Fp x > /tmp/t.dump)
create another database  (create database y;)
Connect to y db (\c y)
execute plain dump sql file (\i /tmp/t.dump)

-- 
regards,tushar
EnterpriseDB  https://www.enterprisedb.com/
The Enterprise PostgreSQL Company




pgsql-hackers by date:

Previous
From: Kashif Zeeshan
Date:
Subject: Re: WIP/PoC for parallel backup
Next
From: Tom Lane
Date:
Subject: Re: Race condition in SyncRepGetSyncStandbysPriority