Npgsql v7.00 Support

Posts   
 
    
JSobell
User
Posts: 145
Joined: 07-Jan-2006
# Posted on: 22-Nov-2022 07:15:34   

So it looks like the authors of NpgSQL have broken things yet again. https://www.npgsql.org/doc/release-notes/7.0.html#breaking-changes So now all of the Stored Procs that we replaced with Functions to make them work with LLBLGen's generated code now break because they expect us to have a Stored procedure there instead of a function! It looks like they expect to handle Functions like tables, but all Stored Proc must be called using the CALL syntax. I suppose then it means that Functions have to be implemented as a SP returning data and be tracked and called with a Select statement. The current code calls them with CommandType = 'StoredProcedure' but that breaks now as it only works for true Stored Procs (which didn't used to work with that value of CommandType.)

We've reverted back the 6.0.7 until this can be resolved, as we don't want to convert all our live Functions to SPs, and because we have some that we return data from.

Any idea when you might get around to looking at their shmozzle of a solution?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 22-Nov-2022 08:38:30   

You can opt-out of that change, by using AppContext.SetSwitch("Npgsql.EnableStoredProcedureCompatMode", true); (at the top of the page). AppContext is a class that is meant for things like this, it lets developers define switches which are then read by referenced assemblies to switch on/off functionality. In the past they've defined more of these switches which should be fine.

I'm not happy with this change either, but this switch should take care of it. I honestly don't know why they introduce these changes as mandatory. Stored procedures (so not functions) in PostgreSQL are very limited in nature and this change makes it cumbersome for us too; as in: we have 20 years of usage with functions as procedures for postgresql and now we have to ditch that and introduce a new type: functions, and use the stored procedure type for the 'real stored procedures'. The internal nightmare around this brought us to the conclusion not to support 'real stored procedures' in the next version to begin with (new projects will be fine, but the big amount of existing projects aren't).

The one thing we're thinking about for the next version is to generate out the select so people can forget about that switch, but as it requires a special pipeline only for postgresql and functions, we've still doubts, as the switch mentioned above solves it too.

Frans Bouma | Lead developer LLBLGen Pro
JSobell
User
Posts: 145
Joined: 07-Jan-2006
# Posted on: 22-Nov-2022 10:06:03   

Otis wrote:

You can opt-out of that change, by using AppContext.SetSwitch("Npgsql.EnableStoredProcedureCompatMode", true); (at the top of the page). AppContext is a class that is meant for things like this, it lets developers define switches which are then read by referenced assemblies to switch on/off functionality. In the past they've defined more of these switches which should be fine.

Ah, I was so annoyed by the stupidity of this change that I missed that bit. I doubt they will leave the switch in there for many versions, so a solution will eventually be needed, but that will suffice for now (or until they break their next feature). Thanks!