mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Fix more strcmp() calls using boolean-like comparisons for result checks
Such calls can confuse the reader as strcmp() uses an integer as result. The places patched here have been spotted by Thomas Munro, David Rowley and myself. Author: Michael Paquier Reviewed-by: David Rowley Discussion: https://postgr.es/m/20190411021946.GG2728@paquier.xyz
This commit is contained in:
@ -473,9 +473,12 @@ check_foreign_key(PG_FUNCTION_ARGS)
|
||||
nv = SPI_getvalue(newtuple, tupdesc, fn);
|
||||
type = SPI_gettype(tupdesc, fn);
|
||||
|
||||
if ((strcmp(type, "text") && strcmp(type, "varchar") &&
|
||||
strcmp(type, "char") && strcmp(type, "bpchar") &&
|
||||
strcmp(type, "date") && strcmp(type, "timestamp")) == 0)
|
||||
if (strcmp(type, "text") == 0 ||
|
||||
strcmp(type, "varchar") == 0 ||
|
||||
strcmp(type, "char") == 0 ||
|
||||
strcmp(type, "bpchar") == 0 ||
|
||||
strcmp(type, "date") == 0 ||
|
||||
strcmp(type, "timestamp") == 0)
|
||||
is_char_type = 1;
|
||||
#ifdef DEBUG_QUERY
|
||||
elog(DEBUG4, "check_foreign_key Debug value %s type %s %d",
|
||||
|
Reference in New Issue
Block a user