I have a problem with generating commands (Update, Insert, and Delete) through NpgsqlCommandBuilder. The main issue occurs when I set MaxAutoPrepare to a value like 100. After a while, I receive an exception where the Update command is generated after a different SELECT command.
The problem seems to be that the schema table used to generate the Update command belongs to the wrong table. The SELECT command is executed on the Partners table, but the command builder generates the rest of the commands based on a different table in my case, the document_custom_columns table.
The second issue is that generating the first command takes too much time.
We are using PostgreSQL 16.2 and Npgsql 8.0.3.0. Thank you for any help.


Here is an example with the database.
NpgsqlTest.zip
TestDB.zip