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