Skip to content

Commit 5317c80

Browse files
committed
Fix incorrect strncmp usage when comparing access method names.
Previously, the third argument to strncmp() was a boolean expression, which resulted in a -Wmemsize-comparison warning and incorrect behavior. Since the lengths were already checked to be equal, strcmp() is sufficient and more appropriate here.
1 parent 1286c92 commit 5317c80

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/backend/parser/gram.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3850,7 +3850,7 @@ alter_table_cmd:
38503850
if (witham)
38513851
{
38523852
if (strlen(witham) != strlen(n->name) ||
3853-
strncmp(n->name, witham, strlen(n->name) != 0))
3853+
strcmp(n->name, witham) != 0)
38543854
ereport(ERROR,
38553855
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
38563856
errmsg("ACCESS METHOD is specified as \"%s\" but "

0 commit comments

Comments
 (0)