Opened 12 years ago

Closed 12 years ago

#1937 closed defect (invalid)

must specify "true" to st_length when casting to geography

Reported by: bcrosby Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.2
Component: postgis Version: 2.0.x
Keywords: Cc:

Description

The following:

st_length(ST_MakeLine(ARRAY[st_geomfromewkt('SRID=4326;POINT(-79.3687166666667 43.86085)'), st_geomfromewkt('SRID=4326;POINT(-73.7409333333333 45.4704666666667)')])::geography)

Returns:

ERROR:  function st_length(geography) is not unique
LINE 1: select st_length(ST_MakeLine(ARRAY[st_geomfromewkt('SRID=432...
               ^
HINT:  Could not choose a best candidate function. You might need to add explicit type casts.

However, this works:

select st_length(ST_MakeLine(ARRAY[st_geomfromewkt('SRID=4326;POINT(-79.3687166666667 43.86085)'), st_geomfromewkt('SRID=4326;POINT(-73.7409333333333 45.4704666666667)')])::geography,true);

Returns:

    st_length
------------------
 480679.079363184
(1 row)

Previous behaviour (in 1.5), you did not need to specify "true" as the second parameter to st_length.

Not sure if this is a bug, or if the documentation should be updated? (I was under the impression that 'true' was the default).

Change History (1)

comment:1 by robe, 12 years ago

Resolution: invalid
Status: newclosed

I suspect your upgrade was dirty and you did not run the postgis_upgrade_20_minor.sql after restoring ontop of a new PostGIS 2.0.1 database.

This is one change — a lot of functions were changed to use default args, so simply restoring ontop of a PostGIS 2.0.1 will not work.

To fix: Run postgis_upgrade_20_minor.sql

If you installed using extensions, then you will need to just run all the drop statements at the end of that script.

Actually the drop statements is really all you need. I was just didn't want to confuse people by explaining that.

Note: See TracTickets for help on using tickets.