The patch applies cleanly to the current git master and is in context diff format. The patch fails the regression tests because it is outputting new DETAIL line which four of tests aren't expecting. The tests will need to be updated. Functionality: The patch works as advertised. An insert or update that fails a check condition indeed logs the row that has failed: test=# create table test ( test(# a integer, test(# b integer CHECK (b > 2), test(# c text, test(# d integer test(# test(# test(# ); CREATE TABLE test=# test=# insert into test select 1, 2, 'Test', 4; ERROR: new row for relation "test" violates check constraint "test_b_check" DETAIL: Failing row: (1, 2, Test, 4). One comment I have on the output is that strings are not in quotes. It's a little jarring, but might not be that big a deal. A contrived case that is pretty confusing: test=# insert into test select 1, 2, '3, 4', 4; ERROR: new row for relation "test" violates check constraint "test_b_check" DETAIL: Failing row: (1, 2, 3, 4, 4). A select inserting 4 columns seemingly results in a 5 column row ;) Another super minor thing, postgres doesn't seem to put periods at the end of log messages, yet this new detail line does. Code I'm no C or postgres expert, but the code looks okay to me. Attached is a small script I used to test/demo the functionality. --Royce |
testCheckConstraints.sql
Description: Binary data
On 11/11/2011, at 2:56 AM, Jan Kundrát wrote:
|