@roji , I met the same problem and try with solution that you suggested and it working fine. However, two null values are never considered equal in this comparison. Is Thursday a “party” day in Spain or Germany? worked with Entity Framework Core 2.0 with Npgsql.EntityFrameworkCore.PostgreSQL 2.0. Thanks for contributing an answer to Stack Overflow! May be there should be a common understanding among entity framework providers to generate clean migration scripts as Npgsql.EntityFrameworkCore.PostgreSQL. It's a keyword to state that you want only distinct tuples on your result set. Actually I have decided to use the same approach as @SperoSophia has suggested. If you just want to run this on Npgsql/PostgreSQL, you can simply manually change the SQL in the migrations. Delete the existing migration C# code, which already contains the square brackets, Regenerate a migration on PostgreSQL, i.e. I just created a totally vanilla ASP.NET Core MVC app (dotnet new mvc -au Individual) with EF Core 2.1.0-rc1, set up Npgsql.EntityFrameworkCore.PostgreSQL as the provider, and my generated script contains the following line: Now that there is no WHERE clause on the index like in your example - are you sure you nobody's customizing the model in your application to add that? In product i am developing we always use sql server migration as base since we support multiple database types. If you don't get an error, then that migration wasn't applied. How to handle business change within an agile development environment? Everything seemed to work well with no issues, till today one of the Moodle Admins created a new user with a customized role, when attempting to log in as this user a "ERROR Reading from database" occurs. Am going to close this as I think everyone's been encountering the same issue. I have fixed the [ issue myself. Confusion regarding work and the first law of thermodynamics, Classes of birationally equivalent Calabi-Yau manifolds in the Grothendieck ring. These result tables are called result-sets. If you need the same app to run on both SqlServer and PostgreSQL, please read the EF Core docs on migrations and multiple providers to understand how this works. Please let me know what other information I can give you to help out. IdentityServer4.AspNetIdentity => 2.1.0. I'm sorry, but I couldn't reproduce this with a simple ASP.NET app. @cleversoftware, that repo has existing migrations with indices that have filters such as [NormalizedName] IS NOT NULL. site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. IS NOT NULL is required only by SQL Server and it's a well known issue. But I have compared the snapshots (same model but two diff providers) and here is what my concern about: I'm new to the Postgre but I guess that constraint will be fired on the NPG during the second NULL insert. If all you want to do is run it on PostgreSQL, do the following: At this point you should have a freshly-generated migration that will contain double-quotes and be runnable on PostgreSQL. It seems a lot of people are hitting this by starting out from the ASP.NET Identity templates (which are meant for SQL Server) and converting to PostgreSQL. Hi. Why use "the" in "a real need to understand something about **the seasons** "? Syntax. PostgreSQL DISTINCT ON with different ORDER BY, psql: FATAL: database “” does not exist. If you want the distinct couples of mfin and empirica: If you want the distinct mfin and the distinct empirica you have to do something different: you may have to check the syntax of postgresql for Alias, not sure if it's the same as oracle. select farechart_master_id,farechart_name,version_number_service_stype, fcm.route_id,st.service_type_name,fcm.passenger_type_id, fcm.effect_start_date,fcm.effect_end_date,fcm.nignt_service, fcm.peak_time,fcm.flexi_fare,r.route_number,r.route_direction, r.effective_from,r.effective_till from … https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.1.200-sdk-download.md. Today i have updated to Entity Framework Core 2.1.3 and .Net Core 2.1 and also to latest version of Npgsql.EntityFrameworkCore.PostgreSQL and since today migrations are not working. So my erroneous [ are from scripts created by EF in the background when building the migration scripts from all that I can see and understand. This probably means that the application was written for SQL Server, and is not runnable as-is on PostgreSQL. If you try to apply a migration that contains custom SQL with brackets, it will error. QUERY: SELECT device_type_id FROM $1 WHERE mac_address = $2. Why do I get this error? Migrations are C# code which gets generated when you execute dotnet ef migrations add, and are typically tracked by source control. All of my explicit updates from the migration went fine according to the verbose output, but I hit a snag with this update to the database. In the Postgres Logs I can see the following. It's better to opt out from identity columns as described in the docs, and then the migrations won't be generated in the first place.