Hi,<br>


i found the cause of the postgres crash due to the excecution of the collect() function. Following a short description. <br><div><span class="gmail_quote"><br>
2006/1/19, Michael Fuhr <<a href="mailto:mike@fuhr.org">mike@fuhr.org</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Thu, Jan 19, 2006 at 05:01:14PM +0100, Christian Sengstock wrote:
<br>> i've got a problem with a signal 11 termination of my postgres database. the<br>> error occurs then querying my geo tables with the collect() function of<br>> postgis. anyone knows what the signal 11 error means?
</blockquote><div><br>
 </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On most systems signal 11 is a segmentation fault; it generally<br>means that a program has attempted to use memory it's not allowed
<br>to use.  That usually indicates a programming bug.<br><br>> Postgis_version: 1.0<br><br>1.0.what?  What does "SELECT postgis_full_version()" show?  Recent<br>versions have fixed several crash-causing bugs, so if you're not
<br>running the latest code (1.0.6 or 1.1.0) then try upgrading.  If<br>you still get crashes then please post a simple but complete test<br>case so others can try it.</blockquote><div><br>

My postgis_full_version() is POSTGIS="1.0.2" GEOS="2.1.1" PROJ="Rel.
4.4.9, 29 Oct 2004" USE_STATS DBPROC="0.3.0" RELPROC="0.3.0". Maybe
this behaviour does not occur in the following versions. Could not test
that. </div><br>
</div>The crash occurs if the first record of a geometry set, which is the
argument of the collect() function is NULL, and there's a not NULL
record following. No problem occurs if the argument is just a set of
NULL values.<br>


<br>


Hence, if you have the following tables (see below) the query ...<br>
<br>


# SELECT collect(geom) FROM rs_1;<br>
<br>


will work, because there's no NULL record at the beginning.<br>
<br>


# SELECT collect(geom) FROM rs_2;<br>
<br>


will not work, because the first record is a null value.<br>


<br>
<br>


-- Create rs_1 with geometry in every record<br>


CREATE TABLE rs_1 (id serial PRIMARY KEY, type int8);<br>


SELECT AddGeometryColumn('','rs_1','geom','-1','MULTILINESTRING',2);<br>


INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474442.25 5475262,3474440.25
5475299,3474436.75 5475333.5,3474433.25 5475345)) ') );<br>


INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474350 5475010.5,3474375.25 5475065,3474407.5
5475140.5,3474420.77060961 5475162.09117775)) ') );<br>


INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474416.5 5475518.5,3474415.25
5475521,3474379.93050191 5475573.4185714)) ') );<br>


INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474433.25 5475345,3474429
5475422.5,3474428.25 5475474.5,3474416.5 5475518.5)) ') );<br>


<br>


-- Create rs_2 with NULL geometry in first record<br>


CREATE TABLE rs_2 (id serial PRIMARY KEY, type int8);<br>


SELECT AddGeometryColumn('','rs_2','geom','-1','MULTILINESTRING',2);<br>


INSERT INTO rs_2 (type, geom) VALUES (1, NULL );<br>


INSERT INTO rs_2 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474350 5475010.5,3474375.25 5475065,3474407.5
5475140.5,3474420.77060961 5475162.09117775)) ') );<br>


INSERT INTO rs_2 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474416.5 5475518.5,3474415.25
5475521,3474379.93050191 5475573.4185714)) ') );<br>


INSERT INTO rs_2 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474433.25 5475345,3474429
5475422.5,3474428.25 5475474.5,3474416.5 5475518.5)) ') );<br><br clear="all"><br>
I will try this on a newer postgis version now. maybe this will not occur anymore.<br>
<br>
thanx,<br>
chris<br>