pgsql: Fix misuse of TextDatumGetCString().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix misuse of TextDatumGetCString().
Date: 2015-07-02 21:02:21
Message-ID: E1ZAlcj-0002oC-9e@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ac50f84866b22f239025bf37c9c7492cc4ce2dfd

Modified Files
--------------
src/backend/catalog/objectaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-07-02 21:24:45 pgsql: Make numeric form of PG version number readily available in Make
Previous Message Tom Lane 2015-07-02 20:41:16 pgsql: Add an optional missing_ok argument to SQL function current_sett