]> granicus.if.org Git - postgresql/commit
Be pickier about converting between Name and Datum.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 13 Sep 2016 21:17:48 +0000 (17:17 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 13 Sep 2016 21:17:48 +0000 (17:17 -0400)
commit55c3391d1e6a201b5b891781d21fe682a8c64fe6
treeecae37c23f41bef5a1921d1cf402ca8ca69825db
parentfdc79e1909dc3866a385ffb74bdd6ce6a082a300
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>
src/backend/commands/dbcommands.c
src/backend/commands/proclang.c
src/backend/commands/typecmds.c
src/include/postgres.h