Skip to content

Commit 07a9c88

Browse files
committed
Copy unlogged attribute from parent relation
1 parent 6c45e16 commit 07a9c88

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/partition_creation.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ create_single_partition_internal(Oid parent_relid,
671671
RangeVar *partition_rv,
672672
char *tablespace)
673673
{
674+
Relation parentrel;
675+
674676
/* Value to be returned */
675677
Oid partition_relid = InvalidOid; /* safety */
676678

@@ -680,7 +682,8 @@ create_single_partition_internal(Oid parent_relid,
680682
*parent_nsp_name;
681683

682684
/* Elements of the "CREATE TABLE" query tree */
683-
RangeVar *parent_rv;
685+
RangeVar *parent_rv,
686+
*newrel_rv = copyObject(partition_rv);
684687
TableLikeClause like_clause;
685688
CreateStmt create_stmt;
686689
List *create_stmts;
@@ -730,7 +733,10 @@ create_single_partition_internal(Oid parent_relid,
730733
/* Make up parent's RangeVar */
731734
parent_rv = makeRangeVar(parent_nsp_name, parent_name, -1);
732735

733-
Assert(partition_rv);
736+
/* Copy attributes */
737+
parentrel = heap_open(parent_relid, NoLock);
738+
newrel_rv->relpersistence = parentrel->rd_rel->relpersistence;
739+
heap_close(parentrel, NoLock);
734740

735741
/* If no 'tablespace' is provided, get parent's tablespace */
736742
if (!tablespace)
@@ -745,7 +751,7 @@ create_single_partition_internal(Oid parent_relid,
745751

746752
/* Initialize CreateStmt structure */
747753
NodeSetTag(&create_stmt, T_CreateStmt);
748-
create_stmt.relation = copyObject(partition_rv);
754+
create_stmt.relation = newrel_rv;
749755
create_stmt.tableElts = list_make1(copyObject(&like_clause));
750756
create_stmt.inhRelations = list_make1(copyObject(parent_rv));
751757
create_stmt.ofTypename = NULL;

0 commit comments

Comments
 (0)