.Net Editor postgres primary keys quotes

.Net Editor postgres primary keys quotes

klymov.inekonklymov.inekon Posts: 25Questions: 5Answers: 0

Hi. I've try init editor via postgres. Primary key is ID.
When I init like this

var editor = new Editor(db, "dbo.DataSource").Pkey("ID").Debug(true)

I get error on first request "ERROR: column "id" does not exist"

SELECT  COUNT( ID ) as "cnt" FROM  "dbo"."DataSource" WHERE (1=1)

And when I add quotes to primary key like this

var editor = new Editor(db, "dbo.DataSource").Pkey("\"ID\"").Debug(true)

First request with count work fine, but third request where editor get data has double quotes on this id

SELECT  ""ID"" as ""ID"", "dbo"."DataSource"."ID" as "dbo.DataSource.ID", ... FROM  "dbo"."DataSource" WHERE (1=1) ORDER BY "dbo"."DataSource"."Name"  asc  LIMIT 10 OFFSET 0

Is this an error in library or how I can avoid this error? Thank you

Answers

  • allanallan Posts: 64,743Questions: 1Answers: 10,713 Site admin

    Yup, no question, that is an error in the library. Apologies! Specifically it is this line. It doesn't escape the identifier, which it should do, and that's a problem in postgres, since postgres folds the case down unless escaped.

    Let me look into that and I'll get back to you.

    Allan

  • allanallan Posts: 64,743Questions: 1Answers: 10,713 Site admin

    Hi,

    Fix committed in here. You can build the dll from there, I can send you a dev version or hang fire for the next release (although that might be a few weeks away).

    Allan

  • klymov.inekonklymov.inekon Posts: 25Questions: 5Answers: 0

    Thanks, Allan. You are awesome)

Sign In or Register to comment.