Only request returning attribute if client supports returning#1770
Conversation
ricardograca
left a comment
There was a problem hiding this comment.
Thanks for this, but the test suite must pass before this gets merged.
|
@ricardograca Thanks, I've updated the PR to pass the tests. |
ricardograca
left a comment
There was a problem hiding this comment.
This is something that probably should be abstracted away in knex, but for now we'll handle it.
|
Hi, I am struggling with returning keyword as AWS Redshift does not support it. Please let me know how should i configure in Bookshelf.js. I am using "bookshelf": "^1.0.0" , "knex": "^0.19.4" and "pg": "^7.12.1" Please guide |
|
AWS Redshift is not in the list of clients that support |
|
The problem is that that Redshift is pg compliant, and so I'm assuming @sachincloudnaut uses pg driver, which do support it - while Redshift does not. So Bookshelf thinks this is fine, Redshift disagrees. |
|
Let's continue the discussion in #2024. |
Introduction
knex0.14.4 has been updated such that a warning is logged when using thereturningattribute in a SQL dialect that does not support it.bookshelfalways requests areturningattribute during aninsert, which causes a flood of unwarranted warning messages whenever sqlite3 is used, and there is no way to tellbookshelfnot to specifyreturning.Motivation
When running my tests, I see warning messages like this flood my logs every time I call an
insert:Proposed solution
My solution is to check if the current client supports
returningand request theidAttributeif and only if the support is available.Current PR Issues
N/A
Alternatives considered
Also considered updating the client within
knexto be able to do this logic. However, due to the fact that this change was implemented on theknexside, I have to assume that this is intended behavior.