[postgis-users] Geometry vs Linestring

Stephen Woodbridge woodbri at swoodbridge.com
Wed May 7 06:56:45 PDT 2014


Linestrings are geometry objects. If you want your table to have tighter 
constraints on it create the table first and use addgeometrycolumn() to 
set the geometry type and constraints then use

insert into "l_506" (oid, geom) from SELECT ...

CREATE TABLE AS does not know what the query will return as far as 
geometry types so it make a general "geometry" column.

-Steve

On 5/7/2014 9:38 AM, Pier Lorenzo Marasco wrote:
> Hi all,
>
> I'm trying to make something very easy but I've a problem with results.
> I've two tables and I need to make lines from the joins of these two.
> I've try with this :
>
> CREATE TABLE "l_506" AS
> SELECT elements.oid, ST_MakeLine(seeds.geom) AS geom
> FROM elements
>     JOIN seeds ON (elements.oid=seeds.oid)
> WHERE elements.code='0506'
> GROUP BY elements.oid;
>
> All the elements in seeds are linestring but what I achieve is a
> geometry table. Ok.. I should alter the column type and everything goes
> as I aspect but I would like to understand where I'm getting wrong.
>
> L.
>
> --
> Pier Lorenzo Marasco
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list