Skip to content

Wrong table name when generating insert... #1

Description

@robertmircea

I'm having trouble with Dapper.Rainbow.Postgresql. I have the following relations:

    class DB : Database<DB>
    {
        public Table<Batch> BatchStatistics { get; set; }
        public Table<Batch> Batches { get; set; } 
    }

When I run two inserts (one for each table), the second insert generates sql which refers to Batches table instead of BatchStatistics. TableName seems to be wrong (the same as the case of the first table).

db.Batches.Insert(new {...});
db.BatchStatistics.Insert(new {...});

This is a fragment from Postgresql server log. Notice the two insert statements which contain the same public.batch table name instead of the second one being public.batch_statistics:

statement: INSERT INTO public.batch (name,...) VALUES (((E'Test')::text),...) RETURNING id
2015-03-23 22:09:12 EET LOG:  duration: 1.294 ms
2015-03-23 22:09:12 EET LOG:  statement: INSERT INTO public.batch (batch_id,pending) VALUES (((5)::int4),((0)::int4)) RETURNING id
2015-03-23 22:09:12 EET ERROR:  column "batch_id" of relation "batch" does not exist at character 27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions