Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pg] Add insert/update array support in aws-data-api #1911

Merged
merged 9 commits into from
Apr 10, 2024

Conversation

livingforjesus
Copy link
Contributor

Currently in drizzle, if you want to insert or update an array, there is a typing issue like this:

DatabaseErrorException: ERROR: column "images" is of type text[] but expression is of type text; Hint: You will need to rewrite or cast the expression.

This PR Adds support for for fixing this issue via auto-casting in this situation.

Changes:

  • Added support for more types or array values in getValueFromDataApi
  • Updated aws-data-api postgres driver to automatically cast array values

@livingforjesus livingforjesus changed the title [Pg] Add insert/update array support [Pg] Add insert/update array support in aws-data-api Feb 21, 2024
@livingforjesus
Copy link
Contributor Author

Created to fix #1912

Currently, trying to insert text[] or any other kind of array fails in data-api
This is a workaround for that by manually casting array params.
update

Previously, I was doing automatic casting for arrays for insert and not update.
Fixed this
mapToDriverValue function

Previously, I manually converted array to driver string value. However,
after further inspection I realised it was better to use column mapToDriverValue
function.
My previous changes in test file broke a couple tests. I've fixed this now
@dankochetov dankochetov merged commit 59f2958 into drizzle-team:beta Apr 10, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants