From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: henry.hinze@googlemail.com
Subject: BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
Date: Fri, 12 Mar 2021 10:23:33 +0000
Message-ID: <16924-bf9653922ef615c4@postgresql.org> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, henry.hinze@googlemail.com
Subject: Re: BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
In-Reply-To: <16924-bf9653922ef615c4@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox