Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The naming strategy Escape does not work for postgresql. #215

Closed
halvorgb opened this issue Feb 27, 2016 · 2 comments
Closed

The naming strategy Escape does not work for postgresql. #215

halvorgb opened this issue Feb 27, 2016 · 2 comments
Assignees

Comments

@halvorgb
Copy link

Without Escape:

LOG:  execute 1/1: INSERT INTO _pingdom (ip) VALUES ($1)
DETAIL:  parameters: $1 = '0:0:0:0:0:0:0:1'

With Escape:

ERROR:  column "$1" does not exist at character 39
STATEMENT:  INSERT INTO "_pingdom" ("ip") VALUES ("$1")

The problem is that $1 is escaped, but on postgres-9.5.1-1 thaẗ́'s invalid.

I looked through the source to fix the bug, but I can't seem to find something that links the io.getquill.sources.sql.idiom.SqlIdom trait to the io.getquill.naming.NamingStrategy trait.

@godenji
Copy link
Contributor

godenji commented Feb 27, 2016

Need to implement an escape strategy for Postgres.

Try something like the following in NamingStrategy source:

trait PostgresEscape extends Escape {
  override def column(s: String) = if(s.startsWith("$")) s else default(s)
}
object PostgresEscape extends PostgresEscape

Give it a shot and issue PR (along with corresponding test in NamingStrategySpec, see mysql example)

fwbrasil added a commit that referenced this issue Feb 27, 2016
implement postgres naming strategy; fixes #215
@fwbrasil
Copy link
Collaborator

@halvorgb The 0.4.1-SNAPSHOT version has a new naming strategy specific for postgres escaping[0]. Please let us know if you have problems using it.

[0] https://github.com/getquill/quill/blob/master/quill-core/src/main/scala/io/getquill/naming/NamingStrategy.scala#L83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants