1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Dodge a macro-name conflict with Perl.

Some versions of Perl export a macro named HS_KEY.  This creates a
conflict in contrib/hstore_plperl against hstore's macro of the same
name.  The most future-proof solution seems to be to rename our macro;
I chose HSTORE_KEY.  For consistency, rename HS_VAL and related macros
similarly.

Back-patch to 9.5.  contrib/hstore_plperl doesn't exist before that
so there is no need to worry about the conflict in older releases.

Per reports from Marco Atzeri and Mike Blackwell.
This commit is contained in:
Tom Lane
2015-11-19 14:54:05 -05:00
parent 04f5622b63
commit 8ee1a776a0
8 changed files with 151 additions and 127 deletions

View File

@ -25,14 +25,16 @@ hstore_to_plpython(PG_FUNCTION_ARGS)
{
PyObject *key;
key = PyString_FromStringAndSize(HS_KEY(entries, base, i), HS_KEYLEN(entries, i));
if (HS_VALISNULL(entries, i))
key = PyString_FromStringAndSize(HSTORE_KEY(entries, base, i),
HSTORE_KEYLEN(entries, i));
if (HSTORE_VALISNULL(entries, i))
PyDict_SetItem(dict, key, Py_None);
else
{
PyObject *value;
value = PyString_FromStringAndSize(HS_VAL(entries, base, i), HS_VALLEN(entries, i));
value = PyString_FromStringAndSize(HSTORE_VAL(entries, base, i),
HSTORE_VALLEN(entries, i));
PyDict_SetItem(dict, key, value);
Py_XDECREF(value);
}