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

Fix Postgres Malformed array literal 2.4.0 Regression #5439

Merged
merged 2 commits into from Jan 17, 2023

Conversation

loren138
Copy link
Contributor

@loren138 loren138 commented Jan 12, 2023

Reverts #5321
Fix #5365
Fix #5430

Adds new test, which I confirmed fails without the changes to lib/client.js

@coveralls
Copy link

Coverage Status

Coverage: 92.372% (+0.003%) from 92.369% when pulling b3d6e99 on loren138:postgres-array-test into 3475d81 on knex:master.

Copy link
Contributor

@capaj capaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @loren138

@kibertoad kibertoad merged commit 1f2de49 into knex:master Jan 17, 2023
Cruikshanks added a commit to DEFRA/water-abstraction-system that referenced this pull request Jan 19, 2023
A recent change and test appear to be failing the build after this update to Knex. Checking the Knex changelog we found this

- [Bug fix: PostgreSQL: Fix Malformed array literal 2.4.0 Regression #5439](https://github.com/knex/knex/blob/master/CHANGELOG.md#241---18-january-2022)

'Array' you say!? [The PR](knex/knex#5439) links to various issues which all seem to have JSONB and arrays as primary concerns.

TBH, we don't have the time to properly dig into why it worked before but now doesn't. But as this was a fix to a regression the behaviour is unlikely to change in Knex so we need to code for it.

This change resolves the issue for us. Looking in the DB the column is back to holding an empty array (without the fix Knex's change made it an empty JSON object) which matches what the legacy system is doing.
Cruikshanks added a commit to DEFRA/water-abstraction-system that referenced this pull request Jan 19, 2023
* Bump knex from 2.4.0 to 2.4.1

Bumps [knex](https://github.com/knex/knex) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/knex/knex/releases)
- [Changelog](https://github.com/knex/knex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/knex/knex/commits)

---
updated-dependencies:
- dependency-name: knex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix service following Knex update

A recent change and test appear to be failing the build after this update to Knex. Checking the Knex changelog we found this

- [Bug fix: PostgreSQL: Fix Malformed array literal 2.4.0 Regression #5439](https://github.com/knex/knex/blob/master/CHANGELOG.md#241---18-january-2022)

'Array' you say!? [The PR](knex/knex#5439) links to various issues which all seem to have JSONB and arrays as primary concerns.

TBH, we don't have the time to properly dig into why it worked before but now doesn't. But as this was a fix to a regression the behaviour is unlikely to change in Knex so we need to code for it.

This change resolves the issue for us. Looking in the DB the column is back to holding an empty array (without the fix Knex's change made it an empty JSON object) which matches what the legacy system is doing.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alan Cruikshanks <alan.cruikshanks@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants