#877 closed defect (fixed)
st_estimated_extent returns error on empty table
Reported by: | martins | Owned by: | pramsey |
---|---|---|---|
Priority: | high | Milestone: | PostGIS 1.5.4 |
Component: | postgis | Version: | 1.5.X |
Keywords: | history | Cc: |
Description
To reproduce:
create table t(gid serial); select addgeometrycolumn('t','g',4326,'GEOMETRY',2); vacuum analyze t; select st_estimated_extent('t','g');
ERROR: LWGEOM_estimated_extent: couldn't locate table within current schema
This is especially annoying for us, because we must execute estimated_extent inside a transaction.
Could the function be changed to return NULL instead of an error in this case?
Change History (17)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
I think the correct behaviour should be to mimic what "SELECT ST_Extent(foo) FROM table" returns on an empty table, and reduce the message to a WARNING.
comment:4 by , 14 years ago
Note that with current trunk the error message is this: ERROR: LWGEOM_estimated_extent: no statistics for "(current_schema)"."t"."g" (empty table ? did you run ANALYZE ?)
The condition is the same when the table is NOT empty but you didn't run analyze yet. Do we want to always return NULL, or try to tell the two cases apart ?
comment:5 by , 14 years ago
Milestone: | PostGIS 1.5.3 → PostGIS 1.5.4 |
---|
comment:7 by , 13 years ago
The quickest would be producing a patch and attaching to this ticket, or paying someone to do that for you. Shouldn't take more than a couple of hours.
comment:9 by , 13 years ago
Keywords: | history added |
---|
Fixed by r8319 in trunk and r8317 in 1.7 branch.
Documentation would need to be tweaked to reflect the semantic change. Not sure which expressions to use there. Robe ? Speaking of which, I've seen we advertise "VACUUM ANALYZE" as being the command gathering the statistics while "ANALYZE" is enough (and tested now within regress/ticket.sql)
comment:10 by , 13 years ago
you know you could update these things yourself. I guess I'd much rather have people run too much than too little as I don't want to hear their problems when they deleted or updated records. I think nowadays running vacuum analyze is just as fast because with the new changes in freespace map I forget which version -- 8.4 or 9.0 -- PostgreSQL is smart enough to know when a VACUUM is not necessary. So better to ere on the side of too much than too little. :)
I didn't know we had a 1.7 branch of PostGIS. When did this come about and why did no one inform me
comment:11 by , 13 years ago
Oops, it was 1.5 of course. Ok with keeping "vaccum analyze". About noticing the difference introduced (NULL instead of exception) I can surely do that myself. Was just asking about a tip for where to look about properly encoding the version-dependent change (some other function that has an example of which docbook tags to use for that?)
comment:12 by , 13 years ago
comment:13 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:14 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Something deeply wrong in this fix on OSX, will have to examine... fortunately the ticket regression picked it up.
comment:15 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:16 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed the OSX regression in 1.5 at r8985
+1
See also #510
I'd also like to see that message reworded...