Repository navigation
Added fields to Exception class to store extra fields added to PostgreSQL9.3 - #22
Closed
david-rowley wants to merge 6 commits into
Closed
david-rowley wants to merge 6 commits into
david-rowley wants to merge 6 commits into
Conversation
This makes the new error information available in the Exception class which allows the calling code to, for example see which constraint would be violated by the request. See PostgreSQL commit message for more details on what extra information is available and when. This commit only captures the extra information when it's there. http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=991f3e5ab3f8196d18d5b313c81a5f744f3baaea
This code is untested as I've not yet worked out how to run the test suit. The constant values in the Assert.AreEqual() calls may need tweaked. The prime purpose of the patch is to test that the fields are properly being populated. There is no need to also test things like foreign key violation as its testing the same code in Npgsql.
After reading the source code of PostgreSQL9.3, it seem that only certain errors relating to domain types will populate the DataTypeName field. This commit adds 2 new tests. 1 to test for the column name, as the previous uniqueviolation did not show the column name which unique constraint was violated. Perhaps this has to do with the fact that unique constraints can exist for >1 column. Test 2 checks the datatypename after a domain's NOT NULL constraint is violated. I've not yet run the tests. Though I did compare after setting psql \set VERBOSITY verbose
Renamed Exception.cs to ExceptionTests.cs and added copyright notice to the top of the file
Also for the unique violation test I've added some asserts to ensure that the data type and column name are empty. These are not populated for unique violations, originally I removed the tests but on after thought it's probably better to ensure that they're empty strings.
Renamed the 3 new test functions to give them more suitable names. Also added comment to explain why a domain is created to test the DataTypeName field. I would have guessed that we could see this populated by violating a NOT NULL constraint on a table's column, but this does not seem to be the case.
Member
|
Merged this pull request to master branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes the new error information available in the Exception class
which allows the calling code to, for example see which constraint would
be violated by the request.
See PostgreSQL commit message for more details on what extra information
is available and when. This commit only captures the extra information
when it's there.
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=991f3e5ab3f8196d18d5b313c81a5f744f3baaea