Skip to content

Commit 540e03f

Browse files
committed
Support for CTEs in pgsql2shp. References #5018 for PostGIS 3.2.0. Also minor news cleanup
1 parent 677d201 commit 540e03f

8 files changed

+12
-5
lines changed

NEWS

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
PostGIS 3.2.0beta2
22
2021/xx/xx
33
* Breaking changes / fixes *
4-
- loader: Respect LDFLAGS (Greg Troxel)
4+
- #5016, loader (shp2pgsq): Respect LDFLAGS (Greg Troxel)
5+
- #5018, pgsql2shp basic support for WITH CTE clause (Regina Obe)
56

67
PostGIS 3.2.0
78
2021/xx/xx

loader/pgsql2shp-cli.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ main(int argc, char **argv)
136136
it's a user-defined query then set that instead */
137137
if (pgis_optind < argc)
138138
{
139-
/* User-defined queries begin with SELECT */
140-
if (!strncmp(argv[pgis_optind], "SELECT ", 7) ||
141-
!strncmp(argv[pgis_optind], "select ", 7))
139+
/* User-defined queries begin with SELECT or WITH */
140+
if ( !strncmp(argv[pgis_optind], "SELECT ", 7) ||
141+
!strncmp(argv[pgis_optind], "select ", 7) ||
142+
!strncmp(argv[pgis_optind], "WITH ", 5) ||
143+
!strncmp(argv[pgis_optind], "with ", 5)
144+
)
142145
{
143146
config->usrquery = argv[pgis_optind];
144147
}

regress/dumper/tests.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ TESTS += \
1515
$(topsrcdir)/regress/dumper/literalsrid \
1616
$(topsrcdir)/regress/dumper/realtable \
1717
$(topsrcdir)/regress/dumper/nullsintable \
18-
$(topsrcdir)/regress/dumper/null3d
18+
$(topsrcdir)/regress/dumper/null3d \
19+
$(topsrcdir)/regress/dumper/withclause

regress/dumper/withclause.dmp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WITH m(address, some_very_long_name, color, geom) AS ( VALUES ('This is Test 1', 'TT1', 'red', ST_Point(0, 0)), ('This is Test 2', 'TT2', 'green', ST_Point(0, 100) ) ) SELECT * FROM m
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UTF-8
175 Bytes
Binary file not shown.
156 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)