Fix compilation of src/backend/parser/parse_utilcmd.c#2631
Conversation
Commit 5028981 in src/backend/parser/parse_utilcmd.c removed the inh_indexes field from the CreateStmtContext structure, although it was used in the transformDistributedBy function in the GPDB. Restore it for the GPDB and add code to populate it in the transformTableLikeClause function from 7X.
| * Add to column list | ||
| */ | ||
| cxt->columns = lappend(cxt->columns, def); | ||
| attmap->attnums[parent_attno - 1] = list_length(cxt->columns); |
There was a problem hiding this comment.
Is this approach really valid? The issue solved by the original commit was that inheritance isn't handled at the point when transformTableLikeClause is called, so the true attribute numbers can't be determined at all (since INHERITS columns should go before columns added with LIKE). I think if we need valid attribute numbers for the new table, we will have to defer this until expandTableLikeClause
There was a problem hiding this comment.
we will have to defer this until
expandTableLikeClause
we need indexes in transformDistributedBy() which is before expandTableLikeClause()
There was a problem hiding this comment.
Yes, so I suggest adding something like expandDistributedBy, to handle this case after transformDistributedBy, since we can't handle it here.
P.S. We can also leave this approach for now until we can run the tests, and then rework it if there are issues.
There was a problem hiding this comment.
There are issues. create_table_like.sql
CREATE TABLE inhg (x text, LIKE inhx INCLUDING INDEXES, y text); /* copies indexes */
+ERROR: oids were assigned, but not dispatched to QEs (oid_dispatch.c:1490)
+WARNING: OID assignment not dispatched: catalog 1259, namespace: 2200, name: "inhg_pkey"
+WARNING: OID assignment not dispatched: catalog 2606, namespace: 0, name: "inhg_pkey"
There was a problem hiding this comment.
There are issues. create_table_like.sql
CREATE TABLE inhg (x text, LIKE inhx INCLUDING INDEXES, y text); /* copies indexes */ +ERROR: oids were assigned, but not dispatched to QEs (oid_dispatch.c:1490) +WARNING: OID assignment not dispatched: catalog 1259, namespace: 2200, name: "inhg_pkey" +WARNING: OID assignment not dispatched: catalog 2606, namespace: 0, name: "inhg_pkey"
fixed by #2639
Commit 5028981 in src/backend/parser/parse_utilcmd.c removed the
inh_indexes field from the CreateStmtContext structure, although it was
used in the transformDistributedBy function in the GPDB. Restore it for
the GPDB and add code to populate it in the transformTableLikeClause
function from 7X.