Skip to content

Fix compilation of src/backend/parser/parse_utilcmd.c#2631

Open
RekGRpth wants to merge 1 commit into
sync-14x-b13from
sync-14x-b13-65
Open

Fix compilation of src/backend/parser/parse_utilcmd.c#2631
RekGRpth wants to merge 1 commit into
sync-14x-b13from
sync-14x-b13-65

Conversation

@RekGRpth

Copy link
Copy Markdown
Member

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.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will have to defer this until expandTableLikeClause

we need indexes in transformDistributedBy() which is before expandTableLikeClause()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bimboterminator1 bimboterminator1 Jun 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants