From 55c3391d1e6a201b5b891781d21fe682a8c64fe6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 13 Sep 2016 17:17:48 -0400 Subject: Be pickier about converting between Name and Datum. We were misapplying NameGetDatum() to plain C strings in some places. This worked, because it was just a pointer cast anyway, but it's a type cheat in some sense. Use CStringGetDatum instead, and modify the NameGetDatum macro so it won't compile if applied to something that's not a pointer to NameData. This should result in no changes to generated code, but it is logically cleaner. Mark Dilger, tweaked a bit by me Discussion: --- src/include/postgres.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/include/postgres.h') diff --git a/src/include/postgres.h b/src/include/postgres.h index d999013238..be4d0d609e 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -600,7 +600,7 @@ typedef Datum *DatumPtr; * value has adequate lifetime. */ -#define NameGetDatum(X) PointerGetDatum(X) +#define NameGetDatum(X) CStringGetDatum(NameStr(*(X))) /* * DatumGetInt64 -- cgit v1.2.3