[PostGIS] #5829: SELECT geometry_columns returns unexpected error when there are constraints after SRID constraint.

PostGIS trac at osgeo.org
Tue Apr 22 09:35:35 PDT 2025


#5829: SELECT geometry_columns returns unexpected error when there are constraints
after SRID constraint.
-----------------------+---------------------------
  Reporter:  nbvfgh    |      Owner:  pramsey
      Type:  defect    |     Status:  new
  Priority:  critical  |  Milestone:  PostGIS 3.6.0
 Component:  postgis   |    Version:  3.5.x
Resolution:            |   Keywords:
-----------------------+---------------------------
Comment (by pramsey):

 I come at this with two impulses:

 * One is just to remove the constraint-reading bits of the view, since
 they date back to pre-2.0 postgis, when we didn't have typmods.
 * The other is to replace the string manipulation stuff with a single
 regex.

 {{{
 # select pg_get_constraintdef(177252);

                  pg_get_constraintdef
 -------------------------------------------------------
  CHECK (((st_srid(geom) = 4326) AND st_isvalid(geom)))

                                                                     ^
 # select regexp_match(
            pg_get_constraintdef(177252),
            'st_srid\(\w+\)\s*=\s*(\d+)', 'i');

  regexp_match
 --------------
  {4326}
 }}}

 That would be more reliable than the current code and leave in place the
 constraint support, for those 15 year old legacy systems we care about.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5829#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list