linz / gazetteer

New Zealand Gazetteer of official place names
http://www.linz.govt.nz/regulatory/place-names/find-name/new-zealand-gazetteer-official-geographic-names/new-zealand-gazetteer-search-place-names#zoom=0&lat=-41.14127&lon=172.5&layers=BTTT
Other
2 stars 2 forks source link

ST_Force_2D: no function matches the given name #248

Closed billgeo closed 3 years ago

billgeo commented 3 years ago

Bug Description

[Wednesday 11:38] Chris Stephens

(psycopg2.errors.UndefinedFunction) function st_force_2d(geometry) does not exist

LINE 9: st_union(ST_Force_2D(g.shape))
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
QUERY: insert into tmp_all_shapes1 (feat_id, geom_type, geom )

select
g.feat_id,
g.geom_type,
st_union(ST_Force_2D(g.shape))
from
feature_geometry g
join feature f on g.feat_id = f.feat_id
group by g.feat_id, g.geom_type

CONTEXT: PL/pgSQL function gweb_update_gaz_all_shapes() line 17 at SQL statement
SQL statement "SELECT gweb_update_gaz_all_shapes()"
PL/pgSQL function gweb_update_web_database() line 11 at PERFORM

[SQL: select gazetteer.gweb_update_web_database()]

(Background on this error at: http://sqlalche.me/e/f405)
​[Wednesday 12:23] Slick Ultra
  Looks like we need to alter the function 'gazetteer.gweb_update_gaz_all_shapes()' called by 'gazetteer.gweb_update_web_database()' to use ST_Force2D (instead of ST_Force_2D) removing the second underscore:

This works:                                                                                                                                     
SELECT ST_AsEWKT(ST_Force2D(ST_GeomFromEWKT('CIRCULARSTRING(1 1 2, 2 3 2, 4 5 2, 6 7 2, 5 6 2)')));                                                                                                                                                                     
CIRCULARSTRING(1 1,2 3,4 5,6 7,5 6)

This doesn't                                                                                                                                 
SELECT ST_AsEWKT(ST_Force_2D(ST_GeomFromEWKT('CIRCULARSTRING(1 1 2, 2 3 2, 4 5 2, 6 7 2, 5 6 2)')));                                                                                                                                 

ERROR: function st_force_2d(geometry) does not exist LINE 1: SELECT ST_AsEWKT(ST_Force_2D(ST_GeomFromEWKT('CIRCULARSTRING... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. SQL state: 42883 Character: 18        

ST_Force_2d signature was deprecated in 2.1.0.

Steps to Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Desktop

Screenshots

SU-LINZ commented 3 years ago

Need the Datacom DBA to confirm it was only the function name that was deprecated.

billgeo commented 3 years ago

Yep. It's just a name change. We have automated tests to test most of the functionality. Unfortunately the web update functions are one area we don't test. Should be able to work on this today.

Breaking changes for POSTGIS 2.1+ can be found in here: https://postgis.net/stuff/postgis-3.0.pdf