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 adding duplicate PK attributes in select query #1410

Merged
merged 3 commits into from Feb 20, 2014

Conversation

2 participants
@ruifortes
Contributor

ruifortes commented Feb 19, 2014

If there's a subquery and options.attributes is defined and contains PK field duplicate would be added.

@mickhansen

This comment has been minimized.

Contributor

mickhansen commented Feb 19, 2014

Can you please provide a unit test aswell?

@@ -536,7 +536,15 @@ module.exports = (function() {
}.bind(this)).join(", ")
if (subQuery && mainAttributes) {
mainAttributes = mainAttributes.concat(factory.hasPrimaryKeys ? factory.primaryKeyAttributes : ['id'])
if (factory.hasPrimaryKeys) {
factory.primaryKeyAttributes.forEach(function(keyAtt){

This comment has been minimized.

@mickhansen

mickhansen Feb 19, 2014

Contributor

Please change this to two space identation so it follows the general style.

This comment has been minimized.

@ruifortes

ruifortes Feb 20, 2014

Contributor

fixed indentation...

mickhansen added a commit that referenced this pull request Feb 20, 2014

Merge pull request #1410 from ruifortes/master
fix adding duplicate PK attributes in select query

@mickhansen mickhansen merged commit 5664760 into sequelize:master Feb 20, 2014

1 check passed

default The Travis CI build passed
Details
@mickhansen

This comment has been minimized.

Contributor

mickhansen commented Feb 20, 2014

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment