【问题标题】:Why does this result in a "org.postgresql.util.PSQLException: The column index is out of range" exception?为什么这会导致“org.postgresql.util.PSQLException:列索引超出范围”异常?
【发布时间】:2021-05-25 04:44:59
【问题描述】:

我正在尝试从 Ignition (8.0.16) 作为命名查询在 PostgreSQL 11 服务器中运行一个函数,并得到一个列索引错误。关于 Postgres 讨论此错误的所有地方都表明这是提供的参数和预期的参数数量不匹配的问题。

它总是显示为超出范围的数字比提供的数字多一。即使更改为使用不同数量的参数。

我到处数 13:Ignition 参数、测试参数、Ignition 中的函数调用、函数定义、表格。这是来自 Ignition 的函数调用:

SELECT insert_run_data(
:speed_in,
:avg_speed_in,
:coater_num_in,
:coater_op_in,
:finisher_in,
:helper1_in,
:helper2_in,
:coater_down_in,
:current_downtime_reason_in,
:hanging_downtime_reason_in,
:tabcode_in,
:start_time_in,
:end_time_in
);

在同一个命名查询窗口中,如果我注释掉函数调用并尝试使用相同的参数直接编写,它会毫无问题地编写:

insert into 
nh_coater_tabcode_operator_data(
speed, avg_speed, coater_num, coater_op, finisher, helper1,
helper2, coater_down, current_downtime_reason,
hanging_downtime_reason, tabcode, start_time, end_time
)
  
values(:speed_in, :avg_speed_in, :coater_num_in, :coater_op_in,
:finisher_in, :helper1_in, :helper2_in, :coater_down_in,
:current_downtime_reason_in, :hanging_downtime_reason_in, :tabcode_in,
:start_time_in, :end_time_in
);

该函数在 PGAdmin 中也可以正常运行。

以下要点显示用于创建表和函数的 SQL、来自 Ignition 的堆栈跟踪以及显示命名查询创作窗口参数匹配的图像:

create function gist

create table gist

stack trace of error gist

parameters in Ignition

【问题讨论】:

    标签: postgresql ignition


    【解决方案1】:

    Ignition Designer 似乎缓存了该函数。因此,如果它被更改,您将需要保存并重新打开项目:打开另一个然后切换回来或关闭并打开一个新的设计器窗口。

    【讨论】:

      猜你喜欢
      • 2012-02-16
      • 2012-08-24
      • 2016-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-13
      • 2020-08-16
      • 2020-09-04
      相关资源
      最近更新 更多