Opened 15 years ago

Closed 13 years ago

#490 closed defect (fixed)

[raster] raster casts to geometry and box3d should be assignment not implicit?

Reported by: robe Owned by: dustymugs
Priority: low Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc:

Description

It appears I can do this:

SELECT ST_SRID(rast) As srid, ST_AsText(ST_Union(rast)) AS wktrast
FROM dummy_rast
GROUP BY ST_SRID(rast);

SELECT ST_SRID(rast) As srid, ST_Extent(rast) AS extrast
FROM dummy_rast
GROUP BY ST_SRID(rast);

Which at first glance I thought was cool, but then realized its probably not cool. I'm still thinking about why this is bad. For geography we decided this was bad because geography aren't cartesian coords so the answer is technically wrong. In case of raster its not quite so clear. I guess I think all non-trivial implicit casts are bad, but that's the database purist in me talking.

So consider this just a flagging of questionable behavior. Not necessarily that I am disagreeing with it.

Change History (15)

comment:1 by robe, 15 years ago

Summary: raster casts to geometry and box2d should be assignment not implicit?[wktraster] raster casts to geometry and box2d should be assignment not implicit?

comment:2 by pracine, 14 years ago

I guess the results are of some value until we get ST_Union working on the raster type.

What's wrong with the second example? You got the total extent of the raster coverage, right?

comment:3 by pracine, 14 years ago

Milestone: WKTRaster 0.1.6PostGIS 2.0.0
Owner: changed from pracine to robe

comment:4 by pracine, 14 years ago

Summary: [wktraster] raster casts to geometry and box2d should be assignment not implicit?[raster] raster casts to geometry and box2d should be assignment not implicit?

comment:5 by robe, 14 years ago

It's fine. I was more bothered by the autocast. Actually the main reason I was bothered is going to be more of an issue anyway. I think we'll just have to change people's behavior relying on autocasts as now that we have 3 versions of ST_Intersection .. anybody typing in , :geometry etc. is going to get an ambiguous function error message as I already experienced with topology.

The hack we put in place when we introduced geography by defining an ST_Intersection(text,text) and others so that unknowns fall into that function will only get us so far and I'd much prefer people just not relying on them so we don't have the issue in the first place.

comment:6 by dustymugs, 13 years ago

Summary: [raster] raster casts to geometry and box2d should be assignment not implicit?[raster] raster casts to geometry and box3d should be assignment not implicit?

comment:7 by pracine, 13 years ago

Any development here?

comment:8 by pramsey, 13 years ago

Any development here?

comment:9 by strk, 13 years ago

Any development here? (infinite loop detected?)

comment:10 by robe, 13 years ago

Milestone: PostGIS 2.0.0PostGIS 2.1.0

How about we just push this to the next and end this infinite loop until some other day. I don't think there are too many cases where its an issue as much as it was with geometry / geography.

comment:11 by dustymugs, 13 years ago

Now that I actually read and thought a bit about the description, I prefer assignment (explicit?) rather than implicit. If it remains implicit, debugging complex queries can be a nightmare.

comment:12 by dustymugs, 13 years ago

Milestone: PostGIS 2.1.0PostGIS 2.0.0

comment:13 by dustymugs, 13 years ago

Owner: changed from robe to dustymugs
Status: newassigned

comment:14 by dustymugs, 13 years ago

I've tested changing the CASTs from IMPLICIT to ASSIGNMENT, upgraded an existing database and haven't had any issues with the change. I did have to update some usage of "raster && geometry" in rtpostgis.sql.in.c to be explicit.

I'll commit if no one has any issues.

comment:15 by dustymugs, 13 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r9282

Note: See TracTickets for help on using tickets.