Opened 5 years ago

Last modified 4 years ago

#4616 new enhancement

pgsql2shp issues with user defined queries

Reported by: Algunenano Owned by: robe
Priority: medium Milestone: PostGIS Fund Me
Component: utils/loader-dumper Version: master
Keywords: Cc:

Description

This works:

./pgsql2shp -b -f "/tmp/jpn"  "cartodb_dev_user_f80dfdef-ea5c-498d-b98a-82362650d944_db" "public.pref"
Initializing... 
Done (postgis major version: 3).
Output shape: Polygon
Dumping: X [47 rows].

But this doesn't:

./pgsql2shp -b -f "/tmp/jpn"  "cartodb_dev_user_f80dfdef-ea5c-498d-b98a-82362650d944_db" "Select * from public.pref"
Initializing... 
Table pref does not exist

As far as I can see in the logs it's taking Select * from public as the table or schema name, And looking at the code it appears it only accepts SELECT or select as the start values of a user defined query.

I'm not too happy about this, since it means that not only my Select isn't accepted, but CTEs will fail too. I think having different entry points would be the way to go; for example -t myschema.mytable or -c "Select * from myschema.mytable).

Change History (3)

comment:1 by robe, 5 years ago

Component: postgisloader/dumper
Owner: changed from pramsey to robe

So "SELECT * FROM public.pref" works?

Yah we should have different entry points to minimize on ambiguity.

comment:2 by Algunenano, 5 years ago

So "SELECT * FROM public.pref" works?

Yes, both SELECT * FROM public.pref and select * FROM public.pref work, but not any other combination of lowercase/uppercase.

comment:3 by pramsey, 4 years ago

Milestone: PostGIS 3.1.0PostGIS Fund Me
Note: See TracTickets for help on using tickets.