[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-139-g3334fd0

git at osgeo.org git at osgeo.org
Mon Jun 22 10:37:52 PDT 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  3334fd0675c98c79a6a8527a05fc0e8c4c371835 (commit)
       via  b3ae6aadc804a98dc53727b5554bffd778e402b8 (commit)
      from  a2557be05fba0ed47ddd3dbb7dcf83b334581e65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3334fd0675c98c79a6a8527a05fc0e8c4c371835
Author: Giovanni Zezza <OSGeo UserID: zezzagio>
Date:   Sat Jun 20 15:13:34 2020 +0200

    Corrected pgsql2shp for -m option; added test
    
    Postgres field column in mapping file was incorrectly compared with the name of the dbf field
    Closes #4705

diff --git a/loader/pgsql2shp-core.c b/loader/pgsql2shp-core.c
index 1596dc2..06226e9 100644
--- a/loader/pgsql2shp-core.c
+++ b/loader/pgsql2shp-core.c
@@ -1536,7 +1536,7 @@ ShpDumperOpenTable(SHPDUMPERSTATE *state)
 		 * use this to create the dbf field name from
 		 * the PostgreSQL column name */
 		{
-			const char *mapped = colmap_dbf_by_pg(&state->column_map, dbffieldname);
+			const char *mapped = colmap_dbf_by_pg(&state->column_map, pgfieldname);
 			if (mapped)
 			{
 				strncpy(dbffieldname, mapped, 10);
diff --git a/regress/core/Makefile.in b/regress/core/Makefile.in
index bf2c851..b9df38b 100644
--- a/regress/core/Makefile.in
+++ b/regress/core/Makefile.in
@@ -67,6 +67,7 @@ TESTS = \
 	../loader/Latin1 \
 	../loader/Latin1-implicit \
 	../loader/mfile \
+	../dumper/mfiledmp \
 	../dumper/literalsrid \
 	../dumper/realtable \
 	../dumper/nullsintable \
diff --git a/regress/dumper/mfiledmp.dmp b/regress/dumper/mfiledmp.dmp
new file mode 100644
index 0000000..daccd35
--- /dev/null
+++ b/regress/dumper/mfiledmp.dmp
@@ -0,0 +1,2 @@
+SELECT * FROM (VALUES ('This is Test 1', 'TT1', 'red', ST_Point(0, 0)), ('This is Test 2', 'TT2', 'green', ST_Point(0, 100))) AS m (address, some_very_long_name, color, geom)
+-m{regdir}/dumper/mfiledmp_mapping.txt
\ No newline at end of file
diff --git a/regress/dumper/mfiledmp_expected.dbf b/regress/dumper/mfiledmp_expected.dbf
new file mode 100644
index 0000000..6a020c0
Binary files /dev/null and b/regress/dumper/mfiledmp_expected.dbf differ
diff --git a/regress/dumper/mfiledmp_expected.shp b/regress/dumper/mfiledmp_expected.shp
new file mode 100644
index 0000000..8290555
Binary files /dev/null and b/regress/dumper/mfiledmp_expected.shp differ
diff --git a/regress/dumper/mfiledmp_expected.shx b/regress/dumper/mfiledmp_expected.shx
new file mode 100644
index 0000000..314770b
Binary files /dev/null and b/regress/dumper/mfiledmp_expected.shx differ
diff --git a/regress/dumper/mfiledmp_mapping.txt b/regress/dumper/mfiledmp_mapping.txt
new file mode 100644
index 0000000..f1b20f4
--- /dev/null
+++ b/regress/dumper/mfiledmp_mapping.txt
@@ -0,0 +1,2 @@
+address add
+some_very_long_name short
\ No newline at end of file

commit b3ae6aadc804a98dc53727b5554bffd778e402b8
Author: Giovanni Zezza <OSGeo UserID: zezzagio>
Date:   Sat Jun 20 15:12:04 2020 +0200

    Allow {regdir} keyword substitution in .dmp file; remove return from for main loop on objects count mismatch
    
    Can't return from outside a subroutine, also terminate the program seems too drastic,
    allow following cleaning operations

diff --git a/regress/run_test.pl b/regress/run_test.pl
index 1e0875e..ce2c718 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -541,7 +541,6 @@ foreach $TEST (@ARGV)
 	if ( $TEST_OBJ_COUNT_POST != $TEST_OBJ_COUNT_PRE )
 	{
 		fail("PostGIS object count pre-test ($TEST_OBJ_COUNT_POST) != post-test ($TEST_OBJ_COUNT_PRE)");
-		return 0;
 	}
 
 }
@@ -1170,8 +1169,8 @@ sub run_loader_test
 #  Run dumper and compare output with various expectances
 #  test and run simple test with provided expected output.
 #
-# input is ${TEST}.dmp, where last line is considered to be the
-# [table|query] argument for pgsql2shp and all the previous lines,
+# input is ${TEST}.dmp, where first line is considered to be the
+# [table|query] argument for pgsql2shp and all the next lines,
 # if any are options.
 #
 ##################################################################
@@ -1190,8 +1189,9 @@ sub run_dumper_test
   open DUMPFILE, "$dump_file" or die "Cannot open dump file $dump_file\n";
   my @dumplines = <DUMPFILE>;
   close DUMPFILE;
-  chop(@dumplines);
+  chomp(@dumplines);
   my $dumpstring = shift @dumplines;
+  @dumplines = map { local $_ = $_; s/{regdir}/$REGDIR/; $_ } @dumplines;
   my @cmd = ("${PGSQL2SHP}", "-f", ${shpfile});
   push @cmd, @dumplines;
   push @cmd, ${DB};

-----------------------------------------------------------------------

Summary of changes:
 loader/pgsql2shp-core.c              |   2 +-
 regress/core/Makefile.in             |   1 +
 regress/dumper/mfiledmp.dmp          |   2 ++
 regress/dumper/mfiledmp_expected.dbf | Bin 0 -> 175 bytes
 regress/dumper/mfiledmp_expected.shp | Bin 0 -> 156 bytes
 regress/dumper/mfiledmp_expected.shx | Bin 0 -> 116 bytes
 regress/dumper/mfiledmp_mapping.txt  |   2 ++
 regress/run_test.pl                  |   8 ++++----
 8 files changed, 10 insertions(+), 5 deletions(-)
 create mode 100644 regress/dumper/mfiledmp.dmp
 create mode 100644 regress/dumper/mfiledmp_expected.dbf
 create mode 100644 regress/dumper/mfiledmp_expected.shp
 create mode 100644 regress/dumper/mfiledmp_expected.shx
 create mode 100644 regress/dumper/mfiledmp_mapping.txt


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list