[gdal-dev] joining shapefile to PG table
William Kyngesburye
woklist at kyngchaos.com
Thu Jul 7 17:05:30 EDT 2011
On Jul 7, 2011, at 3:17 PM, Even Rouault wrote:
> Le jeudi 07 juillet 2011 21:57:31, William Kyngesburye a écrit :
>> I'm having a problem joining a Postgres table to a shapefile. I've done
>> this in the past with MySQL tables.
>>
>> ogrinfo -al -so myshapefile.shp -sql "SELECT * FROM myshapefile LEFT JOIN
>> 'PG:dbname=mypgdb host=localhost user=someuser password='.mypgtable ON
>> myshapefile.keyfield = mypgtable.keyfield" INFO: Open of `myshqpefile.shp'
>> using driver `ESRI Shapefile' successful.
>> ERROR 1: SQL Expression Parsing Error: syntax error
>
> William,
>
> I've just tried something really close to the above and it works in trunk and
> 1.8.1.
>
> I get a segfault in 1.8.0, but the segfault can only occur if SQL parsing is
> successfull. So I don't understand why you get the SQL parsing error. I guess
> you pasted a simplified/reworked version of your exact SQL, so maybe check it
> once more...
Only simplified the names. The shapefile name starts with numbers (natural earth shapefiles). There's the problem. I removed the leading numbers, and simplified the shapefile names to a few letters (they're also long names), no syntax error (segfault). Renamed with a short name with a single leading number, again the syntax error.
So, it's a SQL limitation on names?
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
"Those people who most want to rule people are, ipso-facto, those least suited to do it."
- A rule of the universe, from the HitchHiker's Guide to the Galaxy
More information about the gdal-dev
mailing list