Fix misuse of TextDatumGetCString().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: ac50f84866b22f239025bf37c9c7492cc4ce2dfd
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-07-02T21:02:08Z
Releases: 9.6.0
Fix misuse of TextDatumGetCString().

"TextDatumGetCString(PG_GETARG_TEXT_P(x))" is formally wrong: a text*
is not a Datum.  Although this coding will accidentally fail to fail on
all known platforms, it risks leaking memory if a detoast step is needed,
unlike "TextDatumGetCString(PG_GETARG_DATUM(x))" which is what's used
elsewhere.  Make pg_get_object_address() fall in line with other uses.

Noted while reviewing two-arg current_setting() patch.

Files

PathChange+/−
src/backend/catalog/objectaddress.c modified +1 −1