[postgis-users] check constraints violated - ¿how to fix this?

ricardd at mathstat.dal.ca ricardd at mathstat.dal.ca
Tue Oct 25 06:28:02 PDT 2005

Hello postgis-users,
Just a clarification about check constraints.

I'm running postgis 1.0.3 with postgreSQL 8.0.3 on Linux. The
spatial_ref_sys table was populated at installation with ESPG data using

My data is from fisheries surveys and some records only have a starting
position and no ending position. The spatial objects are defined as

SELECT AddGeometryColumn(
            'gs_inf', 'spos', -1, 'POINT',
SELECT AddGeometryColumn(
            'gs_inf', 'epos', -1, 'POINT',

I thought that I could use something like this to input data with missing
end position:

INSERT INTO gs_inf VALUES (GeomFromText('POINT(-66.7 44.8)',4326), NULL );

However, I get the following error message:

psql:gs_inf.sql.in:2: ERROR:  new row for relation "gs_inf" violates check
constraint "enforce_srid_spos"

Any suggestions how I can solve this? Setting the srid to -1 solves the
problem but I'm curious if there is another way.


More information about the postgis-users mailing list