I just noticed some strange behavior in PostGIS, with respect to WKT parsing.
A GeometryCollection containing 1 or more empty geometries
postgis_test=# SELECT ST_GeomFromEWKT('GEOMETRYCOLLECTION(POINT EMPTY, LINESTRING EMPTY)');
010700000000000000
is the same an empty GeometryCollection
postgis_test=# SELECT ST_GeomFromEWKT('GEOMETRYCOLLECTION EMPTY');
010700000000000000
This doesn't seem right. But here's the truly weird part. If you throw a non-empty geometry into the collection, the empty geometries are suddenly represented in the collection:
postgis_test=# SELECT ST_GeomFromEWKT('GEOMETRYCOLLECTION(POINT EMPTY, LINESTRING EMPTY, POINT EMPTY)');
010700000000000000
postgis_test=# SELECT ST_GeomFromEWKT('GEOMETRYCOLLECTION(POINT EMPTY, LINESTRING EMPTY, POINT (1 2))');
0107000000030000000104000000000000000102000000000000000101000000000000000000F03F0000000000000040
It seems strange that empty geometries are only recognized if the collection contains at least one non-empty.
Is this is a bug? Is this behavior documented somewhere?