Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres查询在Windows上运行,但在Linux上不运行_Postgresql - Fatal编程技术网

Postgresql Postgres查询在Windows上运行,但在Linux上不运行

Postgresql Postgres查询在Windows上运行,但在Linux上不运行,postgresql,Postgresql,此查询在Windows上的PostgreSQL 11.11上运行,但在Linux web主机上运行的PostgreSQL 9.2.24上失败。托管公司并不急于升级Postgres。是否对查询进行了更改,使其可以在两个版本上运行?lateral联接在Postgres 9.3中引入,在您不支持的Postgres版本中不可用。Postgres9.2已经有近5年没有维护了,不应该用于生产。我不会和这样的托管公司做生意。 SELECT a.*, b.* FROM readings a left j

此查询在Windows上的PostgreSQL 11.11上运行,但在Linux web主机上运行的PostgreSQL 9.2.24上失败。托管公司并不急于升级Postgres。是否对查询进行了更改,使其可以在两个版本上运行?

lateral
联接在Postgres 9.3中引入,在您不支持的Postgres版本中不可用。Postgres9.2已经有近5年没有维护了,不应该用于生产。我不会和这样的托管公司做生意。
SELECT a.*, b.* 
FROM readings a 
  left join lateral (
     select distinct on (meterno) o.* 
     from offsets o 
     where a.datetime > o.timedate 
     order by o.meterno, o.timedate desc
  ) b ON a.MeterNum = b.MeterNo 
WHERE a.meternum = 3 
  AND a.LynxKey = 8 
ORDER BY a.DateTime DESC