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

Rework SET IDENTITY_INSERT for Go 1.10 #156

Merged
merged 2 commits into from
Jun 21, 2018
Merged

Rework SET IDENTITY_INSERT for Go 1.10 #156

merged 2 commits into from
Jun 21, 2018

Conversation

AlekSi
Copy link
Member

@AlekSi AlekSi commented Jun 16, 2018

Resolves #151.

@AlekSi AlekSi added this to the v1.3.2 milestone Jun 16, 2018
@AlekSi AlekSi force-pushed the mssql-update branch 2 times, most recently from 9ac7d4d to a8bc4bd Compare June 20, 2018 09:15
base_test.go Outdated
_, err := q.Exec(sql)
require.NoError(t, err)
t := suite.T()
sqlTemplate := fmt.Sprintf("SET IDENTITY_INSERT %s %%s", q.QuoteIdentifier(table))

Choose a reason for hiding this comment

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

G201: SQL string formatting

@codecov
Copy link

codecov bot commented Jun 20, 2018

Codecov Report

Merging #156 into v1-3 will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             v1-3     #156   +/-   ##
=======================================
  Coverage   69.56%   69.56%           
=======================================
  Files          19       19           
  Lines        1531     1531           
=======================================
  Hits         1065     1065           
  Misses        416      416           
  Partials       50       50

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 727b87d...d4039f4. Read the comment docs.

}
sql := fmt.Sprintf("SET IDENTITY_INSERT %s %s", q.QuoteIdentifier(table), allowString)
_, err := q.Exec(sql)
query := fmt.Sprintf("SET IDENTITY_INSERT %s %%s", q.QuoteIdentifier(table))

Choose a reason for hiding this comment

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

G201: SQL string formatting

db_test.go Outdated
s.Require().Error(err)
if err.Error() != `pq: Could not complete operation in a failed transaction` && err.Error() != `commit unexpectedly resulted in rollback` {
s.Failf("unexpected error", "actual: %q", err)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@AlekseyMartynov What is the reason for that change? What version of PostgreSQL were you using?

Copy link
Collaborator

Choose a reason for hiding this comment

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

My original changeset was based on the mssql-update branch. So was the original PR (according to AppVeyor logs). As I understand, later you've changed the PR to target v1-3 and something went wrong.

Now, in my opinion, it would be cleaner to cherry-pick the original commit on top of the current v1-3. There'll be a conflict revealing the source of the unwanted change:

<<<<<<< HEAD
	s.NoError(tx.Insert(person1))
	s.EqualError(tx.Insert(person1), `pq: duplicate key value violates unique constraint "people_pkey"`)
	s.EqualError(tx.Insert(person2), `pq: current transaction is aborted, commands ignored until end of transaction block`)
	s.EqualError(tx.Commit(), `pq: Could not complete operation in a failed transaction`)
=======
	s.NoError(insertPersonWithID(s, tx.Querier, person1))
	s.Contains(insertPersonWithID(s, tx.Querier, person1).Error(), `duplicate key value violates unique constraint "people_pkey"`)
	s.Contains(insertPersonWithID(s, tx.Querier, person2).Error(), `current transaction is aborted, commands ignored until end of transaction block`)
	err = tx.Commit()
	s.Require().Error(err)
	if err.Error() != `pq: Could not complete operation in a failed transaction` && err.Error() != `commit unexpectedly resulted in rollback` {
		s.Failf("unexpected error", "actual: %q", err)
	}
>>>>>>> bea984f... Rework SET IDENTITY_INSERT for Go 1.10

Copy link
Collaborator

Choose a reason for hiding this comment

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

mr-holmes

@AlekSi AlekSi merged commit 2540dd4 into v1-3 Jun 21, 2018
@AlekSi AlekSi deleted the mssql-update branch June 21, 2018 08:59
@AlekSi AlekSi added the chore label Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants