4

I'm trying to do a dblink using a postgis function, but the linestring has given me many problems.

SELECT 
    DV3."XXX",
        s."QQQID",s."X",s."Y",a."PPP"
FROM 
    "QQQ" s INNER JOIN "AAA" a ON a."QQQID" = s."QQQID",
    dblink('dbname=ZZZ',
        'SELECT XXX,the_geom 
        FROM "geometry", "QQQ" s 
        WHERE box2d(geomfromtext(''LINESTRING('|| s."X" ||' '||s."Y" ||','|| s."X" || ' '||s."Y" || ')'',2309))
        && the_geom'
                           ) 
        DV3("XXX" INTEGER,"the_geom"  geometry)


WHERE 
    contains(DV3.the_geom,geomfromtext('POINT('|| s."X" ||' '|| s."Y" ||')',2309))--21
    AND "GGG" IS NOT NULL

ERROR

LINE 9: ... WHERE box2d(geomfromtext(''LINESTRING('|| s."X" + 0....

1 Answers1

2

Following what Tanzeeb said, there are two instances of two single quotes right next to each other that look like they are supposed to be double quotes instead of two single quotes.

In

    'SELECT XXX,the_geom 
    FROM "geometry", "QQQ" s 
    WHERE box2d(geomfromtext(''LINESTRING('|| s."X" ||' '||s."Y" ||','|| s."X" || ' '||s."Y" || ')'',2309))
    && the_geom'

Right before LINESTRING and right before ,2309.

colboynik
  • 447
  • 4
  • 15