Problem with pgsql2shp - thinks I'm passing a table instead of a query?

From: Bryan Montgomery <monty(at)english(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Problem with pgsql2shp - thinks I'm passing a table instead of a query?
Date: 2012-03-21 20:29:14
Message-ID: CAPTJ3=cQAiiz0pSD=cm-t83-zdZFMqZYk5oK5tEx0wLk_tLOKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

It seems that the program is thinking I'm passing a table but instead I'm
passing a query. Now, I could put a hack in place, create a view and pass
that to pgsql2shp but I thought I'd ask whether anyone else has seen this
behavior and has a way to force / trick the program to treat the parameter
as a query.

I'm using this version $Id: pgsql2shp.c 5451 2010-03-22 19:38:40Z pramsey $
RELEASE: 1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 and run the command below
(I've truncated it for brevity), the sql runs fine in pgadmin.

pgsql2shp -h 10.168.111.144 -f FileEg mydb "
SELECT
m.id1,
m.id2,
10 as OPID,
'Name Here' as OPER_NM,
linedesc as SYS_NM,

and more ...

From the server, the sql being passed to it is:
ERROR: syntax error at or near "Name Here" at character 255

SELECT a.attname, a.atttypid, a.atttypmod FROM pg_attribute a, pg_class c,
pg_namespace n WHERE n.nspname = '
SELECT
m' AND a.attrelid = c.oid AND n.oid = c.relnamespace AND a.atttypid
!= 0 AND a.attnum > 0 AND c.relname = 'id1,
m.id2,
10 as OPID,
'Name Here' as OPER_NM,
linedesc as SYS_NM,

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2012-03-21 21:11:33 Re: Large PostgreSQL servers
Previous Message Steve Crawford 2012-03-21 20:24:26 Re: Large PostgreSQL servers