summaryrefslogtreecommitdiff
path: root/src/backend/commands/createas.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/createas.c')
-rw-r--r--src/backend/commands/createas.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c
index afd3dace079..c5df96e374a 100644
--- a/src/backend/commands/createas.c
+++ b/src/backend/commands/createas.c
@@ -85,6 +85,9 @@ create_ctas_internal(List *attrList, IntoClause *into)
Datum toast_options;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
ObjectAddress intoRelationAddr;
+ const TableAmRoutine *tableam = NULL;
+ Oid accessMethodId = InvalidOid;
+ Relation rel;
/* This code supports both CREATE TABLE AS and CREATE MATERIALIZED VIEW */
is_matview = (into->viewQuery != NULL);
@@ -125,7 +128,15 @@ create_ctas_internal(List *attrList, IntoClause *into)
validnsps,
true, false);
- (void) heap_reloptions(RELKIND_TOASTVALUE, toast_options, true);
+ rel = relation_open(intoRelationAddr.objectId, AccessShareLock);
+ accessMethodId = table_relation_toast_am(rel);
+ relation_close(rel, AccessShareLock);
+
+ if (OidIsValid(accessMethodId))
+ {
+ tableam = GetTableAmRoutineByAmOid(accessMethodId);
+ (void) tableam_reloptions(tableam, RELKIND_TOASTVALUE, toast_options, NULL, true);
+ }
NewRelationCreateToastTable(intoRelationAddr.objectId, toast_options);