Fix hard-coded "pkName" column in queries#347
Conversation
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
@ataft , thanks for another PR. :) Again, see if you can follow this instruction to change the commit message https://help.github.com/articles/changing-a-commit-message/. If not, don't worry, I can modify it for you. |
3b07529 to
522b62c
Compare
|
@slnode test please |
|
@ataft, all the tests seem to be passed, however, there're some linting errors in |
ataft
left a comment
There was a problem hiding this comment.
Line length fix made, please review
|
@slnode test please |
|
@zbarbuto @strongloop/sq-lb-apex, I'm not very familiar with postgresql, could you please help reviewing this PR? Thanks! |
|
Mine's also not amazing and I've never used the discovery features in LB so I'm probably not the best person to review. |
|
IMO, this pull request should include at least two new tests (one for I believe tests for auto-discovery are located here: https://github.com/strongloop/loopback-connector-postgresql/blob/master/test/postgresql.discover.test.js I took a quick look and it seems to me that these tests assume the database already contains a set of tables. I am not sure if those tables are sufficient to test the fix made by this pull request. Personally, I would create new tables tailored to the specific needs of the new tests by calling |
|
The current auto-discovery tests use the inventory table, which already has foreign keys, see here: It seems like there's no need to add new tables and further complicate the testing process. Lastly, this is a low-risk PR for forward and backward compatibility because 1) it replaces a non-working hard-coded column, and 2) it uses a subquery that returns a maximum of 1 value to create the column, so will never cause join issues or an error due to more than one value appearing. |
|
Is this PR going to be merged? |
|
Thanks @raymondfeng for the review. |
Description
Both the "buildQueryForeignKeys" and "buildQueryExportedForeignKeys" functions have the "pkName" column in their queries hard-coded to the following:
'PK' AS "pkName"
This fix populates the actual primary key name in both of these queries. This fixes issue #65, which should have never been closed.
Related issues
connect to #65