[postgis-tickets] [PostGIS] #5018: pgsql2shp doesn't work with CTE queries (aka WITH)

PostGIS trac at osgeo.org
Wed Nov 10 12:00:52 PST 2021


#5018: pgsql2shp doesn't work with CTE queries (aka WITH)
---------------------------+---------------------------
 Reporter:  robe           |      Owner:  robe
     Type:  defect         |     Status:  new
 Priority:  medium         |  Milestone:  PostGIS 3.1.5
Component:  loader/dumper  |    Version:  3.1.x
 Keywords:                 |
---------------------------+---------------------------
 https://lists.osgeo.org/pipermail/postgis-users/2021-November/045047.html

 From the mailing list:


 {{{
 >  > $ pgsql2shp ... "WITH foo AS (SELECT 2) SELECT 1"
 >  > Table WITH foo AS (SELECT 2) SELECT 1 does not exist

 I found a work-around:

 > $ pgsql2shp ... "SELECT * FROM (WITH foo AS (SELECT 2) SELECT 1) bar"
 > Initializing...
 > Done (postgis major version: 3).
 > Output shape: Null Shape
 > Dumping: X [1 rows].
 }}}

 The issue is this line:

 https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/loader
 /pgsql2shp-cli.c#L140

 Which explicitly looks for a SELECT to determine whether to treat the
 input as a table or query.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5018>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list