step.db_exec: add returning mode to capture rows from RETURNING clause#300
step.db_exec: add returning mode to capture rows from RETURNING clause#300
returning mode to capture rows from RETURNING clause#300Conversation
…g option Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
returning mode to capture rows from RETURNING clause
There was a problem hiding this comment.
Pull request overview
Adds an opt-in returning mode to step.db_exec so INSERT/UPDATE/DELETE statements that include a PostgreSQL-style RETURNING clause can return rows (avoiding the current workaround of using step.db_query for write operations).
Changes:
- Extend
DBExecStep+ factory config parsing to supportreturning: trueandmode: list|single(validated at build time). - Update
DBExecStep.Execute()to useQuery()and returnrows/countorrow/foundoutputs whenreturningis enabled. - Add tests for returning single/list behavior and invalid-mode rejection; update docs entry for
step.db_exec.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| module/pipeline_step_db_exec.go | Adds returning + mode config and implements row-returning execution path via Query() with db_query-like outputs. |
| module/pipeline_step_db_exec_test.go | Adds unit tests covering returning single/list modes and factory-time invalid mode validation. |
| DOCUMENTATION.md | Documents step.db_exec support for returning: true with mode. |
|
@copilot apply changes based on the comments in this thread Build failing, lint failing, tests failing, config validation failing |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
…ix error message and docs markdown Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Addressed all review feedback in commit
|
|
@copilot Look at the changes that happened in main, vs our branch, and intelligently resolve the conflict while preserving intent of both sets of changes. |
…NBytesOrString into scanSQLRows helper Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Merged in commit
Resolution: kept our shared-helper + |
|
@copilot Address the build, lint, test, config validation failures |
…tion in pipeline_step_db_query.go Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Fixed in commit |
|
@copilot Address the incoming conflict. The documentation section that is conflicted added a new column to it's table and the docs have been reordered. accept the incoming format and make sure any additions you're introducing are intelligently reflected. |
…in format, add returning clause to step.db_exec entry Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Resolved in commit All the additional steps and sections added in main (CI/CD, Platform, etc.) are preserved. |
step.db_execcalleddb.Exec()unconditionally, discarding rows from PostgreSQLRETURNINGclauses. The only workaround was semantically incorrect use ofstep.db_queryfor write operations.Changes
DBExecStep: Addedreturning boolandmode stringfieldsreturningandmodefrom config; validatesmodeis"list"or"single"whenreturning: true(defaults to"list"); invalid values rejected at build timeExecute(): Whenreturning: true, usesdb.Query()and processes rows identically tostep.db_query—mode: single→{row, found},mode: list→{rows, count};ignore_errorcontinues to work in both modesstep.db_exectable entryUsage
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.