[postgis-users] Incorrect geometry_columns?

Nicolas Ribot nicolas.ribot at gmail.com
Mon Dec 10 04:02:46 PST 2012


Hi,

To take advantage of the gc view, geometric tables have to be created with
a typemod on the geometry type, to allow system to know both geoemtry's
type and SRID.
If you create the table by a "create table as select ...", you would have
to alter the table to use the typemod:

create table test as select code_dept, st_centroid(geom) as geom from dept;

 select * from geometry_columns;
nicolas         | public         | test         | geom              |
        2 |    0 | GEOMETRY

alter table test alter COLUMN geom type geometry('POINT', 2154);

select * from geometry_columns;
nicolas         | public         | test         | geom              |
        2 | 2154 | POINT

Nicolas


On 10 December 2012 12:47, Paolo Cavallini <cavallini at faunalia.it> wrote:

> Il 09/12/2012 16:21, Francois Hugues ha scritto:
> > As I can see in the view definition, srid comes from postgis constraint
> : COALESCE(NULLIF(postgis_typmod_srid(a.atttypmod), 0),
> postgis_constraint_srid(n.nspname::text, c.relname::text, a.attname::text),
> 0) AS srid,
> >
> > Did you have / did you try to add this kind of constraint on your table :
> >
> > CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 3003) ?
>
> Hi all.
> More info: the lack of SRID and geometry type in the geometry_columns
> happens only
> for the tables created by PostGIS functions (e.g. st_union, st_convexhull,
> etc.).
> Is this a known issue?
> All the best.
> --
> Paolo Cavallini - Faunalia
> www.faunalia.eu
> Full contact details at www.faunalia.eu/pc
> Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121210/a8a127f5/attachment.html>


More information about the postgis-users mailing list