Skip to content

Conversation

Y--
Copy link
Collaborator

@Y-- Y-- commented May 5, 2025

Fixes #748

@Y-- Y-- requested a review from JelteF May 5, 2025 09:24
@Y-- Y-- enabled auto-merge (squash) May 5, 2025 09:25
@@ -185,7 +185,7 @@ IsAllowedStatement(Query *query, bool throw_error) {
}

/* We don't support modifying statements on Postgres tables yet */
if (query->commandType != CMD_SELECT) {
if (ContainsFromClause(query) && query->commandType != CMD_SELECT) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems a a weird place to add this check. It seem to have anything to do with checking whether the postgres table is a modifying statement or not.

Copy link
Collaborator Author

@Y-- Y-- May 6, 2025

Choose a reason for hiding this comment

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

I agree, though the line below uses list_nth_node with query->rtable which could be NULL without this check, thus failing the Assert(list != NIL) in list_nth_cell

Do you prefer to just explicitly check for query->rtable != NIL?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Though re-reading now with fresh eyes it was indeed pretty weird. Reworked here: 2ed8ee4

@JelteF JelteF disabled auto-merge May 6, 2025 08:42
Copy link
Collaborator

@JelteF JelteF left a comment

Choose a reason for hiding this comment

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

Actually, checking for rtable == NULL instead of using ContainsFromClause would be be a bit clearer too imo. Because rtable only corresponds to FROM for SELECT queries, and in this block we're explicitely not talking about SELECT queries due to the != CMD_SELECT check.

e.g. INSERT INTO abc VALUES (1) will have abc in the rtable.

@Y-- Y-- requested a review from JelteF May 6, 2025 08:47
@Y-- Y-- enabled auto-merge (squash) May 6, 2025 08:47
@Y-- Y-- merged commit 695eef4 into main May 6, 2025
6 checks passed
@Y-- Y-- deleted the yl/fix-748 branch May 6, 2025 09:13
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.

Server crashes on executing "CREATE TABLE"
2 participants