<div><font color="#000099">Thanks for your quick reply, I just did some tests.</font></div>
<div> </div>
<div>select oid,typname from pg_type where typname='geometry' or typname='bytea';</div>
<div>oid       typname</div>
<div>-------------------------</div>
<div>17        bytea</div>
<div>16402   geometry</div>
<div> </div>
<div><font color="#000099">But Postgre gives me another error message, I list what I tested</font></div>
<div> </div>
<div>Test 1:</div>
<div>   create view "v" as select * from "t" where ST_Intersects("geocol", $1);</div>
<div>   Oid paramtypes[1]={16402};</div>
<div>   The Errmsg: There is no parameter $1</div>
<div> </div>
<div>
<div>Test 2:</div>
<div>   create view "v" as select * from "t" where ST_Intersects("geocol", $1);</div>
<div>   Oid paramtypes[1]={17};</div>
<div>   The Errmsg: There is no parameter $1</div></div>
<div> </div>
<div>
<div>Test 3:</div>
<div>   create view "v" as select * from "t" where ST_Intersects("geocol", $1::geometry);</div>
<div>   Oid paramtypes[1]={16402};</div>
<div>   The Errmsg: There is no parameter $1</div>
<div> </div>
<div>
<div>Test 4:</div>
<div>   create view "v" as select * from "t" where ST_Intersects("geocol", ST_GeomFromWKB($1::bytea));</div>
<div>   Oid paramtypes[1]={17};</div>
<div>   The Errmsg: There is no parameter $1</div></div><br><font color="#000099">The 4 tests above all return PGRES_FATAL_ERROR and same errmsg,</font></div>
<div><font color="#000099">Here is another 4 tests:</font></div>
<div> </div>
<div>
<div>Test 5:</div>
<div>   select * from "t" where ST_Intersects("geocol", $1);</div>
<div>   Oid paramtypes[1]={16402};</div>
<div> </div>
<div>
<div>Test 6:</div>
<div>   select * from "t" where ST_Intersects("geocol", $1);</div>
<div>   Oid paramtypes[1]={17};</div>
<div> </div></div>
<div>
<div>Test 7:</div>
<div>   select * from "t" where ST_Intersects("geocol", $1::geometry);</div>
<div>   Oid paramtypes[1]={16402};</div>
<div> </div>
<div>
<div>Test 8:</div>
<div>   select * from "t" where ST_Intersects("geocol", ST_GeomFromWKB($1::bytea));</div>
<div>   Oid paramtypes[1]={17};</div>
<div> </div></div></div></div>
<div><font color="#000099">Test 5 to 8 are return PGRES_TUPLES_OK, and even Test 9.</font></div>
<div> </div>
<div>Test 9:</div>
<div>   select * from "t" where ST_Intersects("geocol", ST_GeomFromWKB($1::geometry));</div>
<div>   Oid paramtypes[1]={17};</div>
<div>   ::geometry does not match to paramtypes[1], but Test 9 still return OK</div>
<div> </div>
<div><font color="#000099">So, everything works fine without "CREATE VIEW", weird.</font></div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div class="gmail_quote">2010/5/24 Mike Toews <span dir="ltr"><<a href="mailto:mwtoews@gmail.com">mwtoews@gmail.com</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">2010/5/23 ³¢®a¦¨ <span dir="ltr"><<a href="mailto:iron1103@gmail.com" target="_blank">iron1103@gmail.com</a>></span><br>

<div class="gmail_quote">
<div class="im">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Hi Mike,</div>
<div>Thanks for your reply, but it still doesn't work.</div>
<div>The key point possibly lies in <strong>Oid paramtypes[1]={0}</strong>, </div>
<div>Where can I find the ParamType of Geometry or Bytea?</div></blockquote>
<div><br></div></div>
<div>They are defined in the system tables:</div>
<div><br></div>
<div>select oid, * from pg_type where typname='geometry' or typname='bytea';</div>
<div><br></div>
<div>I'm not sure if the oid for geometry is constant with different installations (mine is 16892). Bytea is always 17, since it is hard-coded in src/include/catalog/pg_type.h</div>
<div><br></div><font color="#888888">
<div>-Mike</div></font></div><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>
<br></blockquote></div><br>