DapperLib/Dapper.Contrib

Postgres Insert Error

Opened this issue · 3 comments

i use postgres when i insert data, throw exception: not found "id".
I track the source code,I guess the reason is: my table field is uppercase caused.

because postgres rules : Uppercase must be enclosed in double quotes.

but source code: Dapper.Contrib=>SqlMapperExtensions=>PostgresAdapter back insret returning key not add double quotes where table field is uppercase.

image

What do your object attributes look like? You can explicitly set the key (quoted) in the column attributes on the type.

What do your object attributes look like? You can explicitly set the key (quoted) in the column attributes on the type.

hi @NickCraver Thank you for your reply,i can not find about "explicitly set the key (quoted) in the column attributes on the type" document.Did you say :i neet set column attribute like this:
image

Sorry, my English is too bad。 I hope you can understand my statement。

tks.

@mingyangzhu it seems that you're using ״ instead of ". You may observe the double quotes " in your first screenshot.

/// <summary>
/// 主键
/// </summary>
[Key]
[Column(name:״\״Id\״״)]
public TKey id { get; set; }