尝试运行查询并将计数设置为较低的数字

时间:2019-03-24 11:00:01

标签: postgresql

PostgreSQL语法问题。

下面的查询将运行,但结果是:

  

错误:查询结果内存不足

SELECT
AD.ADDRESS_DETAIL_PID as ADDRESS_DETAIL_PID,
AD.STREET_LOCALITY_PID as STREET_LOCALITY_PID,
AD.LOCALITY_PID as LOCALITY_PID,
AD.BUILDING_NAME as BUILDING_NAME

将查询修改为:

set FETCH_COUNT=1000
SELECT
AD.ADDRESS_DETAIL_PID as ADDRESS_DETAIL_PID,
AD.STREET_LOCALITY_PID as STREET_LOCALITY_PID,
AD.LOCALITY_PID as LOCALITY_PID,
AD.BUILDING_NAME as BUILDING_NAME

结果是:

  

错误:“ SELECT”处或附近的语法错误第3行:SELECT           ^ SQL状态:42601字符:23

除了冒号时;最后的结果是:

  

错误:无法识别的配置参数“ fetch_count”的SQL状态:   42704

我正在寻求有关语法的帮助。

1 个答案:

答案 0 :(得分:0)

FETCH_COUNT是一个psql区间变量,不在服务器上执行。

SET是在服务器上执行的SQL命令,不能用于设置psql内部变量。改用\set

\set FETCH_COUNT 1000