Skip to content

There is a column named <xxx> in table <xxx>, but it cannot be referenced from this part of the query #1019

Open
@MichalJana

Description

@MichalJana

I have PostgreSQL database with two tables Person and Address. Address table has FK person_id. When I try to insert a new entity in the address, I get an error message: There is a column named "person_id" in table "address", but it cannot be referenced from this part of the query. I found out that when I change the name from person_id to address_person_id_fkey in the C# model (or in FluentMapper), the insert works. Why is it hapenning? Thx.

Table:

create table address( 
address_id bigserial not null primary key,
person_id bigserial,
street varchar(50) not null,
city varchar(50) not null )

Model:

public record AddressEntity
{
        public int address_id { get; set; }

        public int person_id { get; set; }

        public string street { get; set; } = string.Empty;

        public string city { get; set; } = string.Empty;
}

RepoDb Version:
<PackageReference Include="RepoDb.PostgreSql" Version="1.1.4" />

Postgre Version:
PostgreSQL 14.0, compiled by Visual C++ build 1914, 64-bit

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglimitationA request or a feature that is cannot be supportedwontfixThis will not be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions