On Mon, Aug 12, 2013 at 8:58 PM, Justin Deoliveira wrote: Great, thanks Mike. That definitely narrows it down. Looks like we need to update the wrapper that comes into play when renaming to pass down the function natively. Do you mind opening a jira ticket for this? Thanks. On Mon, Aug 12, 2013 at 10:44 AM, Mike Grogan wrote: Justin, Yes, the layer name does seem to be causing an issue. To clarify, this is for the NON-SQL-VIEW layer. The underlying postgis table is "latest", as is the name of the store. If I name the layer "latest" in Geoserver "Edit Layer", I see the following query upon a GetCapabilities: 12 Aug 16:36:08 DEBUG [org.geotools.jdbc] - CREATE CONNECTION 12 Aug 16:36:08 DEBUG [org.geotools.jdbc] - SELECT distinct("timestamp") FROM "public"."latest" 12 Aug 16:36:09 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION If I rename the layer in Geoserver to something else ... "latestxxx", while leaving the postgis layer & store as "latest", I see the following query: 12 Aug 16:37:09 DEBUG [org.geotools.jdbc] - CREATE CONNECTION 12 Aug 16:37:09 DEBUG [org.geotools.jdbc] - SELECT "timestamp" FROM "public"."latest" 12 Aug 16:37:16 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION So, the distinct() aggregate does seem to be disappearing if the layer name is not the same as the store/table name. Hope this helps, and thanks for looking at this. - Mike On Mon, Aug 12, 2013 at 12:01 PM, Justin Deoliveira wrote: The changes I made where indeed backported to 9.x. https://github.com/geotools/geotools/pull/195 http://jira.codehaus.org/browse/GEOT-4457 They should have been released for geotools 9.3 which i believe would have made it into geoserver 2.3.3? So it may be in this case there is an intermediate wrapper being used that we are not accounting for. One thing that comes to mind might be a layer renaming. @Mike: What is the published layer name (ie the layer you request from geoserver) in this case? Is it called "latest". If the published layer is not named "latest" can you try temporarily renaming it to "latest" and see if that affects anything. On Fri, Aug 9, 2013 at 8:49 AM, Mike Grogan wrote: Thanks, Andrea and Justin. I'm not quite following the flow of the code yet, but trying. If Justin has a chance to review my description and log excerpts at some point, that would be great, too. I appreciate your response. - Mike Grogan On Thu, Aug 8, 2013 at 1:45 PM, Andrea Aime wrote: On Thu, Aug 8, 2013 at 7:28 PM, Mike Grogan wrote: Can anyone point me to the point in the source where these queries are made to determine the times for the time dimensions for WMS GetCapabilities and postgis stores? The problem described in my earlier post continues to perplex me ... and I can't find the location in the source to look for myself. I have tried! GeoServer code almost never knows about the nature of the underlying storage, it uses the GeoTools API to access data, in this case, it's using a UniqueVisitor if possible (or a min/max one depending on the representation type): https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/WMS.java#L947 This in turn should lead to the encoding of a aggregate function here: https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCDataStore.java#L1279 However, there might be some hiccups in the intermediary classes between the first and the second code bits, maybe a wrapper that does reprojection, crs forcing or something like that misses the appropriate delegation. Which is actually something Justin (cc'ed) tried to fix some time ago, but not sure in which branch that work landed? It might be that 2.4 beta does not exhibit this problem anymore. Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- -- Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial.