Work with PostgreSQL 11 by backporting an upstream patch.

OK ajacoutot@
This commit is contained in:
jeremy 2019-02-19 05:11:36 +00:00
parent b93259828e
commit e3dd5a8e3a
2 changed files with 69 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.17 2018/12/02 13:26:42 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.18 2019/02/19 05:11:36 jeremy Exp $
# v8 only works on these arches currently
ONLY_FOR_ARCHS = amd64 i386
@ -6,7 +6,7 @@ ONLY_FOR_ARCHS = amd64 i386
COMMENT = PostgreSQL V8 javascript procedural language
VERSION = 1.4.2
REVISION = 7
REVISION = 8
DISTNAME = plv8-${VERSION}
PKGNAME = postgresql-${DISTNAME}
@ -24,9 +24,10 @@ EXTRACT_SUFX = .zip
COMPILER = base-clang ports-gcc base-gcc
BUILD_DEPENDS = ${RUN_DEPENDS}
BUILD_DEPENDS = ${RUN_DEPENDS} \
postgresql-client->=11,<12:databases/postgresql,-main
LIB_DEPENDS = lang/libv8
RUN_DEPENDS = postgresql-server->=10,<11:databases/postgresql,-server
RUN_DEPENDS = postgresql-server->=11,<12:databases/postgresql,-server
MAKE_FLAGS = V8DIR=${LOCALBASE}/lib \
CUSTOM_CC="${CXX}" \

View File

@ -1,7 +1,9 @@
$OpenBSD: patch-plv8_cc,v 1.2 2017/05/29 15:38:20 espie Exp $
$OpenBSD: patch-plv8_cc,v 1.3 2019/02/19 05:11:36 jeremy Exp $
https://code.google.com/p/plv8js/source/detail?r=094df45dce2a879d1814b792aeb46b38f0f0ef87&name=r1.4
https://github.com/plv8/plv8/commit/0f1915e48d40c99b100cce824da1157995169c67.diff
Index: plv8.cc
--- plv8.cc.orig
+++ plv8.cc
@ -128,3 +130,64 @@ Index: plv8.cc
{
return common_pl_call_validator(fcinfo, PLV8_DIALECT_LIVESCRIPT);
}
@@ -1442,14 +1439,15 @@ Converter::Init()
{
for (int c = 0; c < m_tupdesc->natts; c++)
{
- if (m_tupdesc->attrs[c]->attisdropped)
+ if (TupleDescAttr(m_tupdesc, c)->attisdropped)
continue;
- m_colnames[c] = ToString(NameStr(m_tupdesc->attrs[c]->attname));
+ m_colnames[c] = ToString(NameStr(TupleDescAttr(m_tupdesc, c)->attname));
PG_TRY();
{
if (m_memcontext == NULL)
+#if PG_VERSION_NUM < 110000
m_memcontext = AllocSetContextCreate(
CurrentMemoryContext,
"ConverterContext",
@@ -1459,6 +1457,15 @@ Converter::Init()
plv8_fill_type(&m_coltypes[c],
m_tupdesc->attrs[c]->atttypid,
m_memcontext);
+#else
+ m_memcontext = AllocSetContextCreate(
+ CurrentMemoryContext,
+ "ConverterContext",
+ ALLOCSET_DEFAULT_SIZES);
+ plv8_fill_type(&m_coltypes[c],
+ m_tupdesc->attrs[c].atttypid,
+ m_memcontext);
+#endif
}
PG_CATCH();
{
@@ -1480,7 +1487,7 @@ Converter::ToValue(HeapTuple tuple)
Datum datum;
bool isnull;
- if (m_tupdesc->attrs[c]->attisdropped)
+ if (TupleDescAttr(m_tupdesc, c)->attisdropped)
continue;
#if PG_VERSION_NUM >= 90000
@@ -1528,7 +1535,7 @@ Converter::ToDatum(Handle<v8::Value> value, Tuplestore
for (int c = 0; c < m_tupdesc->natts; c++)
{
- if (m_tupdesc->attrs[c]->attisdropped)
+ if (TupleDescAttr(m_tupdesc, c)->attisdropped)
continue;
bool found = false;
@@ -1549,7 +1556,7 @@ Converter::ToDatum(Handle<v8::Value> value, Tuplestore
for (int c = 0; c < m_tupdesc->natts; c++)
{
- if (m_tupdesc->attrs[c]->attisdropped)
+ if (TupleDescAttr(m_tupdesc, c)->attisdropped)
continue;
Handle<v8::Value> attr = m_is_scalar ? value : obj->Get(m_colnames[c]);