Skip to content

Commit

Permalink
Check whether table AM is default
Browse files Browse the repository at this point in the history
PG 17 added support for DEFAULT in ALTER TABLE .. SET ACCESS METHOD

Relevant PG commit:
d61a6cad6418f643a5773352038d0dfe5d3535b8
postgres/postgres@d61a6ca

In that case, name in AlterTableCmd would be null.
Add a null check here to avoid crash.

(cherry picked from commit 71b9974)
(cherry picked from commit 52d3329)
  • Loading branch information
naisila committed Nov 18, 2024
1 parent 84b52fc commit 3121717
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/backend/columnar/columnar_tableam.c
Original file line number Diff line number Diff line change
Expand Up @@ -2256,7 +2256,9 @@ ColumnarProcessAlterTable(AlterTableStmt *alterTableStmt, List **columnarOptions
"Specify SET ACCESS METHOD before storage parameters, or use separate ALTER TABLE commands.")));
}

destIsColumnar = (strcmp(alterTableCmd->name, COLUMNAR_AM_NAME) == 0);
destIsColumnar = (strcmp(alterTableCmd->name ? alterTableCmd->name :

Check warning on line 2259 in src/backend/columnar/columnar_tableam.c

View check run for this annotation

Codecov / codecov/patch

src/backend/columnar/columnar_tableam.c#L2259

Added line #L2259 was not covered by tests
default_table_access_method,
COLUMNAR_AM_NAME) == 0);

if (srcIsColumnar && !destIsColumnar)
{
Expand Down

0 comments on commit 3121717

Please sign in to comment.