-
Notifications
You must be signed in to change notification settings - Fork 233
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
Exception thrown by INSERT AFTER trigger not treated properly #3007
Comments
Thanks for reporting, that seems to indicate a bug in the provider. But yeah, that's a pretty complicated method, so I'll need to see some sort of repro for this. As a template, I usually use this code as a console program. Since you need to define a trigger, you can create the table (and trigger) externally via a SQL script, and then post that here alongside the .NET code. await using var ctx = new BlogContext();
// await ctx.Database.EnsureDeletedAsync();
// await ctx.Database.EnsureCreatedAsync();
public class BlogContext : DbContext
{
public DbSet<Blog> Blogs { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseNpgsql("Host=localhost;Username=test;Password=test")
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging();
}
public class Blog
{
public int Id { get; set; }
public string Name { get; set; }
} |
Ok, here is a MWE:
results in
|
@roji did you find time to take a look here? MWE is there ^^. Thanks! |
Thanks for the MWE - I wish I had one like this for each bug filed. Thanks to it I located the bug and submitted a fix - this will be included in the upcoming 8.0.1 release. |
Hi,
we are currently migrating from .net6 (EF6) to .net8 (EF8, Npgsql.EntityFrameworkCore.PostgreSQL 8.0.0, Npgsql 8.0.1). We have some trigger in our DB which, depending on some condition, will perform a
RAISE '...' USING ERRCODE='U0001'
.Assume we are doing one UPDATE via EF load/modify/SaveChanges triggering that condition. Previously, with EF6, a
NpgsqlException
was thrown, which we could handle properly. Now, we are seeing this:Note that when we are doing the same update via
context.Database.ExecuteSql(...)
, we are seeing the exception we had previously.Maybe you can tell on the first glance what is going wrong here. If we need to produce an MWE, is there a simple template which we can take and modify?
The text was updated successfully, but these errors were encountered: