pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
2+ messages / 2 participants
[nested] [flat]

* BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
@ 2021-03-12 10:23  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2021-03-12 10:23 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: henry.hinze@googlemail.com

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
@ 2021-03-16 15:43  Henry Hinze <henry.hinze@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Henry Hinze @ 2021-03-16 15:43 UTC (permalink / raw)
  To: Henry Hinze <henry.hinze@googlemail.com>; pgsql-bugs@lists.postgresql.org

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-03-16 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 10:23 BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning PG Bug reporting form <noreply@postgresql.org>
2021-03-16 15:43 ` Henry Hinze <henry.hinze@gmail.com>

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