Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

Why my query works on VIEW and doesn't work on a similar table?

$
0
0

I have a view openstreetmapview that combines two tables with different columns. The first table is openstreetmap and the second is B.

When I execute this query on the view:

select this_.gid             as y0_
     , this_.openstreetmapId as y1_
     , this_.name            as y2_
     , this_.streetType      as y3_
     , this_.oneWay          as y4_
     , this_.location        as y5_
     , this_.isIn            as y6_
     , this_.countryCode     as y7_
     , length                as y8_
     , distance_sphere(
           GeometryFromText(
               'POINT(11.059734344482422 46.07373046875)',4326)
             , ST_line_interpolate_point(
                       this_.shape
                      , st_line_locate_point(
                             this_.shape
                           , GeometryFromText('POINT(11.059734344482422 46.07373046875)', 4326)
                      )
                )
       ) as y9_
     , ST_AsText(ST_ClosestPoint(
               this_.shape,GeometryFromText( 'POINT(11.059734344482422 46.07373046875)', 4326)
       )) as y10_ 
from OpenStreetMapView this_ ;

Then, I get around 50k results. When I execute the same query on the table even though the table has the same column that the query needs, it returns 0 rows. Why is that?

I use PostgreSQL 8.4 database and PostGIS .


Viewing all articles
Browse latest Browse all 1138

Trending Articles