BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: henry(dot)hinze(at)googlemail(dot)com
Subject: BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
Date: 2021-03-12 10:23:33
Message-ID: 16924-bf9653922ef615c4@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16924
Logged by: Henry Hinze
Email address: henry(dot)hinze(at)googlemail(dot)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(at)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(at)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(at)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2021-03-12 11:12:43 Re: BUG #16920: Can't compile PostGIS with MingW64 against PostgreSQL 14 head
Previous Message tomohiro hiramitsu 2021-03-12 08:23:29 Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table.