Replies: 1 comment 2 replies
-
|
Thanks for pointing this out. The behavior is expected, but you are correct that it should be better documented. I'll add documentation to #import, as #multi_insert already documents it is a front-end to #import. In terms of the reasoning for the behavior, unless you specify I realize this behavior makes #multi_insert's return value dependent on the hashes passed in, which is probably suboptimal. I'm open to supporting a PostgreSQL-specific option to #import/#multi_insert to change it to force an array of hashes to be returned, even if only a single RETURNING column is used. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For
Dataset#insertwith#returning,the return value is an array of hashes regardless of how many columns are specified to#returning:But for
Dataset#multi_insert, the return value shape changes depending on the number of columns specified to#returning:This is a little surprising.
I see this documented in
sequel/lib/sequel/adapters/shared/postgres.rb
Line 2570 in 25ee6b9
#_import. Could it be documented closer to the "public" API? Maybe on#multi_insert, or do you have a better idea?FWIW, I'm on Sequel version 5.99.0.
Beta Was this translation helpful? Give feedback.
All reactions