While restoring -getting error if dump contain sql statements generated from generated.sql file

From: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: While restoring -getting error if dump contain sql statements generated from generated.sql file
Date: 2020-04-14 13:41:26
Message-ID: 2678bad1-048f-519a-ef24-b12962f41807@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-04-14 13:52:42 Re: Race condition in SyncRepGetSyncStandbysPriority
Previous Message Kashif Zeeshan 2020-04-14 13:32:40 Re: WIP/PoC for parallel backup