<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi:</FONT></DIV>
<DIV><FONT size=2> When I use the MULTIPOINT,I found some bug in
geometry_in function!it can execute correctly the following
selection:</FONT></DIV>
<DIV><FONT size=2> </FONT></DIV>
<DIV><FONT size=2> select 'GEOMETRYCOLLECTION(MULTIPOINT( 1
2))'::GEOMETRY as geom;<BR> select 'GEOMETRYCOLLECTION(MULTIPOINT( 1
2 3))'::GEOMETRY as geom;<BR> select 'GEOMETRYCOLLECTION(MULTIPOINT(
1 2 3, 5 6 7, 8 9 10, 11 12 13))'::GEOMETRY as geom;<BR> select
'GEOMETRYCOLLECTION(POINT( 1 2 ),MULTIPOINT( 1 2 3))'::GEOMETRY as
geom;<BR> select 'GEOMETRYCOLLECTION(( 1 2, 3 4, 5 6),POINT( 1 2
3))'::GEOMETRY as geom;</FONT></DIV>
<DIV><FONT size=2> ..............</FONT></DIV>
<DIV><FONT size=2> I think the error is the following code!</FONT></DIV>
<DIV><FONT size=2> </FONT></DIV>
<DIV><FONT
size=2>-----------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2>PG_FUNCTION_INFO_V1(geometry_in);<BR>Datum
geometry_in(PG_FUNCTION_ARGS)</FONT></DIV>
<DIV><FONT size=2>{</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> // handle the 2 variants of MULTIPOINT - 'MULTIPOINT(0
0, 1 1)'::geometry and 'MULTIPOINT( (0 0), (1 1))'::geometry;</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> // we cheat - if its the 2nd variant, we replace
the internal parethesis with spaces!<BR> if
(strstr(str,"MULTIPOINT") != NULL
)<BR> {<BR> //its a multipoint - replace
any internal parenthesis with spaces<BR> char
*first_paren;<BR> char
*last_paren;<BR> char *current_paren;</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> first_paren= index
(str,'(');<BR> last_paren = rindex(str,')');</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> if ( (first_paren == NULL) ||
(last_paren == NULL) || (first_paren >last_paren)
)<BR> {<BR> elog(ERROR,"couldnt
parse objects in GEOMETRY (parenthesis
related)\n");<BR> PG_RETURN_NULL()
;<BR> }<BR> //now we can just got
through the string<BR> for (current_paren =
(first_paren+1); current_paren
<(last_paren);current_paren++)<BR> {<BR> if
( (current_paren[0] ==')') || (current_paren[0]=='(')
)<BR> {<BR> current_paren[0]
= '
';<BR> }<BR> }</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> }</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> </DIV>
<DIV><BR>}</FONT></DIV></BODY></HTML>