Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package pgsql-ogr-fdw for openSUSE:Factory checked in at 2026-05-04 14:58:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pgsql-ogr-fdw (Old) and /work/SRC/openSUSE:Factory/.pgsql-ogr-fdw.new.30200 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pgsql-ogr-fdw" Mon May 4 14:58:35 2026 rev:11 rq:1350665 version:1.1.7 Changes: -------- --- /work/SRC/openSUSE:Factory/pgsql-ogr-fdw/pgsql-ogr-fdw.changes 2025-02-17 20:57:47.912659087 +0100 +++ /work/SRC/openSUSE:Factory/.pgsql-ogr-fdw.new.30200/pgsql-ogr-fdw.changes 2026-05-04 14:58:37.635218926 +0200 @@ -1,0 +2,11 @@ +Mon May 4 11:24:44 UTC 2026 - Dirk Stoecker <[email protected]> + +- update to 1.1.7 + * PostgreSQL 18 support + +- 1.1.6: + * Fix rare case where materialized view creation crashes the server. + +- Add build for postgresql18. + +------------------------------------------------------------------- Old: ---- pgsql-ogr-fdw-1.1.5.tar.gz New: ---- pgsql-ogr-fdw-1.1.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pgsql-ogr-fdw.spec ++++++ --- /var/tmp/diff_new_pack.c2VSja/_old 2026-05-04 14:58:38.263244692 +0200 +++ /var/tmp/diff_new_pack.c2VSja/_new 2026-05-04 14:58:38.263244692 +0200 @@ -1,7 +1,7 @@ # # spec file for package pgsql-ogr-fdw # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ %{pg_version_from_name} Name: %{pg_name}-%{ext_name} -Version: 1.1.5 +Version: 1.1.7 Release: 0 Summary: PostgreSQL OGR Foreign Data Wrapper License: MIT ++++++ _multibuild ++++++ --- /var/tmp/diff_new_pack.c2VSja/_old 2026-05-04 14:58:38.299246169 +0200 +++ /var/tmp/diff_new_pack.c2VSja/_new 2026-05-04 14:58:38.303246333 +0200 @@ -4,5 +4,6 @@ <package>postgresql15</package> <package>postgresql16</package> <package>postgresql17</package> + <package>postgresql18</package> </multibuild> ++++++ pgsql-ogr-fdw-1.1.5.tar.gz -> pgsql-ogr-fdw-1.1.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/.github/workflows/ci.yml new/pgsql-ogr-fdw-1.1.7/.github/workflows/ci.yml --- old/pgsql-ogr-fdw-1.1.5/.github/workflows/ci.yml 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/.github/workflows/ci.yml 2025-05-20 19:06:38.000000000 +0200 @@ -16,6 +16,8 @@ fail-fast: false matrix: ci: + - { PGVER: 11 } + - { PGVER: 12 } - { PGVER: 13 } - { PGVER: 14 } - { PGVER: 15 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/Makefile new/pgsql-ogr-fdw-1.1.7/Makefile --- old/pgsql-ogr-fdw-1.1.5/Makefile 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/Makefile 2025-05-20 19:06:38.000000000 +0200 @@ -20,7 +20,10 @@ GDAL_CONFIG = gdal-config GDAL_CFLAGS = $(shell $(GDAL_CONFIG) --cflags) -GDAL_LIBS = $(shell $(GDAL_CONFIG) --libs) +GDAL_LIBS = $(shell $(GDAL_CONFIG) --libs) + +# For MacOS +# GDAL_LIBS += -rpath $(shell $(GDAL_CONFIG) --prefix)/lib PG_CONFIG = pg_config REGRESS_OPTS = --encoding=UTF8 @@ -28,8 +31,6 @@ PG_CPPFLAGS += $(GDAL_CFLAGS) LIBS += $(GDAL_LIBS) SHLIB_LINK := $(LIBS) -# For MacOS -#SHLIB_LINK += -rpath /usr/local/lib PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/README.md new/pgsql-ogr-fdw-1.1.7/README.md --- old/pgsql-ogr-fdw-1.1.5/README.md 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/README.md 2025-05-20 19:06:38.000000000 +0200 @@ -10,7 +10,7 @@ This implementation currently has the following limitations: -* **PostgreSQL 9.3 or higher.** This wrapper does not support the FDW implementations in older versions of PostgreSQL. +* **PostgreSQL 11 or higher.** * **Limited non-spatial query restrictions are pushed down to OGR.** OGR only supports a [minimal set](https://gdal.org/user/ogr_sql_dialect.html) of SQL operators (>, <, <=, >=, =). * **Only bounding box filters (&&) are pushed down.** Spatial filtering is possible, but only bounding boxes, and only using the && operator. * **OGR connections every time** Rather than pooling OGR connections, each query makes (and disposes of) **two** new ones, which seems to be the largest performance drag at the moment for restricted (small) queries. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/data/pt_two.prj new/pgsql-ogr-fdw-1.1.7/data/pt_two.prj --- old/pgsql-ogr-fdw-1.1.5/data/pt_two.prj 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/data/pt_two.prj 2025-05-20 19:06:38.000000000 +0200 @@ -1 +1 @@ -GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295], AUTH["EPSG",4326]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/ogr_fdw.c new/pgsql-ogr-fdw-1.1.7/ogr_fdw.c --- old/pgsql-ogr-fdw-1.1.5/ogr_fdw.c 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/ogr_fdw.c 2025-05-20 19:06:38.000000000 +0200 @@ -39,6 +39,7 @@ */ #include "ogr_fdw.h" + PG_MODULE_MAGIC; /* @@ -183,7 +184,7 @@ #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,1,0) -const char* const gdalErrorTypes[] = +static const char* const gdalErrorTypes[] = { "None", "AppDefined", @@ -264,27 +265,112 @@ } /* - * Function to get the geometry OID if required + * Given extension oid, lookup installation namespace oid. + * This side steps search_path issues with + * TypenameGetTypid encountered in + * https://github.com/pramsey/pgsql-ogr-fdw/issues/263 + */ +static Oid +get_extension_nsp_oid(Oid extOid) +{ + Oid result; + SysScanDesc scandesc; + HeapTuple tuple; + ScanKeyData entry[1]; + +#if PG_VERSION_NUM < 120000 + Relation rel = heap_open(ExtensionRelationId, AccessShareLock); + ScanKeyInit(&entry[0], + ObjectIdAttributeNumber, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(extOid)); +#else + Relation rel = table_open(ExtensionRelationId, AccessShareLock); + ScanKeyInit(&entry[0], + Anum_pg_extension_oid, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(extOid)); +#endif /* PG_VERSION_NUM */ + + scandesc = systable_beginscan(rel, ExtensionOidIndexId, true, + NULL, 1, entry); + + tuple = systable_getnext(scandesc); + + /* We assume that there can be at most one matching tuple */ + if (HeapTupleIsValid(tuple)) + result = ((Form_pg_extension) GETSTRUCT(tuple))->extnamespace; + else + result = InvalidOid; + + systable_endscan(scandesc); + +#if PG_VERSION_NUM < 120000 + heap_close(rel, AccessShareLock); +#else + table_close(rel, AccessShareLock); +#endif + + return result; +} + + +/* + * Get the geometry OID (if postgis is + * installed) and cache it for quick lookup. */ Oid ogrGetGeometryOid(void) { + /* Is value not set yet? */ if (GEOMETRYOID == InvalidOid) { - Oid typoid = TypenameGetTypid("geometry"); - if (OidIsValid(typoid) && get_typisdefined(typoid)) + const char *extName = "postgis"; + const char *typName = "geometry"; + bool missing_ok = true; + Oid extOid, extNspOid, typOid; + + /* Got postgis extension? */ + extOid = get_extension_oid(extName, missing_ok); + if (!OidIsValid(extOid)) { - GEOMETRYOID = typoid; + elog(DEBUG2, "%s: lookup of extension '%s' failed", __func__, extName); + GEOMETRYOID = BYTEAOID; + return GEOMETRYOID; } - else + + /* Got namespace for extension? */ + extNspOid = get_extension_nsp_oid(extOid); + if (!OidIsValid(extNspOid)) { + elog(DEBUG2, "%s: lookup of namespace for '%s' (%u) failed", __func__, extName, extOid); GEOMETRYOID = BYTEAOID; + return GEOMETRYOID; } + + /* Got geometry type in namespace? */ + typOid = GetSysCacheOid2(TYPENAMENSP, +#if PG_VERSION_NUM >= 120000 + Anum_pg_type_oid, +#endif + PointerGetDatum(typName), + ObjectIdGetDatum(extNspOid)); + + + + elog(DEBUG2, "%s: lookup of type id for '%s' got %u", __func__, typName, typOid); + + /* Geometry type is good? */ + if (OidIsValid(typOid) && get_typisdefined(typOid)) + GEOMETRYOID = typOid; + else + GEOMETRYOID = BYTEAOID; } return GEOMETRYOID; } + /* * Foreign-data wrapper handler function: return a struct with pointers * to my callback routines. @@ -949,6 +1035,9 @@ NULL, /* PathTarget */ #endif baserel->rows, +#if PG_VERSION_NUM >= 180000 + 0, /* disabled_nodes */ +#endif planstate->startup_cost, planstate->total_cost, NIL, /* no pathkeys */ @@ -964,7 +1053,6 @@ ); /* no fdw_private data */ } - /* * Convert an OgrFdwSpatialFilter into a List so it can * be safely passed through the fdw_private list. @@ -1179,7 +1267,7 @@ {OFTInteger, {BOOLOID, INT4OID, INT8OID, NUMERICOID, FLOAT4OID, FLOAT8OID, TEXTOID, VARCHAROID, 0}}, {OFTReal, {NUMERICOID, FLOAT4OID, FLOAT8OID, TEXTOID, VARCHAROID, 0}}, {OFTBinary, {BYTEAOID, 0}}, - {OFTString, {TEXTOID, VARCHAROID, CHAROID, BPCHAROID, 0}}, + {OFTString, {TEXTOID, VARCHAROID, CHAROID, BPCHAROID, JSONBOID, JSONOID, 0}}, {OFTDate, {DATEOID, TIMESTAMPOID, TEXTOID, VARCHAROID, 0}}, {OFTTime, {TIMEOID, TEXTOID, VARCHAROID, 0}}, {OFTDateTime, {TIMESTAMPOID, TEXTOID, VARCHAROID, 0}}, @@ -1381,11 +1469,8 @@ OgrFieldEntry* found_entry; OgrFieldEntry entry; -#if PG_VERSION_NUM >= 110000 - Form_pg_attribute att_tuple = &tupdesc->attrs[i]; -#else - Form_pg_attribute att_tuple = tupdesc->attrs[i]; -#endif + Form_pg_attribute att_tuple = TupleDescAttr(tupdesc, i); + OgrFdwColumn col = tbl->cols[i]; col.pgattnum = att_tuple->attnum; col.pgtype = att_tuple->atttypid; @@ -1517,57 +1602,77 @@ return; } + /* * ogrLookupGeometryFunctionOid * * Find the procedure Oids of useful functions so we can call - * them later. + * them later. In the case where multiple functions have the + * same signature, in different namespaces (???) we might have + * problems, but that seems very unlikely. + * + * https://github.com/pramsey/pgsql-ogr-fdw/issues/266 */ static Oid ogrLookupGeometryFunctionOid(const char* proname) { - List* names; - FuncCandidateList clist; + CatCList *clist; + int i; + Oid result = InvalidOid; /* This only works if PostGIS is installed */ - if (ogrGetGeometryOid() == InvalidOid || ogrGetGeometryOid() == BYTEAOID) + if (ogrGetGeometryOid() == InvalidOid || + ogrGetGeometryOid() == BYTEAOID) { - return InvalidOid; + return result; } -#if PG_VERSION_NUM < 160000 - names = stringToQualifiedNameList(proname); -#else - names = stringToQualifiedNameList(proname,NULL); -#endif -#if PG_VERSION_NUM < 90400 - clist = FuncnameGetCandidates(names, -1, NIL, false, false); -#elif PG_VERSION_NUM < 140000 - clist = FuncnameGetCandidates(names, -1, NIL, false, false, false); + if (!proname) return result; + + /* Search syscache by name only */ + clist = SearchSysCacheList1(PROCNAMEARGSNSP, + CStringGetDatum(proname)); + + if (!clist) return InvalidOid; + + for (i = 0; i < clist->n_members; i++) + { + HeapTuple proctup = &clist->members[i]->tuple; + Form_pg_proc procform = (Form_pg_proc) GETSTRUCT(proctup); + Oid *proargtypes = procform->proargtypes.values; + int pronargs = procform->pronargs; + +#if PG_VERSION_NUM >= 120000 + Oid procoid = procform->oid; #else - clist = FuncnameGetCandidates(names, -1, NIL, false, false, false, false); + Oid procoid = HeapTupleGetOid(proctup); #endif - if (streq(proname, "st_setsrid")) - { - do + + /* ST_SetSRID(geometry, integer) */ + if (streq(proname, "st_setsrid") && + pronargs == 2 && + proargtypes[0] == ogrGetGeometryOid()) { - int i; - for (i = 0; i < clist->nargs; i++) - { - if (clist->args[i] == ogrGetGeometryOid()) - { - return clist->oid; - } - } + result = procoid; + break; + } + /* postgis_typmod_srid(typmod) */ + else if (streq(proname, "postgis_typmod_srid") && + pronargs == 1) + { + /* postgis_typmod_srid(integer) */ + result = procoid; + break; + } + else + { + elog(ERROR, "%s could not find function '%s'", + __func__, proname); } - while ((clist = clist->next)); - } - else if (streq(proname, "postgis_typmod_srid")) - { - return clist->oid; } - return InvalidOid; + ReleaseSysCacheList(clist); + return result; } /* @@ -1979,7 +2084,7 @@ for (uint32 i = 0; i < ilist_size; i++) { bool is_null = false; - snprintf(cstr, CSTR_SZ, "%ld", ilist[i]); + snprintf(cstr, CSTR_SZ, OGR_FDW_FRMT_INT64, OGR_FDW_CAST_INT64(ilist[i])); abs = accumArrayResult(abs, pgDatumFromCString(cstr, &col, execstate->ogr.char_encoding, &is_null), is_null, @@ -2587,13 +2692,10 @@ int i; for (i = 0; i < td->natts; i++) { -#if PG_VERSION_NUM >= 110000 - NameData attname = td->attrs[i].attname; - Oid atttypeid = td->attrs[i].atttypid; -#else - NameData attname = td->attrs[i]->attname; - Oid atttypeid = td->attrs[i]->atttypid; -#endif + Form_pg_attribute att_tuple = TupleDescAttr(td, i); + NameData attname = att_tuple->attname; + Oid atttypeid = att_tuple->atttypid; + if ((atttypeid == INT4OID || atttypeid == INT8OID) && strcaseeq("fid", attname.data)) { @@ -2633,7 +2735,8 @@ elog(ERROR, "table '%s' does not have a 'fid' column", RelationGetRelationName(target_relation)); } - att = &tupdesc->attrs[fid_column]; + att = TupleDescAttr(tupdesc, fid_column); + /* Make a Var representing the desired value */ var = makeVar(parsetree->resultRelation, att->attnum, @@ -2745,6 +2848,7 @@ int64 fid; OGRFeatureH feat; OGRErr err; + Form_pg_attribute attrs; elog(DEBUG3, "%s: entered function", __func__); @@ -2761,11 +2865,9 @@ /* What is the value of the FID for this record? */ fid_datum = slot->tts_values[fid_column]; -#if PG_VERSION_NUM >= 110000 - fid_type = td->attrs[fid_column].atttypid; -#else - fid_type = td->attrs[fid_column]->atttypid; -#endif + attrs = TupleDescAttr(td, fid_column); + fid_type = attrs->atttypid; + if (fid_type == INT8OID) { fid = DatumGetInt64(fid_datum); @@ -2982,6 +3084,7 @@ Datum fid_datum; int64 fid; OGRErr err; + Form_pg_attribute attrs; elog(DEBUG3, "%s: entered function", __func__); @@ -2998,11 +3101,8 @@ /* What is the value of the FID for this record? */ fid_datum = planSlot->tts_values[fid_column]; -#if PG_VERSION_NUM >= 110000 - fid_type = td->attrs[fid_column].atttypid; -#else - fid_type = td->attrs[fid_column]->atttypid; -#endif + attrs = TupleDescAttr(td, fid_column); + fid_type = attrs->atttypid; if (fid_type == INT8OID) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/ogr_fdw.h new/pgsql-ogr-fdw-1.1.7/ogr_fdw.h --- old/pgsql-ogr-fdw-1.1.5/ogr_fdw.h 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/ogr_fdw.h 2025-05-20 19:06:38.000000000 +0200 @@ -22,8 +22,11 @@ #include "access/reloptions.h" #include "access/sysattr.h" #include "access/transam.h" +#include "access/tupdesc.h" +#include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/pg_collation.h" +#include "catalog/pg_extension.h" #include "catalog/pg_foreign_table.h" #include "catalog/pg_foreign_server.h" #include "catalog/pg_namespace.h" @@ -33,6 +36,7 @@ #include "commands/copy.h" #include "commands/defrem.h" #include "commands/explain.h" +#include "commands/extension.h" #include "commands/vacuum.h" #include "foreign/fdwapi.h" #include "foreign/foreign.h" @@ -48,7 +52,9 @@ #include "parser/parsetree.h" #include "storage/ipc.h" #include "utils/builtins.h" +#include "utils/catcache.h" #include "utils/date.h" +#include "utils/fmgroids.h" #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/numeric.h" @@ -80,6 +86,8 @@ /* hexwkb is not. */ #define OGR_FDW_HEXWKB TRUE +extern Oid GEOMETRYOID; + typedef enum { OGR_UNMATCHED, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/ogr_fdw_common.c new/pgsql-ogr-fdw-1.1.7/ogr_fdw_common.c --- old/pgsql-ogr-fdw-1.1.5/ogr_fdw_common.c 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/ogr_fdw_common.c 2025-05-20 19:06:38.000000000 +0200 @@ -13,6 +13,7 @@ #include "stringbuffer.h" #include "pg_config_manual.h" + /* Prototype for function that must be defined in PostgreSQL (it is) */ /* and in ogr_fdw_info (it is) */ const char * quote_identifier(const char *ident); @@ -91,11 +92,15 @@ ogrTypeToPgType(OGRFieldDefnH ogr_fld, char *pgtype, size_t width) { OGRFieldType ogr_type = OGR_Fld_GetType(ogr_fld); +#if GDAL_VERSION_MAJOR >= 2 + OGRFieldSubType ogr_subtype = OGR_Fld_GetSubType(ogr_fld); +#endif + switch(ogr_type) { case OFTInteger: #if GDAL_VERSION_MAJOR >= 2 - if( OGR_Fld_GetSubType(ogr_fld) == OFSTBoolean ) + if (ogr_subtype == OFSTBoolean) { snprintf(pgtype, width, "boolean"); break; @@ -109,8 +114,18 @@ break; case OFTString: { - int ogr_fld_width = OGR_Fld_GetWidth(ogr_fld); - if (ogr_fld_width > 0) + int ogr_fld_width; +#if GDAL_VERSION_MAJOR >= 2 + if (ogr_subtype == OFSTJSON) + { + snprintf(pgtype, width, "jsonb"); + break; + } +#endif + ogr_fld_width = OGR_Fld_GetWidth(ogr_fld); + + /* MaxAttrSize = 10*1024*1024 */ + if (ogr_fld_width > 0 && ogr_fld_width < 10*1024*1024) snprintf(pgtype, width, "varchar(%d)", ogr_fld_width); else snprintf(pgtype, width, "varchar"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pgsql-ogr-fdw-1.1.5/ogr_fdw_info.c new/pgsql-ogr-fdw-1.1.7/ogr_fdw_info.c --- old/pgsql-ogr-fdw-1.1.5/ogr_fdw_info.c 2024-06-27 21:03:22.000000000 +0200 +++ new/pgsql-ogr-fdw-1.1.7/ogr_fdw_info.c 2025-05-20 19:06:38.000000000 +0200 @@ -59,7 +59,7 @@ /* in the ogr_fdw_common module works */ const char* quote_identifier(const char* ident); -char identifier[NAMEDATALEN+3]; +static char identifier[NAMEDATALEN+3]; const char* quote_identifier(const char* ident) @@ -76,7 +76,8 @@ } return identifier; } -char config_options[STR_MAX_LEN] = {0}; + +static char config_options[STR_MAX_LEN] = {0}; static void
