我正在尝试使用 postgis 函数执行 dblink,但是 linestring 给了我很多问题。

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

错误

最佳答案

按照 Tanzeeb 所说的,有两个单引号的实例彼此相邻,看起来它们应该是双引号而不是两个单引号。


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

就在 LINESTRING 之前,就在 ,2309 之前。

10-06 07:12