diff --git a/coccinelle/namestr.cocci b/coccinelle/namestr.cocci new file mode 100644 index 00000000000..86160ca9965 --- /dev/null +++ b/coccinelle/namestr.cocci @@ -0,0 +1,25 @@ +// Find direct access of data member of a NameData structure +// +// These should use NameStr instead. + +@@ +typedef NameData; +typedef Name; +NameData E; +@@ +- E.data ++ NameStr(E) + +@@ +NameData *E; +@@ +- E->data ++ NameStr(*E) + +@@ +Name E; +@@ +- E->data ++ NameStr(*E) + + diff --git a/tsl/src/deparse.c b/tsl/src/deparse.c index 5bd6fe38f97..04a9cff99dd 100644 --- a/tsl/src/deparse.c +++ b/tsl/src/deparse.c @@ -151,7 +151,7 @@ column_is_serial(Relation rel, Name column) NameStr(rel->rd_rel->relname)); InitFunctionCallInfoData(*fcinfo, NULL, 2, InvalidOid, NULL, NULL); FC_ARG(fcinfo, 0) = CStringGetTextDatum(relation_name); - FC_ARG(fcinfo, 1) = CStringGetTextDatum(column->data); + FC_ARG(fcinfo, 1) = CStringGetTextDatum(NameStr(*column)); FC_NULL(fcinfo, 0) = false; FC_NULL(fcinfo, 1) = false; pg_get_serial_sequence(fcinfo);