Skip to content

Conversation

nunofgs
Copy link
Contributor

@nunofgs nunofgs commented Apr 5, 2017

Pull Request check-list

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Have you added new tests to prevent regressions?

Description of change

Fixes an issue when calling showIndex() on an index that contains a newline in its "fields". Example:

CREATE INDEX "foobar" ON "users" USING btree ((
CASE (settings->>'type')
    WHEN 'foo' THEN 'biz'
    WHEN 'bar' THEN 'baz'
    ELSE 'qux'
END)) WITH (fillfactor='70')

The issue is with a regexp that is matching against .* (which doesn't match newlines). This PR replaces that expression with [^]* which matches any character that is not nothing.

The error that was previously seen when a newline was present was:

TypeError: Cannot read property '1' of null
  at node_modules/sequelize/lib/dialects/postgres/query.js:139:85
  at Array.forEach (native)
  at node_modules/sequelize/lib/dialects/postgres/query.js:135:15

@sushantdhiman
Copy link
Contributor

@nunofgs Needs changelog entry as well

@codecov-io
Copy link

codecov-io commented Apr 5, 2017

Codecov Report

Merging #7492 into master will not change coverage.
The diff coverage is 100%.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f7ac2d...9390459. Read the comment docs.

@sushantdhiman sushantdhiman merged commit 2416075 into sequelize:master Apr 6, 2017
@nunofgs nunofgs deleted the bugfix/fix-show-index-query-regexp branch April 6, 2017 17:45
mkaufmaner pushed a commit to mkaufmaner/sequelize that referenced this pull request Apr 25, 2017
* Fix `showIndex()` query regexp

* [ci skip] changelog for sequelize#7492
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.

3 participants