BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
The following bug has been logged on the website:
Bug reference: 16924
Logged by: Henry Hinze
Email address: henry.hinze@googlemail.com
PostgreSQL version: 13.2
Operating system: Ubuntu 20.04
Description:
Affected Versions 12.6 and 13.2 (Still working in 12.4)
When dumping and restoring a partitioned table with a generated column the
column isn't restored. The column stays NULL instead.
How to reproduce:
postgres@phobos:~$ psql
psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.
postgres=# create database d1;
CREATE DATABASE
postgres=# create database d2;
CREATE DATABASE
postgres=# \c d1;
You are now connected to database "d1" as user "postgres".
d1=# create table t (c1 int, c2 int generated always as (c1 * 2) stored)
partition by range (c1);
CREATE TABLE
d1=# create table t1 partition of t for values from (1) to (2);
CREATE TABLE
d1=# create table t2 partition of t for values from (2) to (3);
CREATE TABLE
d1=# insert into t (c1) values (1), (2);
INSERT 0 2
d1=# select * from t;
c1 | c2
----+----
1 | 2
2 | 4
(2 rows)
d1=# \q
postgres@phobos:~$ pg_dump d1 | psql d2
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
SET
CREATE TABLE
ALTER TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
ALTER TABLE
COPY 1
COPY 1
postgres@phobos:~$ psql d2
psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.
d2=# select * from t;
c1 | c2
----+----
1 |
2 |
(2 rows)
I tested this also on 12.4 where it is still working and showing the correct
result.
Best,
Henry
Any thoughts on this issue?
Best,
Henry
Am Fr., 12. März 2021 um 11:24 Uhr schrieb PG Bug reporting form <
noreply@postgresql.org>:
The following bug has been logged on the website:
Bug reference: 16924
Logged by: Henry Hinze
Email address: henry.hinze@googlemail.com
PostgreSQL version: 13.2
Operating system: Ubuntu 20.04
Description:Affected Versions 12.6 and 13.2 (Still working in 12.4)
When dumping and restoring a partitioned table with a generated column the
column isn't restored. The column stays NULL instead.How to reproduce:
postgres@phobos:~$ psql
psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.postgres=# create database d1;
CREATE DATABASE
postgres=# create database d2;
CREATE DATABASE
postgres=# \c d1;
You are now connected to database "d1" as user "postgres".
d1=# create table t (c1 int, c2 int generated always as (c1 * 2) stored)
partition by range (c1);
CREATE TABLE
d1=# create table t1 partition of t for values from (1) to (2);
CREATE TABLE
d1=# create table t2 partition of t for values from (2) to (3);
CREATE TABLE
d1=# insert into t (c1) values (1), (2);
INSERT 0 2
d1=# select * from t;
c1 | c2
----+----
1 | 2
2 | 4
(2 rows)d1=# \q
postgres@phobos:~$ pg_dump d1 | psql d2
SET
SET
SET
SET
SET
set_config
------------(1 row)
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
SET
CREATE TABLE
ALTER TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
ALTER TABLE
COPY 1
COPY 1
postgres@phobos:~$ psql d2
psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.d2=# select * from t;
c1 | c2
----+----
1 |
2 |
(2 rows)I tested this also on 12.4 where it is still working and showing the
correct
result.
Best,
Henry
--
Diplominformatiker Henry Hinze
Dietzgenstraße 75
13156 Berlin
Tel: +49 - 177 - 3160621
USt-ID: DE306639264