PostgreSQL Connection via Entity Framework Core Driver Hangs on Populating
We have a Postgres DB server in Azure with several databases. All of them connect fine, but one of them says that it connects fine when testing the connection, but it will not populate the tables. if I refresh this connection in the connections window, I see "Connecting" flash really quickly, and then it just hangs on "Populating". All of the other DBs on this server load just fine. Also, if I make the same connection using the "LINQ to DB" driver, the connection works fine and the tables appear. However, that driver does not provide links in your query results from the foreign key relationships so I'd rather not use it. I've tried several different versions of the Npgsql library (5.0.7, 5.0.0, 3.1.4) and they all do the same thing. Any help would be greatly appreciated!
LINQPad's Postgres driver for EF Core uses Npgsql's scaffolder. Are you able to see whether you're able to scaffold in Visual Studio using Npgsql.EntityFrameworkCore.PostgreSQL? (And if not, are there any clues as to what goes wrong?)
Scaffolding is working fine in Visual Studio to this DB using the Npgsql 3.1.4 Nuget package. Both Visual Studio and LINQPad 6 are running on the same PC.
Ok so I lied. I realized I had used the production connection string (don't judge!!) and was able to scaffold the DB. Once I pointed it to DEV, the scaffolding hung. We do code-first for the normal app that uses this DB with no issues, but I do have another app that I created that I had to scaffold the DB for. It worked in the past (I even saved the command in a text file for later reference if I had to update the entities/context). But it now hangs with that command.
If I turn on verbose logging when running the scaffold-dbcontext command, it shows that it finds all of the columns from the DB but then stops and does nothing. I'm going to try downgrading to an older version of the Npgsql Nuget package in my app to see if that works, but if you have any thoughts I'm all ears!
I found the issue! I was able to track down the query that was causing the hang. It was doing a query on the sequences, joining with a couple other tables. Due to crazy load testing in our DEV DB, there are over 170,000 sequences. So the problem was with the data in the DB, and not with the Npgsql library and obviously not with LINQPad. Thanks for helping, and thanks for a great product (I use LINQPad every day and could not live without it)!!
Thanks for the update!