aboutsummaryrefslogtreecommitdiff
path: root/src/include/postgres.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-09-13 17:17:48 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-09-13 17:17:48 -0400
commit55c3391d1e6a201b5b891781d21fe682a8c64fe6 (patch)
treeecae37c23f41bef5a1921d1cf402ca8ca69825db /src/include/postgres.h
parentfdc79e1909dc3866a385ffb74bdd6ce6a082a300 (diff)
downloadpostgresql-55c3391d1e6a201b5b891781d21fe682a8c64fe6.tar.gz
postgresql-55c3391d1e6a201b5b891781d21fe682a8c64fe6.zip
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: <EFD8AC94-4C1F-40C1-A5EA-304080089C1B@gmail.com>
Diffstat (limited to 'src/include/postgres.h')
-rw-r--r--src/include/postgres.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/postgres.h b/src/include/postgres.h
index d999013238a..be4d0d609ea 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