[postgis-users] constraint issue in 2.0.2 r10789

Francois Hugues hugues.francois at irstea.fr
Sat Dec 15 05:27:56 PST 2012


Hello,

Sorry for previous message : finger error. To give you some answers to your question :
1. In post gis 2 you may use typemod instead of constraints. This change the behavior of addgeometrycolumn function. You may read the notes here : http://postgis.refractions.net/docs/AddGeometryColumn.html 
2. I think the first error comes from the constraint you are trying to drop but which does not exist. 

Hugues 

"Gery ." <gamejihou at hotmail.com> a écrit :


Hello,

I recently upgraded both my postgresql (from 8.4.4 to 9.2.2) and postgis (from 1.5.3 to 2.0.2 r10789). With the previous versions I run these commands without problems:

[code]
CREATE TABLE profiles_line_wgs84(
GID SERIAL,
ID SMALLINT,
FID SMALLINT,
SURVEY VARCHAR(100),
PROFILE VARCHAR(100),
TYPE VARCHAR(100),
SOURCE VARCHAR(100),
NR_TRACES VARCHAR(100),
TRACE_SPACE_M VARCHAR(100),
LENGTH_M FLOAT,
COMMENTS TEXT
);
SELECT AddGeometryColumn('public', profiles_line_wgs84', 'geom', 4326, 'LINESTRING', 2);
CREATE INDEX profiles_line_wgs84_geom ON profiles_line_wgs84 USING GIST ( geom );

ALTER TABLE profiles_line_wgs84 DROP CONSTRAINT enforce_geotype_geom;
ALTER TABLE profiles_line_wgs84 ADD CONSTRAINT enforce_geotype_geom CHECK ((geometrytype(geom) = ANY (ARRAY['MULTILINESTRING'::text, 'LINESTRING'::text])) OR geom IS NULL);
[/code]

now with postgis 2.0.2 I get these errors:

[code]
CREATE TABLE
                             addgeometrycolumn                             
---------------------------------------------------------------------------
 public.seismic_profiles_line_wgs84.geom SRID:4326 TYPE:LINESTRING DIMS:2 
(1 row)

CREATE INDEX
psql:13_seismic_profiles_mergecsvshp2line.sql:119: ERROR:  constraint "enforce_geotype_geom" of relation "profiles_line_wgs84" does not exist
psql:13_seismic_profiles_mergecsvshp2line.sql:128: ERROR:  Geometry type (MultiLineString) does not match column type (LineString)
[/code]

it seems  to me that the constraint statement is ok, or is it something missing? any idea is appreciated,

Thanks in advance,

Best regards,

__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie NICHT, wenn es NICHT notwendig ist.
 		 	   		  


More information about the postgis-users mailing list