简体   繁体   中英

Npgsql exception: Column c.consrc does not exist

I have a Postgres 12 database that currently only consists of one simple table:

CREATE TABLE public.messages
(
    sender text COLLATE pg_catalog."default",
    "timestamp" timestamp with time zone,
    message_id bigint,
    text text COLLATE pg_catalog."default",
    priority bigint,
    parameters text[] COLLATE pg_catalog."default"
)

No I want to use Npgsql to build a GUI with C# and Entity Framework. I installed the Nuget package:

Install-Package EntityFramework6.Npgsql

and it succeeded:

Successfully installed 'EntityFramework6.Npgsql 6.4.0' to TestClient

Next, I installed the Npgsql integration for VS 2019 ( found here ). When I try to add an ADO.NET Entity Data Model to my project by right-clicking it in the solution explorer, I can add a connection and the connection test ist successful (done in the Wizard). I can go on and select my table, but as soon as I press Finish, I get an error:

在此处输入图片说明

This is the console output:

Unable to generate the model because of the following exception: 'System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> Npgsql.PostgresException: 42703: Column c.consrc does not exist

What can I do?

PG12 removed the pg_constraint.consrc, this is tracked by PG12 removed the pg_constraint.consrc. Downgrading to PG11 should work until a fix is released.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM