Insert method does not generate SQL suitable for PostgresSQL

Open
#173 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, postgres
Domain
database

Research direction

Locate the Insert method that produces the shown SQL and reproduce the PostgreSQL insertion failure. Ensure the generated RETURNING clause quotes the Id field, then verify that the insertion succeeds without the reserved-word error.

Written by the indexing model from the issue text.

Description

The method generates sql that returns the identifier that was generated by the database, but the sql writing that was generated from the returning writes a reserved word from the postgres database (it should write the "Id" field in double quotation marks to identify the field). For this reason, it generates an error in the insertion. Is there any way to convert this situation?

This is the SQL generated by contrib
insert into "User" ("Name", "Email", "PasswordHash", "Bio", "Image", "Slug") values ($1, $2, $3, $4, $5, $6) RETURNING Id

Dominant language
C#
Stars
293
Forks
109
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DapperLib/Dapper.Contrib

All issues in DapperLib/Dapper.Contrib

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.