DapperLib / DapperLib/Dapper.Contrib
double quotes is error in postgresql
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
1.my setting DefaultTypeMap.MatchNamesWithUnderscores = true;
2.using dapper.Contrib
model:
[Table("t_user")]
public class UserModel
{
///
/// 主键uuid
///
[ExplicitKey]//非自增长的用此标识
public string userId { get; set; }
///
/// 姓名
///
public string userName { get; set; }
///
/// 身份证号
///
public string idCard { get; set; }
///
/// 生日
///
public DateTime birthday { get; set; }
///
/// 性别
///
public string sex { get; set; }
///
/// 年龄
///
public int age { get; set; }
///
/// 创建人
///
public string createdBy { get; set; }
///
/// 创建时间
///
public DateTime createdTime { get; set; }
///
/// 修改人
///
public string updatedBy { get; set; }
///
/// 修改时间
///
public DateTime updatedTime { get; set; }
}
sql:
CREATE TABLE t_user(
userId VARCHAR(32) NOT NULL,
userName VARCHAR(32),
idCard VARCHAR(32),
birthday DATE,
sex VARCHAR(32),
age INT,
createdBy VARCHAR(32),
createdTime DATE,
updatedBy VARCHAR(32),
updatedTime DATE,
PRIMARY KEY (userId)
);;
COMMENT ON TABLE t_user IS '用户信息';;
COMMENT ON COLUMN t_user.userId IS '编号';;
COMMENT ON COLUMN t_user.userName IS '姓名';;
COMMENT ON COLUMN t_user.idCard IS '身份证';;
COMMENT ON COLUMN t_user.birthday IS '出生日期';;
COMMENT ON COLUMN t_user.sex IS '性别';;
COMMENT ON COLUMN t_user.age IS '年龄';;
COMMENT ON COLUMN t_user.createdBy IS '创建人';;
COMMENT ON COLUMN t_user.createdTime IS '创建时间';;
COMMENT ON COLUMN t_user.updatedBy IS '更新人';;
COMMENT ON COLUMN t_user.updatedTime IS '更新时间';;
3.error
insert into t_user ("userId", "userName", "idCard", "birthday", "sex", "age", "createdBy", "createdTime", "updatedBy", "updatedTime") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
4.postsql insert sql
INSERT INTO public.t_user(
userid, username, idcard, birthday, sex, age, createdby, createdtime, updatedby, updatedtime)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
this is don't double quotes.
so..how setting?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the shown UserModel, PostgreSQL table definition, DefaultTypeMap.MatchNamesWithUnderscores setting, and Dapper.Contrib insert call. Compare the generated INSERT with PostgreSQL's lowercased unquoted identifiers and determine the expected quoting behavior; done means the insert works with the intended column names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, postgresql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100