将 postgresql 身份值获取到 SSIS 执行 SQL 任务中的变量时出错

Error while getting postgresql identity value to the variable in SSIS Execute SQL Task

[Execute SQL Task] Error: An error occurred while assigning a value to variable "varjobactivityid": "Value does not fall within the expected range.".

我在从 postgresql 检索最后插入的 id 到 SSIS 变量时遇到上述错误。在 MSSQL 中我们有 SCOPT_IDENTITY().

我试过 RETURNING idcurrval('persons_id_seq')currval(pg_get_serial_sequence('persons','id')),但没有用。我想问题出在 ODBC 驱动程序上。

下面是我用来从变量中获取最后插入的 id 的代码

"INSERT INTO table1 (targettable,filename,processeddatetimeutc) 
    VALUES ('tablename', '" + @[User::filename]+ "', '" + (DT_STR, 30, 1252) GETUTCDATE()+ "');
RETURNING activityid as id"

结果集:单行;

SSIS 变量数据类型: int32;

Postgresql 数据类型: 串行 (int4)

我也尝试使用 ExecValueVariable 作为我捕获结果的变量,但每次输出都是 1

使用这些设置 尝试更改 ODBC 连接的 resultname to 1