Did you verify that the data in the shapefile is correct when you run the command with just the table name?<br><br>Hang on a second...  WHERE 'ID' < '20' is never true.  That's why you're getting an empty table.  'ID' is a string, as is '20'.  I think you mean to say where your ID column value is less than 20, correct?  Single quotes mean 'this is a string'.<br>
<br>Are your ID values strings (varchars) or integers?  If integers, it'll be faster to use 20 as an integer (without the single quotes) rather than as a string.<br><br>Maybe the problem is with 'id' by itself, so try fully qualifying it:<br>
<br>pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password] [database]<br>
 "SELECT * FROM table1 WHERE <a href="http://table1.id">table1.id</a> < 20"<br><br><div class="gmail_quote">On Wed, Aug 11, 2010 at 5:50 AM, smas036 <span dir="ltr"><<a href="mailto:sina.masoud.ansari@gmail.com">sina.masoud.ansari@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
Thanks for the replies, the most promising command so far is:<br>
<div class="im"><br>
pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password] [database]<br>
</div> "SELECT * FROM table1 WHERE 'ID' < '20'"<br>
<br>
Which has the output:<br>
<br>
Preparing table for user query... Done.<br>
Initializing... WARNING: Cannot determine spatial reference (empty table or<br>
<div class="im">unknown spatial ref). No prj file will be generated.<br>
</div><div class="im">ERROR: Cannot determine geometry type (empty table)<br>
<br>
</div>I think the query is correct as other combinations if single and double<br>
quotes around field values produce<br>
"...column does not exist..." or "The system cannot find the file<br>
specified."<br>
<br>
I believe the command parameters before the query are correct as the command<br>
without a query:<br>
<div class="im"><br>
pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password] [database]<br>
</div>[table]<br>
<br>
works fine.<br>
<br>
It would be possible to produce a table from a query and use this command<br>
but I wonder if there is a performance loss in doing so...<br>
<font color="#888888"><br>
<br>
<br>
--<br>
View this message in context: <a href="http://old.nabble.com/pgsql2shp-error-tp29384180p29406665.html" target="_blank">http://old.nabble.com/pgsql2shp-error-tp29384180p29406665.html</a><br>
</font><div><div></div><div class="h5">Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Jeff Adams<br><br>Azavea (formerly Avencia)<span style="font-family: arial,sans-serif; font-size: 13px; border-collapse: collapse;">  |  340 N 12th St, Ste 402, Philadelphia, PA</span><br>


<a href="mailto:jadams@azavea.com" target="_blank">jadams@azavea.com</a>  | T 215.701.7717  | F 215.925.2663<br>Web <a href="http://azavea.com/" target="_blank">azavea.com</a><span style="font-family: arial,sans-serif; font-size: 13px; border-collapse: collapse;">  |  Blog <a href="http://azavea.com/blogs" style="color: rgb(28, 81, 168);" target="_blank">azavea.com/blogs</a>  |  <span style="border-collapse: separate; font-family: arial; font-size: small;">Twitter</span> <a href="http://twitter.com/azavea" target="_blank">@azavea</a></span><br>