[Git][debian-gis-team/pgsql-ogr-fdw][master] 3 commits: New upstream version 1.1.2

Christoph Berg (@myon) gitlab at salsa.debian.org
Fri Jul 29 21:03:29 BST 2022



Christoph Berg pushed to branch master at Debian GIS Project / pgsql-ogr-fdw


Commits:
2428c85d by Christoph Berg at 2022-07-29T21:56:57+02:00
New upstream version 1.1.2
- - - - -
2aea16b6 by Christoph Berg at 2022-07-29T21:56:57+02:00
Update upstream source from tag 'upstream/1.1.2'

Update to upstream version '1.1.2'
with Debian dir 411d290d77859cd09b8228bbfc682f697e555d03
- - - - -
9e17f934 by Christoph Berg at 2022-07-29T22:03:11+02:00
New upstream version 1.1.2.

- - - - -


12 changed files:

- + .github/workflows/ci.yml
- − .travis.yml
- README.md
- debian/changelog
- − debian/patches/pgsql-test.patch
- debian/patches/series
- ogr_fdw.c
- ogr_fdw.h
- ogr_fdw_common.c
- ogr_fdw_func.c
- ogr_fdw_info.c
- stringbuffer.c


Changes:

=====================================
.github/workflows/ci.yml
=====================================
@@ -0,0 +1,54 @@
+# GitHub Actions for OGR-FDW
+#
+# Paul Ramsey <pramsey at cleverelephant dot ca>
+
+name: "CI"
+on:
+  push:
+    branches-ignore:
+      - 'master'
+  pull_request: ~
+
+jobs:
+  linux:
+    runs-on: ubuntu-latest
+
+    env:
+      PGVER: 14
+
+    steps:
+
+    - name: 'Check Out'
+      uses: actions/checkout at v2
+
+    - name: 'Install GDAL'
+      run: |
+        sudo add-apt-repository ppa:ubuntugis/ppa
+        sudo apt-get update
+        sudo apt-get install libgdal-dev
+
+    - name: 'Install PostgreSQL'
+      run: |
+        sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+        wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+        sudo apt-get update
+        sudo apt-get -y install postgresql-$PGVER postgresql-server-dev-$PGVER
+
+    - name: 'Start PostgreSQL'
+      run: |
+        export PGDATA=/var/lib/postgresql/$PGVER/main
+        export PGETC=/etc/postgresql/$PGVER/main
+        export PGBIN=/usr/lib/postgresql/$PGVER/bin
+        # sudo su postgres -c "$PGBIN/pg_ctl --pgdata $PGDATA stop"
+        # sudo $PGBIN/pg_ctlcluster $PGVER main stop
+        sudo cp ./ci/pg_hba.conf $PGETC/pg_hba.conf
+        sudo su postgres -c "$PGBIN/pg_ctl --pgdata $PGDATA start -o '-c config_file=$PGETC/postgresql.conf -p 5432'"
+
+    - name: 'Build & Test'
+      run: |
+        export PATH=/usr/lib/postgresql/$PGVER/bin/:$PATH
+        make
+        sudo make install
+        PGUSER=postgres make installcheck || (cat regression.diffs && /bin/false)
+
+


=====================================
.travis.yml deleted
=====================================
@@ -1,52 +0,0 @@
-dist: xenial
-sudo: required
-language: cpp
-compiler: gcc
-
-addons:
-  apt:
-    packages:
-    - curl
-    - libcurl4-gnutls-dev
-    - ca-certificates
-    - software-properties-common
-    - python-software-properties
-    - gnupg-curl
-
-env:
-  - PG_VERSION=9.6 GDAL_VERSION=1.11
-  - PG_VERSION=9.6 GDAL_VERSION=2.2.4
-  - PG_VERSION=10 GDAL_VERSION=2.3.3
-  - PG_VERSION=11 GDAL_VERSION=2.4.4
-  - PG_VERSION=12 GDAL_VERSION=2.4.4
-
-before_script:
-  - sudo /etc/init.d/postgresql stop
-  - sudo apt-get -y --purge remove postgresql-9.1
-  - sudo apt-get -y --purge remove postgresql-9.2
-  - sudo apt-get -y --purge remove postgresql-9.3
-  - sudo apt-get -y --purge remove postgresql-9.4
-  - sudo apt-get -y --purge remove postgresql-9.5
-  - sudo apt-get -y --purge remove postgresql-9.6
-  - sudo apt-get -y --purge remove postgresql-10
-  - sudo apt-get -y --purge remove postgresql-11
-  - sudo apt-get -y --purge remove postgresql-common
-  - sudo apt-get -y autoremove
-  - sudo rm -rf /var/lib/postgresql
-  - apt-key adv --fetch-keys https://www.postgresql.org/media/keys/ACCC4CF8.asc
-  - sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main $PG_VERSION"
-  - sudo apt-get update -qq
-  - sudo apt-get -y install postgresql-$PG_VERSION postgresql-server-dev-$PG_VERSION
-  - sudo cp ci/pg_hba.conf /etc/postgresql/$PG_VERSION/main/pg_hba.conf
-  - sudo /etc/init.d/postgresql reload
-
-  - if [[ $GDAL_VERSION == 1* ]]; then sudo apt-get install libgdal1i libgdal-dev; fi
-  - if [[ $GDAL_VERSION == 2* ]]; then bash ci/gdal_build.sh $GDAL_VERSION; fi
-  - if [[ $GDAL_VERSION == 3* ]]; then bash ci/gdal_build.sh $GDAL_VERSION; fi
-  # needs proj6
-
-
-script:
-  - make && sudo make install && sudo chmod 755 $HOME && (PGUSER=postgres make installcheck || (cat regression.diffs && /bin/false))
-
-


=====================================
README.md
=====================================
@@ -1,4 +1,4 @@
-Travis: [![Build Status](https://secure.travis-ci.org/pramsey/pgsql-ogr-fdw.png)](http://travis-ci.org/pramsey/pgsql-ogr-fdw)
+[![Build Status](https://github.com/pramsey/pgsql-ogr-fdw/actions/workflows/ci.yml/badge.svg)](https://github.com/pramsey/pgsql-ogr-fdw/actions/workflows/ci.yml)
 
 # PostgreSQL OGR Foreign Data Wrapper
 
@@ -18,11 +18,11 @@ This implementation currently has the following limitations:
 
 ## Download
 * Windows
-  * Via [Stackbuilder](https://www.postgresql.org/download/windows/) (part of PostGIS Bundle)
+	* Via [Stackbuilder](https://www.postgresql.org/download/windows/) (part of PostGIS Bundle)
 * Linux
   * [Arch Linux](https://aur.archlinux.org/packages/pgsql-ogr-fdw/)
-  * [Ubuntu](https://launchpad.net/ubuntu/+source/pgsql-ogr-fdw)
-  * [Red Hat](https://yum.postgresql.org/)
+  * [Ubuntu](https://launchpad.net/ubuntu/+source/pgsql-ogr-fdw), [PGDG Apt: Debian / Ubuntu](https://apt.postgresql.org)
+  * [PGDG Yum: Redhat EL, CentOS, Rocky](https://yum.postgresql.org/)
 * OSX
 
 ## Basic Operation
@@ -46,39 +46,39 @@ Use the `ogr_fdw_info` tool to read an OGR data source and output a server and t
 # ogr_fdw_info -f
 
 Supported Formats:
-  -> "PCIDSK" (read/write)
-  -> "netCDF" (read/write)
-  ...
-  -> "HTTP" (readonly)
+	-> "PCIDSK" (read/write)
+	-> "netCDF" (read/write)
+	...
+	-> "HTTP" (readonly)
 
 # ogr_fdw_info -s /tmp/test
 
 Layers:
-  pt_two
+	pt_two
 
 # ogr_fdw_info -s /tmp/test -l pt_two
 
 CREATE SERVER "myserver"
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource '/tmp/test',
-    format 'ESRI Shapefile' );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource '/tmp/test',
+		format 'ESRI Shapefile' );
 
 CREATE FOREIGN TABLE "pt_two" (
-  fid integer,
-  "geom" geometry(Point, 4326),
-  "name" varchar,
-  "age" integer,
-  "height" real,
-  "birthdate" date )
-  SERVER "myserver"
-  OPTIONS (layer 'pt_two');
+	fid integer,
+	"geom" geometry(Point, 4326),
+	"name" varchar,
+	"age" integer,
+	"height" real,
+	"birthdate" date )
+	SERVER "myserver"
+	OPTIONS (layer 'pt_two');
 ```
 
 Copy the `CREATE SERVER` and `CREATE FOREIGN SERVER` SQL commands into the database and you'll have your foreign table definition.
 ```
-             Foreign table "public.pt_two"
-  Column  |       Type        | Modifiers | FDW Options
+						 Foreign table "public.pt_two"
+	Column  |       Type        | Modifiers | FDW Options
 ----------+-------------------+-----------+-------------
  fid      | integer           |           |
  geom     | geometry          |           |
@@ -98,8 +98,8 @@ SELECT * FROM pt_two;
 ```
  fid |                    geom                    | name  | age | height |  birthday
 -----+--------------------------------------------+-------+-----+--------+------------
-   0 | 0101000000C00497D1162CB93F8CBAEF08A080E63F | Peter |  45 |    5.6 | 1965-04-12
-   1 | 010100000054E943ACD697E2BFC0895EE54A46CF3F | Paul  |  33 |   5.84 | 1971-03-25
+	 0 | 0101000000C00497D1162CB93F8CBAEF08A080E63F | Peter |  45 |    5.6 | 1965-04-12
+	 1 | 010100000054E943ACD697E2BFC0895EE54A46CF3F | Paul  |  33 |   5.84 | 1971-03-25
 ```
 
 You can also apply filters, and see the portions that will be pushed down to the OGR driver, by setting the debug level to `DEBUG1`.
@@ -132,40 +132,40 @@ CREATE EXTENSION postgis;
 CREATE EXTENSION ogr_fdw;
 
 CREATE SERVER geoserver
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource 'WFS:https://demo.geo-solutions.it/geoserver/wfs',
-    format 'WFS' );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource 'WFS:https://demo.geo-solutions.it/geoserver/wfs',
+		format 'WFS' );
 
 CREATE FOREIGN TABLE topp_states (
-  fid bigint,
-  the_geom Geometry(MultiSurface,4326),
-  gml_id varchar,
-  state_name varchar,
-  state_fips varchar,
-  sub_region varchar,
-  state_abbr varchar,
-  land_km double precision,
-  water_km double precision,
-  persons double precision,
-  families double precision,
-  houshold double precision,
-  male double precision,
-  female double precision,
-  workers double precision,
-  drvalone double precision,
-  carpool double precision,
-  pubtrans double precision,
-  employed double precision,
-  unemploy double precision,
-  service double precision,
-  manual double precision,
-  p_male double precision,
-  p_female double precision,
-  samp_pop double precision
-  )
-  SERVER "geoserver"
-  OPTIONS (layer 'topp:states');
+	fid bigint,
+	the_geom Geometry(MultiSurface,4326),
+	gml_id varchar,
+	state_name varchar,
+	state_fips varchar,
+	sub_region varchar,
+	state_abbr varchar,
+	land_km double precision,
+	water_km double precision,
+	persons double precision,
+	families double precision,
+	houshold double precision,
+	male double precision,
+	female double precision,
+	workers double precision,
+	drvalone double precision,
+	carpool double precision,
+	pubtrans double precision,
+	employed double precision,
+	unemploy double precision,
+	service double precision,
+	manual double precision,
+	p_male double precision,
+	p_female double precision,
+	samp_pop double precision
+	)
+	SERVER "geoserver"
+	OPTIONS (layer 'topp:states');
 ```
 
 ### FGDB FDW
@@ -173,27 +173,27 @@ CREATE FOREIGN TABLE topp_states (
 Unzip the `Querying.zip` file from the `data` directory to get a `Querying.gdb` file, and put it somewhere public (like `/tmp`). Now run the `ogr_fdw_info` tool on it to get a table definition.
 ```sql
 CREATE SERVER fgdbtest
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource '/tmp/Querying.gdb',
-    format 'OpenFileGDB' );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource '/tmp/Querying.gdb',
+		format 'OpenFileGDB' );
 
 CREATE FOREIGN TABLE cities (
-  fid integer,
-  geom geometry(Point, 4326),
-  city_fips varchar,
-  city_name varchar,
-  state_fips varchar,
-  state_name varchar,
-  state_city varchar,
-  type varchar,
-  capital varchar,
-  elevation integer,
-  pop1990 integer,
-  popcat integer
-  )
-  SERVER fgdbtest
-  OPTIONS (layer 'Cities');
+	fid integer,
+	geom geometry(Point, 4326),
+	city_fips varchar,
+	city_name varchar,
+	state_fips varchar,
+	state_name varchar,
+	state_city varchar,
+	type varchar,
+	capital varchar,
+	elevation integer,
+	pop1990 integer,
+	popcat integer
+	)
+	SERVER fgdbtest
+	OPTIONS (layer 'Cities');
 ```
 Query away!
 
@@ -204,48 +204,48 @@ This is only for testing, for best performance you should use postgres_fdw forei
 
 ```sql
 CREATE TABLE apostles (
-  fid serial primary key,
-  geom geometry(Point, 4326),
-  joined integer,
-  name text,
-  height real,
-  born date,
-  clock time,
-  ts timestamp
+	fid serial primary key,
+	geom geometry(Point, 4326),
+	joined integer,
+	name text,
+	height real,
+	born date,
+	clock time,
+	ts timestamp
 );
 
 INSERT INTO apostles (name, geom, joined, height, born, clock, ts) VALUES
-  ('Peter', 'SRID=4326;POINT(30.31 59.93)', 1, 1.6, '1912-01-10', '10:10:01', '1912-01-10 10:10:01'),
-  ('Andrew', 'SRID=4326;POINT(-2.8 56.34)', 2, 1.8, '1911-02-11', '10:10:02', '1911-02-11 10:10:02'),
-  ('James', 'SRID=4326;POINT(-79.23 42.1)', 3, 1.72, '1910-03-12', '10:10:03', '1910-03-12 10:10:03'),
-  ('John', 'SRID=4326;POINT(13.2 47.35)', 4, 1.45, '1909-04-01', '10:10:04', '1909-04-01 10:10:04'),
-  ('Philip', 'SRID=4326;POINT(-75.19 40.69)', 5, 1.65, '1908-05-02', '10:10:05', '1908-05-02 10:10:05'),
-  ('Bartholomew', 'SRID=4326;POINT(-62 18)', 6, 1.69, '1907-06-03', '10:10:06', '1907-06-03 10:10:06'),
-  ('Thomas', 'SRID=4326;POINT(-80.08 35.88)', 7, 1.68, '1906-07-04', '10:10:07', '1906-07-04 10:10:07'),
-  ('Matthew', 'SRID=4326;POINT(-73.67 20.94)', 8, 1.65, '1905-08-05', '10:10:08', '1905-08-05 10:10:08'),
-  ('James Alpheus', 'SRID=4326;POINT(-84.29 34.07)', 9, 1.78, '1904-09-06', '10:10:09', '1904-09-06 10:10:09'),
-  ('Thaddaeus', 'SRID=4326;POINT(79.13 10.78)', 10, 1.88, '1903-10-07', '10:10:10', '1903-10-07 10:10:10'),
-  ('Simon', 'SRID=4326;POINT(-85.97 41.75)', 11, 1.61, '1902-11-08', '10:10:11', '1902-11-08 10:10:11'),
-  ('Judas Iscariot', 'SRID=4326;POINT(35.7 32.4)', 12, 1.71, '1901-12-09', '10:10:12', '1901-12-09 10:10:12');
+	('Peter', 'SRID=4326;POINT(30.31 59.93)', 1, 1.6, '1912-01-10', '10:10:01', '1912-01-10 10:10:01'),
+	('Andrew', 'SRID=4326;POINT(-2.8 56.34)', 2, 1.8, '1911-02-11', '10:10:02', '1911-02-11 10:10:02'),
+	('James', 'SRID=4326;POINT(-79.23 42.1)', 3, 1.72, '1910-03-12', '10:10:03', '1910-03-12 10:10:03'),
+	('John', 'SRID=4326;POINT(13.2 47.35)', 4, 1.45, '1909-04-01', '10:10:04', '1909-04-01 10:10:04'),
+	('Philip', 'SRID=4326;POINT(-75.19 40.69)', 5, 1.65, '1908-05-02', '10:10:05', '1908-05-02 10:10:05'),
+	('Bartholomew', 'SRID=4326;POINT(-62 18)', 6, 1.69, '1907-06-03', '10:10:06', '1907-06-03 10:10:06'),
+	('Thomas', 'SRID=4326;POINT(-80.08 35.88)', 7, 1.68, '1906-07-04', '10:10:07', '1906-07-04 10:10:07'),
+	('Matthew', 'SRID=4326;POINT(-73.67 20.94)', 8, 1.65, '1905-08-05', '10:10:08', '1905-08-05 10:10:08'),
+	('James Alpheus', 'SRID=4326;POINT(-84.29 34.07)', 9, 1.78, '1904-09-06', '10:10:09', '1904-09-06 10:10:09'),
+	('Thaddaeus', 'SRID=4326;POINT(79.13 10.78)', 10, 1.88, '1903-10-07', '10:10:10', '1903-10-07 10:10:10'),
+	('Simon', 'SRID=4326;POINT(-85.97 41.75)', 11, 1.61, '1902-11-08', '10:10:11', '1902-11-08 10:10:11'),
+	('Judas Iscariot', 'SRID=4326;POINT(35.7 32.4)', 12, 1.71, '1901-12-09', '10:10:12', '1901-12-09 10:10:12');
 
 CREATE SERVER wraparound
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource 'Pg:dbname=fdw user=postgres',
-    format 'PostgreSQL' );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource 'Pg:dbname=fdw user=postgres',
+		format 'PostgreSQL' );
 
 CREATE FOREIGN TABLE apostles_fdw (
-  fid integer,
-  geom geometry(Point, 4326),
-  joined integer,
-  name text,
-  height real,
-  born date,
-  clock time,
-  ts timestamp
+	fid integer,
+	geom geometry(Point, 4326),
+	joined integer,
+	name text,
+	height real,
+	born date,
+	clock time,
+	ts timestamp
 )
 SERVER wraparound
-  OPTIONS (layer 'apostles');
+	OPTIONS (layer 'apostles');
 
 SELECT * FROM apostles_fdw;
 ```
@@ -261,10 +261,10 @@ For file-backed drivers, the user under which `postgres` runs will need read/wri
 By default, servers and tables are updateable if the OGR driver supports it, but you can turn off updateability at a server or table level using the `updateable` option:
 ```sql
 ALTER SERVER myserver
-  OPTIONS (ADD updateable 'false');
+	OPTIONS (ADD updateable 'false');
 
 ALTER FOREIGN TABLE mytable
-  OPTIONS (ADD updateable 'false');
+	OPTIONS (ADD updateable 'false');
 ```
 Writeable tables only work if you have included a `fid` column in your table definition. By default, tables imported by `IMPORT FOREIGN SCHEMA` or using the example SQL code from `ogr_fdw_info` include a `fid` column.
 
@@ -273,21 +273,21 @@ Writeable tables only work if you have included a `fid` column in your table def
 You can create an FDW table with any subset of columns from the OGR source you like, just by using the same column names as the source:
 ```sql
 CREATE FOREIGN TABLE typetest_fdw_partial (
-  clock time,
-  name varchar
-  )
-  SERVER wraparound
-  OPTIONS (layer 'typetest');
+	clock time,
+	name varchar
+	)
+	SERVER wraparound
+	OPTIONS (layer 'typetest');
 ```
 You can also explicitly map remote column names to different local names using the `column_name` option:
 ```sql
 CREATE FOREIGN TABLE typetest_fdw_mapped (
-  fid bigint,
-  supertime time OPTIONS (column_name 'clock'),
-  thebestnamething varchar OPTIONS (column_name 'name')
-  )
-  SERVER wraparound
-  OPTIONS (layer 'typetest');
+	fid bigint,
+	supertime time OPTIONS (column_name 'clock'),
+	thebestnamething varchar OPTIONS (column_name 'name')
+	)
+	SERVER wraparound
+	OPTIONS (layer 'typetest');
 ```
 
 ### Automatic Foreign Table Creation
@@ -303,8 +303,8 @@ If you want to import all tables in the OGR data source use the special schema c
 CREATE SCHEMA fgdball;
 
 IMPORT FOREIGN SCHEMA ogr_all
-  FROM SERVER fgdbtest
-  INTO fgdball;
+	FROM SERVER fgdbtest
+	INTO fgdball;
 ```
 #### Import a Subset of Tables
 
@@ -315,8 +315,8 @@ For example, the following will only import tables that start with *CitiesIn*. A
 CREATE SCHEMA fgdbcityinf;
 
 IMPORT FOREIGN SCHEMA "CitiesIn"
-  FROM SERVER fgdbtest
-  INTO fgdbcityinf;
+	FROM SERVER fgdbtest
+	INTO fgdbcityinf;
 ```
 You can also use PostgreSQL clauses `LIMIT TO` and `EXCEPT` to restrict the tables you are importing.
 ```sql
@@ -324,25 +324,25 @@ CREATE SCHEMA fgdbcitysub;
 
 -- import only layer called Cities
 IMPORT FOREIGN SCHEMA ogr_all
-  LIMIT TO(cities)
-  FROM server fgdbtest
-  INTO fgdbcitysub ;
+	LIMIT TO(cities)
+	FROM server fgdbtest
+	INTO fgdbcitysub ;
 
 -- import only layers not called Cities or Countries
 IMPORT FOREIGN SCHEMA ogr_all
-  EXCEPT (cities, countries)
-  FROM server fgdbtest
-  INTO fgdbcitysub;
+	EXCEPT (cities, countries)
+	FROM server fgdbtest
+	INTO fgdbcitysub;
 
 -- With table laundering turned off, need to use exact layer names
 DROP SCHEMA IF EXISTS fgdbcitysub CASCADE;
 
-  -- import with un-laundered table name
+	-- import with un-laundered table name
 IMPORT FOREIGN SCHEMA ogr_all
-  LIMIT TO("Cities")
-  FROM server fgdbtest
-  INTO fgdbcitysub
-  OPTIONS (launder_table_names 'false') ;
+	LIMIT TO("Cities")
+	FROM server fgdbtest
+	INTO fgdbcitysub
+	OPTIONS (launder_table_names 'false') ;
 ```
 
 #### Mixed Case and Special Characters
@@ -358,15 +358,15 @@ To preserve casing and other funky characters in both column names and table nam
 CREATE SCHEMA fgdbcitypreserve;
 
 IMPORT FOREIGN SCHEMA ogr_all
-  FROM SERVER fgdbtest
-  INTO fgdbpreserve
-  OPTIONS (
-    launder_table_names 'false',
-    launder_column_names 'false'
-  );
+	FROM SERVER fgdbtest
+	INTO fgdbpreserve
+	OPTIONS (
+		launder_table_names 'false',
+		launder_column_names 'false'
+	);
 ```
 
-###  GDAL Options
+### GDAL Options
 
 The behavior of your GDAL/OGR connection can be altered by passing GDAL `config_options` to the connection when you set up the server. Most GDAL/OGR drivers have some specific behaviours that are controlled by configuration options. For example, the "[ESRI Shapefile](http://www.gdal.org/drv_shapefile.html)" driver includes a `SHAPE_ENCODING` option that controls the character encoding applied to text data.
 
@@ -374,12 +374,12 @@ Since many Shapefiles are encoded using LATIN1, and most PostgreSQL databases ar
 
 ```sql
 CREATE SERVER myserver_latin1
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource '/tmp/test',
-    format 'ESRI Shapefile',
-    config_options 'SHAPE_ENCODING=LATIN1'
-  );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource '/tmp/test',
+		format 'ESRI Shapefile',
+		config_options 'SHAPE_ENCODING=LATIN1'
+	);
 ```
 
 Multiple config options can be passed at one time by supplying a **space-separated** list of options.
@@ -388,12 +388,12 @@ If you are using GDAL 2.0 or higher, you can also pass "open options" to your OG
 
 ```sql
 CREATE SERVER myserver_latin1
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource '/tmp/test',
-    format 'ESRI Shapefile',
-    open_options 'ENCODING=LATIN1'
-  );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource '/tmp/test',
+		format 'ESRI Shapefile',
+		open_options 'ENCODING=LATIN1'
+	);
 ```
 
 ### GDAL Debugging
@@ -402,12 +402,12 @@ If you are getting odd behavior and you want to see what GDAL is doing behind th
 
 ```sql
 CREATE SERVER myserver_latin1
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource '/tmp/test',
-    format 'ESRI Shapefile',
-    config_options 'SHAPE_ENCODING=LATIN1 CPL_DEBUG=ON'
-  );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource '/tmp/test',
+		format 'ESRI Shapefile',
+		config_options 'SHAPE_ENCODING=LATIN1 CPL_DEBUG=ON'
+	);
 ```
 
 GDAL-level messages will be logged at the PostgreSQL **DEBUG2** level, so to see them when running a query, alter your `client_min_messages` setting.
@@ -421,9 +421,9 @@ Once you've figured out your issue, don't forget to remove the `CPL_DEBUG` optio
 ```sql
 SET client_min_messages = notice;
 ALTER SERVER myserver_latin1
-  OPTIONS (
-  	SET config_options 'SHAPE_ENCODING=LATIN1'
-  );
+	OPTIONS (
+		SET config_options 'SHAPE_ENCODING=LATIN1'
+	);
 ```
 
 ### Utility Functions
@@ -447,17 +447,17 @@ To access sources that have a non-UTF-8 encoding, you may need to specify the ch
 
 ```sql
 CREATE SERVER odbc_latin1
-  FOREIGN DATA WRAPPER ogr_fdw
-  OPTIONS (
-    datasource 'ODBC:username at servicename',
-    format 'ODBC',
-    character_encoding 'WIN1250'
-  );
+	FOREIGN DATA WRAPPER ogr_fdw
+	OPTIONS (
+		datasource 'ODBC:username at servicename',
+		format 'ODBC',
+		character_encoding 'WIN1250'
+	);
 
 CREATE FOREIGN TABLE featuretable_fdw (
-  name text,
-  geom geometry(Point, 4326)
+	name text,
+	geom geometry(Point, 4326)
 )
 SERVER odbc_latin1
-  OPTIONS (layer 'featuretable');
+	OPTIONS (layer 'featuretable');
 ```


=====================================
debian/changelog
=====================================
@@ -1,9 +1,13 @@
-pgsql-ogr-fdw (1.1.1-4) UNRELEASED; urgency=medium
+pgsql-ogr-fdw (1.1.2-1) UNRELEASED; urgency=medium
 
+  [ Bas Couwenberg ]
   * Team upload.
   * Bump Standards-Version to 4.6.1, no changes.
 
- -- Bas Couwenberg <sebastic at debian.org>  Tue, 21 Jun 2022 07:16:38 +0200
+  [ Christoph Berg ]
+  * New upstream version 1.1.2.
+
+ -- Christoph Berg <myon at debian.org>  Fri, 29 Jul 2022 21:56:57 +0200
 
 pgsql-ogr-fdw (1.1.1-3) unstable; urgency=medium
 


=====================================
debian/patches/pgsql-test.patch deleted
=====================================
@@ -1,23 +0,0 @@
-Description: Fix pgsql test failure.
-Author: Bas Couwenberg <sebastic at debian.org>
-Bug: https://github.com/pramsey/pgsql-ogr-fdw/issues/152#issuecomment-868349181
-
---- a/output/pgsql.source
-+++ b/output/pgsql.source
-@@ -179,6 +179,7 @@ DEBUG:  OGR SQL: (fid = 4)
- DELETE FROM bytea_fdw 
-   WHERE fid = 4;
- DEBUG:  OGR SQL: (fid = 4)
-+ERROR:  cannot find 'fid' column in table 'bytea_fdw'
-   
- SELECT a.fid, a.name, b.name 
-   FROM bytea_local a 
-@@ -189,6 +190,7 @@ SELECT a.fid, a.name, b.name
-    1 | Jim    | Jim
-    2 | Marvin | Marvin
-    3 |        | 
--(3 rows)
-+   4 | Maggie | Maggie
-+(4 rows)
- 
-   


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,2 @@
 install.patch
 hardingflags.patch
-pgsql-test.patch


=====================================
ogr_fdw.c
=====================================
@@ -510,6 +510,8 @@ ogrEreportError(const char* errstr)
 static void
 ogrFinishConnection(OgrConnection* ogr)
 {
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	if (ogr->lyr && OGR_L_SyncToDisk(ogr->lyr) != OGRERR_NONE)
 	{
 		elog(NOTICE, "failed to flush writes to OGR data source");
@@ -531,6 +533,8 @@ ogrGetConnectionFromServer(Oid foreignserverid, OgrUpdateable updateable)
 	ListCell* cell;
 	OGRErr err;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Null all values */
 	memset(&ogr, 0, sizeof(OgrConnection));
 	ogr.ds_updateable = OGR_UPDATEABLE_UNSET;
@@ -611,12 +615,16 @@ ogrGetConnectionFromTable(Oid foreigntableid, OgrUpdateable updateable)
 	ListCell* cell;
 	OgrConnection ogr;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Gather all data for the foreign table. */
 	table = GetForeignTable(foreigntableid);
 	/* mapping = GetUserMapping(GetUserId(), table->serverid); */
 
 	ogr = ogrGetConnectionFromServer(table->serverid, updateable);
 
+	elog(DEBUG3, "%s: ogr.ds_str = %s", __func__, ogr.ds_str);
+
 	foreach (cell, table->options)
 	{
 		DefElem* def = (DefElem*) lfirst(cell);
@@ -650,6 +658,8 @@ ogrGetConnectionFromTable(Oid foreigntableid, OgrUpdateable updateable)
 		elog(ERROR, "FDW table '%s' option is missing", OPT_LAYER);
 	}
 
+	elog(DEBUG3, "%s: ogr.lyr_str = %s", __func__, ogr.lyr_str);
+
 	/* Does the layer exist in the data source? */
 	ogr.lyr = GDALDatasetGetLayerByName(ogr.ds, ogr.lyr_str);
 	if (!ogr.lyr)
@@ -858,6 +868,8 @@ ogrGetForeignRelSize(PlannerInfo* root,
 	OgrFdwPlanState* planstate = (OgrFdwPlanState*)state;
 	List* scan_clauses = baserel->baserestrictinfo;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Set to NULL to clear the restriction clauses in OGR */
 	OGR_L_SetIgnoredFields(planstate->ogr.lyr, NULL);
 	OGR_L_SetSpatialFilter(planstate->ogr.lyr, NULL);
@@ -916,6 +928,8 @@ ogrGetForeignPaths(PlannerInfo* root,
 {
 	OgrFdwPlanState* planstate = (OgrFdwPlanState*)(baserel->fdw_private);
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* TODO: replace this with something that looks at the OGRDriver and */
 	/* makes a determination based on that? Better: add connection caching */
 	/* so that slow startup doesn't matter so much */
@@ -1016,6 +1030,8 @@ ogrGetForeignPlan(PlannerInfo* root,
 	OgrFdwSpatialFilter* spatial_filter = NULL;
 	char* attribute_filter = NULL;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Add in column mapping data to build SQL with the right OGR column names */
 	ogrReadColumnData(state);
 
@@ -1586,6 +1602,8 @@ ogrBeginForeignScan(ForeignScanState* node, int eflags)
 	Oid foreigntableid = RelationGetRelid(node->ss.ss_currentRelation);
 	ForeignScan* fsplan = (ForeignScan*)node->ss.ps.plan;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Do nothing in EXPLAIN (no ANALYZE) case */
 	if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
 		return;
@@ -1904,7 +1922,7 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot* slot, const OgrFdwExecS
 					 */
 					const char* cstr_in = OGR_F_GetFieldAsString(feat, ogrfldnum);
 					size_t cstr_len = cstr_in ? strlen(cstr_in) : 0;
-					if (cstr_in && cstr_len > 0)
+					if (cstr_in && (cstr_len > 0 || ogrfldtype == OFTString))
 					{
 						char* cstr_decoded;
 						if (execstate->ogr.char_encoding)
@@ -2340,6 +2358,8 @@ ogrIterateForeignScan(ForeignScanState* node)
 	TupleTableSlot* slot = node->ss.ss_ScanTupleSlot;
 	OGRFeatureH feat;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/*
 	 * Clear the slot. If it gets through w/o being filled up, that means
 	 * we're all done.
@@ -2387,6 +2407,7 @@ static void
 ogrReScanForeignScan(ForeignScanState* node)
 {
 	OgrFdwExecState* execstate = (OgrFdwExecState*) node->fdw_state;
+	elog(DEBUG3, "%s: entered function", __func__);
 
 	OGR_L_ResetReading(execstate->ogr.lyr);
 	execstate->rownum = 0;
@@ -2402,6 +2423,7 @@ static void
 ogrEndForeignScan(ForeignScanState* node)
 {
 	OgrFdwExecState* execstate = (OgrFdwExecState*) node->fdw_state;
+	elog(DEBUG3, "%s: entered function", __func__);
 	if (execstate)
 	{
 		elog(DEBUG2, "OGR FDW processed %d rows from OGR", execstate->rownum);
@@ -2467,6 +2489,7 @@ ogrGetFidColumn(const TupleDesc td)
  * there could always be a virtual fid travelling with the queries,
  * and the FDW table itself wouldn't need such a column?
  */
+
 #if PG_VERSION_NUM >= 140000
 static void
 ogrAddForeignUpdateTargets(PlannerInfo* planinfo,
@@ -2475,14 +2498,36 @@ ogrAddForeignUpdateTargets(PlannerInfo* planinfo,
                            Relation target_relation)
 {
 	Query* parsetree = planinfo->parse;
-#else
+	Form_pg_attribute att;
+	Var* var;
+	TupleDesc tupdesc = target_relation->rd_att;
+	int fid_column = ogrGetFidColumn(tupdesc);
+
+	elog(DEBUG3, "%s: entered function", __func__);
+
+	if (fid_column < 0)
+	{
+		elog(ERROR, "table '%s' does not have a 'fid' column", RelationGetRelationName(target_relation));
+	}
+
+	att = &tupdesc->attrs[fid_column];
+	/* Make a Var representing the desired value */
+	var = makeVar(parsetree->resultRelation,
+	              att->attnum,
+	              att->atttypid,
+	              att->atttypmod,
+	              att->attcollation,
+	              0);
+
+	add_row_identity_var(planinfo, var, rte_index, "fid");
+}
+#else /* PG_VERSION_NUM < 140000 */
 
 static void
 ogrAddForeignUpdateTargets(Query* parsetree,
                            RangeTblEntry* target_rte,
                            Relation target_relation)
 {
-#endif
 	ListCell* cell;
 	Form_pg_attribute att;
 	Var* var;
@@ -2490,7 +2535,7 @@ ogrAddForeignUpdateTargets(Query* parsetree,
 	TupleDesc tupdesc = target_relation->rd_att;
 	int fid_column = ogrGetFidColumn(tupdesc);
 
-	elog(DEBUG2, "ogrAddForeignUpdateTargets");
+	elog(DEBUG3, "%s: entered function", __func__);
 
 	if (fid_column < 0)
 	{
@@ -2523,10 +2568,10 @@ ogrAddForeignUpdateTargets(Query* parsetree,
 		TargetEntry* target = (TargetEntry*) lfirst(cell);
 		elog(DEBUG4, "parsetree->targetList %s:%d", target->resname, target->resno);
 	}
+}
+#endif
 
-	return;
 
-}
 
 /*
  * ogrBeginForeignModify
@@ -2543,7 +2588,7 @@ ogrBeginForeignModify(ModifyTableState* mtstate,
 	Oid foreigntableid;
 	OgrFdwState* state;
 
-	elog(DEBUG2, "ogrBeginForeignModify");
+	elog(DEBUG3, "%s: entered function", __func__);
 
 	foreigntableid = RelationGetRelid(rinfo->ri_RelationDesc);
 	state = getOgrFdwState(foreigntableid, OGR_MODIFY_STATE);
@@ -2578,6 +2623,8 @@ ogrExecForeignUpdate(EState* estate,
 	OGRFeatureH feat;
 	OGRErr err;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Is there a fid column? */
 	fid_column = ogrGetFidColumn(td);
 	if (fid_column < 0)
@@ -2750,7 +2797,7 @@ ogrExecForeignInsert(EState* estate,
 	OGRErr err;
 	GIntBig fid;
 
-	elog(DEBUG2, "ogrExecForeignInsert");
+	elog(DEBUG3, "%s: entered function", __func__);
 
 #if PG_VERSION_NUM >= 120000
 	/*
@@ -2813,6 +2860,8 @@ ogrExecForeignDelete(EState* estate,
 	int64 fid;
 	OGRErr err;
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Is there a fid column? */
 	fid_column = ogrGetFidColumn(td);
 	if (fid_column < 0)
@@ -2861,7 +2910,7 @@ ogrEndForeignModify(EState* estate, ResultRelInfo* rinfo)
 {
 	OgrFdwModifyState* modstate = rinfo->ri_FdwState;
 
-	elog(DEBUG2, "ogrEndForeignModify");
+	elog(DEBUG3, "%s: entered function", __func__);
 
 	ogrFinishConnection(&(modstate->ogr));
 
@@ -2877,7 +2926,7 @@ ogrIsForeignRelUpdatable(Relation rel)
 	OgrConnection ogr;
 	Oid foreigntableid = RelationGetRelid(rel);
 
-	elog(DEBUG2, "ogrIsForeignRelUpdatable");
+	elog(DEBUG3, "%s: entered function", __func__);
 
 	/* Before we say "yes"... */
 	/*  Does the foreign relation have a "fid" column? */
@@ -2895,7 +2944,7 @@ ogrIsForeignRelUpdatable(Relation rel)
 	/* Something in the open process set the readonly flags */
 	/* Perhaps user has manually set the foreign table option to readonly */
 	if (ogr.ds_updateable == OGR_UPDATEABLE_FALSE ||
-	        ogr.lyr_updateable == OGR_UPDATEABLE_FALSE)
+	    ogr.lyr_updateable == OGR_UPDATEABLE_FALSE)
 	{
 		return readonly;
 	}
@@ -2944,6 +2993,8 @@ ogrImportForeignSchema(ImportForeignSchemaStmt* stmt, Oid serverOid)
 	char layer_name[STR_MAX_LEN];
 	char table_name[STR_MAX_LEN];
 
+	elog(DEBUG3, "%s: entered function", __func__);
+
 	/* Are we importing all layers in the OGR datasource? */
 	import_all = streq(stmt->remote_schema, "ogr_all");
 


=====================================
ogr_fdw.h
=====================================
@@ -61,6 +61,11 @@
 #include "optimizer/var.h"
 #else
 #include "executor/tuptable.h"
+#include "optimizer/appendinfo.h"
+#endif
+
+#ifdef PACKAGE_URL
+#undef PACKAGE_URL
 #endif
 
 /* GDAL/OGR includes and compat */


=====================================
ogr_fdw_common.c
=====================================
@@ -199,6 +199,7 @@ ogrGeomTypeToPgGeomType(stringbuffer_t *buf, OGRwkbGeometryType gtype)
 #endif
 		case wkbNone:
 			CPLError(CE_Failure, CPLE_AssertionFailed, "Cannot handle OGR geometry type wkbNone");
+			break;
 		default:
 			CPLError(CE_Failure, CPLE_AssertionFailed, "Cannot handle OGR geometry type '%d'", gtype);
 	}


=====================================
ogr_fdw_func.c
=====================================
@@ -36,6 +36,7 @@ Datum ogr_fdw_drivers(PG_FUNCTION_ARGS)
 	bool elem_byval;
 	char elem_align;
 	int num_drivers;
+	int i;
 
 	if (GDALGetDriverCount() <= 0)
 		GDALAllRegister();
@@ -52,7 +53,6 @@ Datum ogr_fdw_drivers(PG_FUNCTION_ARGS)
  	arr_elems = palloc0(num_drivers * sizeof(Datum));
     get_typlenbyvalalign(elem_type, &elem_len, &elem_byval, &elem_align);
 
-	int i;
 	for (i = 0; i < num_drivers; i++) {
 #if GDAL_VERSION_MAJOR <= 1
 		OGRSFDriverH hDriver = OGRGetDriver(i);
@@ -82,8 +82,7 @@ Datum ogr_fdw_version(PG_FUNCTION_ARGS)
 	const char *ogr_fdw_ver = OGR_FDW_RELEASE_NAME;
 	char ver_str[256];
 	snprintf(ver_str, sizeof(ver_str), "OGR_FDW=\"%s\" GDAL=\"%s\"", ogr_fdw_ver, gdal_ver);
-	text* ver_txt = cstring_to_text(ver_str);
-	PG_RETURN_TEXT_P(ver_txt);
+	PG_RETURN_TEXT_P(cstring_to_text(ver_str));
 }
 
 


=====================================
ogr_fdw_info.c
=====================================
@@ -133,9 +133,11 @@ usage()
 		"       Show what input file formats are supported.\n"
 		"\n");
 	printf(
-		"note (1): You can specify either -l (layer name) or -i (layer index) if you specify both -l will be used\n"
+		"note (1): You can specify either -l (layer name) or -i (layer index)\n"
+		"          if you specify both -l will be used\n"
 		"note (2): config options are specified as a comma deliminated list without the OGR_<driver>_ prefix\n"
-		"so OGR_XLSX_HEADERS = FORCE OGR_XLSX_FIELD_TYPES = STRING would become:\n\"HEADERS = FORCE,FIELD_TYPES = STRING\""
+		"          so OGR_XLSX_HEADERS = FORCE OGR_XLSX_FIELD_TYPES = STRING would become:\n"
+		"          \"HEADERS = FORCE,FIELD_TYPES = STRING\""
 		"\n");
 	exit(0);
 }
@@ -155,7 +157,7 @@ main(int argc, char** argv)
 		usage();
 	}
 
-	while ((ch = getopt(argc, argv, "h?s:l:f:t:n:i:o:")) != -1)
+	while ((ch = getopt(argc, argv, "hfs:l:t:n:i:o:")) != -1)
 	{
 		switch (ch)
 		{


=====================================
stringbuffer.c
=====================================
@@ -11,6 +11,11 @@
 
 #include "stringbuffer.h"
 
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
+#endif
+
 /**
 * Allocate a new stringbuffer_t. Use stringbuffer_destroy to free.
 */



View it on GitLab: https://salsa.debian.org/debian-gis-team/pgsql-ogr-fdw/-/compare/8c52be85351d5c262a0a7a8cde19bb54fbaa8066...9e17f93474c4aa5db9d29108a3772acded7167fa

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pgsql-ogr-fdw/-/compare/8c52be85351d5c262a0a7a8cde19bb54fbaa8066...9e17f93474c4aa5db9d29108a3772acded7167fa
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220729/19d9c4c4/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list