leinn32 / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

Before insert row-level triggers are executed after null constraints are checked #483

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I created a before insert trigger to populate non-nullable fields (default 
values are not suitable for this case). I'm using both H2 and Oracle. In Oracle 
this approach works as expected - the values are populated and the row 
validates. In H2, the row is rejected before the trigger has an opportunity to 
populate the values. I found this surprising, and spent quite some time tracing 
through H2 code to understand why the trigger was not being fired.

There is a workaround - using a dummy default value - but that should not 
really be necessary.

Original issue reported on code.google.com by rattigan@gmail.com on 10 Jul 2013 at 3:25

GoogleCodeExporter commented 9 years ago
Can you please create a small self-contained SQL testcase for this, and then I 
can take a look at fixing this.

Thanks.

Original comment by noelgrandin on 11 Jul 2013 at 12:35

GoogleCodeExporter commented 9 years ago
Marking this as closed because of no feedback.

Original comment by noelgrandin on 9 Oct 2013 at 7:56

GoogleCodeExporter commented 9 years ago

Original comment by noelgrandin on 9 Oct 2013 at 7:57