How to get IDs of ALL new rows instead of just one from RDS.executeStatement?

0

When inserting rows into an Aurora RDS database, RDS will only return this:

{ generatedFields: [ { longValue: 26 } ], numberOfRecordsUpdated: 3 }

Which is obviously wrong and pretty useless. RDS knows it just inserted 3 rows, but only returns 1 new ID (not even the last one, but the first). Is there any way to fix this and get the full, correct information?

(Calling RDS from Lambda Node btw)

質問済み 2年前434ビュー
2回答
0

Hello Kevin!

Q1: I'm afraid I am not quite sure what your question is. The returned object looks exactly like posted. The only ID returned is the 26 there. Q2: If there were 3 records updated, I would expect RDS to return 3 IDs, of course. Not only 1. Like this:

{ generatedFields: [{ longValue: 26 }, { longValue: 27 }, { longValue: 28 }] , numberOfRecordsUpdated: 3 }
回答済み 2年前
  • Hi,

    Thank you for getting back to me here with desired view. Let me check with the team and get back to you with feedbacks.

0

Hi,

From the description, if I am understanding correct are you referring to that:

From lambda, when you insert 3 rows to the Aurora RDS database (Aurora MySQL/PostgreSQL/MySQL Serverless/PostgreSQL Serverless, may you confirm which one?) then you are getting below as return from insert call:

{ generatedFields: { longValue: 26 } , numberOfRecordsUpdated: 3 }

Q1: May you elaborate how the return of ID looks like?

From the public doc: https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_ExecuteStatement.html#API_ExecuteStatement_ResponseElements

The returned field as listed.

Q2: May you elaborate more on how you want the return looks like?

AWS
サポートエンジニア
Kevin_Z
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ