Index: databases/postgresql-plruby/files/patch-extconf.rb =================================================================== --- databases/postgresql-plruby/files/patch-extconf.rb (revision 508050) +++ databases/postgresql-plruby/files/patch-extconf.rb (working copy) @@ -1,9 +1,11 @@ ---- extconf.rb.orig 2017-08-31 10:56:23 UTC +--- extconf.rb.orig 2017-05-28 08:47:01 UTC +++ extconf.rb -@@ -122,6 +122,8 @@ end +@@ -122,6 +122,10 @@ end case version_str = `#{pg_config} --version` when /^PostgreSQL ([7-9])\.([0-9]{1,3})(\.[0-9]{1,3})?$/ version = 10 * $1.to_i + $2.to_i ++when /^PostgreSQL 11/ ++ version = 110 +when /^PostgreSQL 10/ + version = 100 else Index: databases/postgresql-plruby/files/patch-src_plpl.c =================================================================== --- databases/postgresql-plruby/files/patch-src_plpl.c (nonexistent) +++ databases/postgresql-plruby/files/patch-src_plpl.c (working copy) @@ -0,0 +1,151 @@ +--- src/plpl.c.orig 2019-08-04 04:35:14 UTC ++++ src/plpl.c +@@ -137,12 +137,21 @@ pl_query_name(VALUE obj) + } + res = rb_ary_new2(tpl->dsc->natts); + for (i = 0; i < tpl->dsc->natts; i++) { ++#if PG_VERSION_NUM < 110000 + if (tpl->dsc->attrs[i]->attisdropped) { + attname = ""; + } + else { + attname = NameStr(tpl->dsc->attrs[i]->attname); + } ++#else ++ if (tpl->dsc->attrs[i].attisdropped) { ++ attname = ""; ++ } ++ else { ++ attname = NameStr(tpl->dsc->attrs[i].attname); ++ } ++#endif + rb_ary_push(res, rb_tainted_str_new2(attname)); + } + return res; +@@ -178,6 +187,7 @@ pl_query_type(VALUE obj) + } + res = rb_ary_new2(tpl->dsc->natts); + for (i = 0; i < tpl->dsc->natts; i++) { ++#if PG_VERSION_NUM < 110000 + if (tpl->dsc->attrs[i]->attisdropped) + continue; + PLRUBY_BEGIN(1); +@@ -189,6 +199,19 @@ pl_query_type(VALUE obj) + rb_raise(pl_ePLruby, "Cache lookup for attribute '%s' type %ld failed", + attname, OidGD(tpl->dsc->attrs[i]->atttypid)); + } ++#else ++ if (tpl->dsc->attrs[i].attisdropped) ++ continue; ++ PLRUBY_BEGIN(1); ++ attname = NameStr(tpl->dsc->attrs[i].attname); ++ typeTup = SearchSysCache(TYPEOID, OidGD(tpl->dsc->attrs[i].atttypid), ++ 0, 0, 0); ++ PLRUBY_END; ++ if (!HeapTupleIsValid(typeTup)) { ++ rb_raise(pl_ePLruby, "Cache lookup for attribute '%s' type %ld failed", ++ attname, OidGD(tpl->dsc->attrs[i].atttypid)); ++ } ++#endif + fpgt = (Form_pg_type) GETSTRUCT(typeTup); + rb_ary_push(res, rb_tainted_str_new2(NameStr(fpgt->typname))); + ReleaseSysCache(typeTup); +@@ -588,14 +611,23 @@ pl_tuple_heap(VALUE c, VALUE tuple) + MEMZERO(nulls, char, RARRAY_LEN(c)); + for (i = 0; i < RARRAY_LEN(c); i++) { + if (NIL_P(RARRAY_PTR(c)[i]) || ++#if PG_VERSION_NUM < 110000 + tupdesc->attrs[i]->attisdropped) { ++#else ++ tupdesc->attrs[i].attisdropped) { ++#endif + dvalues[i] = (Datum)0; + nulls[i] = 'n'; + } + else { + nulls[i] = ' '; ++#if PG_VERSION_NUM < 110000 + typid = tupdesc->attrs[i]->atttypid; + if (tupdesc->attrs[i]->attndims != 0 || ++#else ++ typid = tupdesc->attrs[i].atttypid; ++ if (tupdesc->attrs[i].attndims != 0 || ++#endif + tpl->att->attinfuncs[i].fn_addr == (PGFunction)array_in) { + pl_proc_desc prodesc; + FmgrInfo func; +@@ -1088,6 +1120,7 @@ plruby_build_tuple(HeapTuple tuple, TupleDesc tupdesc, + } + + for (i = 0; i < tupdesc->natts; i++) { ++#if PG_VERSION_NUM < 110000 + if (tupdesc->attrs[i]->attisdropped) + continue; + PLRUBY_BEGIN(1); +@@ -1101,7 +1134,21 @@ plruby_build_tuple(HeapTuple tuple, TupleDesc tupdesc, + rb_raise(pl_ePLruby, "Cache lookup for attribute '%s' type %ld failed", + attname, OidGD(tupdesc->attrs[i]->atttypid)); + } ++#else ++ if (tupdesc->attrs[i].attisdropped) ++ continue; ++ PLRUBY_BEGIN(1); ++ attname = NameStr(tupdesc->attrs[i].attname); ++ attr = heap_getattr(tuple, i + 1, tupdesc, &isnull); ++ typeTup = SearchSysCache(TYPEOID, OidGD(tupdesc->attrs[i].atttypid), ++ 0, 0, 0); ++ PLRUBY_END; + ++ if (!HeapTupleIsValid(typeTup)) { ++ rb_raise(pl_ePLruby, "Cache lookup for attribute '%s' type %ld failed", ++ attname, OidGD(tupdesc->attrs[i].atttypid)); ++ } ++#endif + fpgt = (Form_pg_type) GETSTRUCT(typeTup); + typoutput = (Oid) (fpgt->typoutput); + #if PG_PL_VERSION >= 75 +@@ -1115,6 +1162,7 @@ plruby_build_tuple(HeapTuple tuple, TupleDesc tupdesc, + int alen; + + typname = NameStr(fpgt->typname); ++#if PG_VERSION_NUM < 110000 + alen = tupdesc->attrs[i]->attlen; + typeid = tupdesc->attrs[i]->atttypid; + if (strcmp(typname, "text") == 0) { +@@ -1129,6 +1177,22 @@ plruby_build_tuple(HeapTuple tuple, TupleDesc tupdesc, + alen = tupdesc->attrs[i]->atttypmod - 4; + } + } ++#else ++ alen = tupdesc->attrs[i].attlen; ++ typeid = tupdesc->attrs[i].atttypid; ++ if (strcmp(typname, "text") == 0) { ++ alen = -1; ++ } ++ else if (strcmp(typname, "bpchar") == 0 || ++ strcmp(typname, "varchar") == 0) { ++ if (tupdesc->attrs[i].atttypmod == -1) { ++ alen = 0; ++ } ++ else { ++ alen = tupdesc->attrs[i].atttypmod - 4; ++ } ++ } ++#endif + if ((type_ret & RET_DESC_ARR) == RET_DESC_ARR) { + res = rb_ary_new(); + rb_ary_push(res, rb_tainted_str_new2(attname)); +@@ -1190,8 +1254,13 @@ plruby_build_tuple(HeapTuple tuple, TupleDesc tupdesc, + + fmgr_info(typoutput, &finfo); + ++#if PG_VERSION_NUM < 110000 + s = pl_convert_arg(attr, tupdesc->attrs[i]->atttypid, + &finfo, typelem,tupdesc->attrs[i]->attlen); ++#else ++ s = pl_convert_arg(attr, tupdesc->attrs[i].atttypid, ++ &finfo, typelem,tupdesc->attrs[i].attlen); ++#endif + } + PLRUBY_END_PROTECT; + Property changes on: databases/postgresql-plruby/files/patch-src_plpl.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: databases/postgresql-plruby/files/patch-src_plruby.c =================================================================== --- databases/postgresql-plruby/files/patch-src_plruby.c (nonexistent) +++ databases/postgresql-plruby/files/patch-src_plruby.c (working copy) @@ -0,0 +1,74 @@ +--- src/plruby.c.orig 2019-08-04 04:30:44 UTC ++++ src/plruby.c +@@ -1184,17 +1184,29 @@ for_numvals(obj, argobj) + rb_raise(pl_ePLruby, "invalid attribute '%s'", RSTRING_PTR(key)); + } + attnum -= 1; ++#if PG_VERSION_NUM < 110000 + if (arg->tupdesc->attrs[attnum]->attisdropped) { ++#else ++ if (arg->tupdesc->attrs[attnum].attisdropped) { ++#endif + return Qnil; + } + + PLRUBY_BEGIN(1); + typeTup = SearchSysCache(TYPEOID, ++#if PG_VERSION_NUM < 110000 + OidGD(arg->tupdesc->attrs[attnum]->atttypid), ++#else ++ OidGD(arg->tupdesc->attrs[attnum].atttypid), ++#endif + 0, 0, 0); + if (!HeapTupleIsValid(typeTup)) { + rb_raise(pl_ePLruby, "Cache lookup for attribute '%s' type %ld failed", ++#if PG_VERSION_NUM < 110000 + RSTRING_PTR(key), OidGD(arg->tupdesc->attrs[attnum]->atttypid)); ++#else ++ RSTRING_PTR(key), OidGD(arg->tupdesc->attrs[attnum].atttypid)); ++#endif + } + fpg = (Form_pg_type) GETSTRUCT(typeTup); + ReleaseSysCache(typeTup); +@@ -1226,11 +1238,19 @@ for_numvals(obj, argobj) + else { + arg->modvalues[attnum] = + plruby_to_datum(value, &finfo, ++#if PG_VERSION_NUM < 110000 + arg->tupdesc->attrs[attnum]->atttypid, + fpg->typelem, + (!VARLENA_FIXED_SIZE(arg->tupdesc->attrs[attnum])) + ? arg->tupdesc->attrs[attnum]->attlen + : arg->tupdesc->attrs[attnum]->atttypmod); ++#else ++ arg->tupdesc->attrs[attnum].atttypid, ++ fpg->typelem, ++ (!VARLENA_FIXED_SIZE(arg->tupdesc->attrs[attnum])) ++ ? arg->tupdesc->attrs[attnum].attlen ++ : arg->tupdesc->attrs[attnum].atttypmod); ++#endif + } + return Qnil; + } +@@ -1284,12 +1304,21 @@ pl_trigger_handler(struct pl_thread_st *plth) + + tmp = rb_ary_new2(tupdesc->natts); + for (i = 0; i < tupdesc->natts; i++) { ++#if PG_VERSION_NUM < 110000 + if (tupdesc->attrs[i]->attisdropped) { + rb_ary_push(tmp, rb_str_freeze_new2("")); + } + else { + rb_ary_push(tmp, rb_str_freeze_new2(NameStr(tupdesc->attrs[i]->attname))); + } ++#else ++ if (tupdesc->attrs[i].attisdropped) { ++ rb_ary_push(tmp, rb_str_freeze_new2("")); ++ } ++ else { ++ rb_ary_push(tmp, rb_str_freeze_new2(NameStr(tupdesc->attrs[i].attname))); ++ } ++#endif + } + rb_hash_aset(TG, rb_str_freeze_new2("relatts"), rb_ary_freeze(tmp)); + Property changes on: databases/postgresql-plruby/files/patch-src_plruby.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property