Git Product home page Git Product logo

Comments (5)

csummers avatar csummers commented on July 17, 2024

Hmm. Are you saying HugSQL is not leaving your double-quotes alone? I'm not seeing that:

=> (hugsql/sqlvec "update world set \"randomNumber\" = :randomNumber where id = :id returning id" {:randomNumber 5 :id 1})
["update world set \"randomNumber\" = ? where id = ? returning id" 5 1]

Do you have an error message to look at?

from hugsql.

yogthos avatar yogthos commented on July 17, 2024

hmm, might have to dig into this further. I was updating Luminus framework benchmarks here, and got this error. org.postgresql.util.PSQLException: ERROR: column "randomNumber" of relation "world" does not exist. However, doing it the other way seems to work.

from hugsql.

csummers avatar csummers commented on July 17, 2024

These queries all work for me on postgresql in my test suite:

-- :name create-world :!
create table world (
 id int,
 "randomNumber" int
)

-- :name drop-world :!
drop table if exists world

-- :name insert-world<! :<!
insert into world (id, "randomNumber")
values (:id, :randomNumber)
returning id

-- :name update-world<! :<!
-- update an existing world record
UPDATE world
SET "randomNumber" = :randomNumber
WHERE id = :id
RETURNING id
(testing "possible double-quote bug"
        (when (= db-name :postgresql)
          (= [0] (drop-world db))
          (= [0] (create-world db))
          (= [{:id 1}] (insert-world<! db {:id 1 :randomNumber 5}))
          (= [{:id 1}] (update-world<! db {:id 1 :randomNumber 42}))))

from hugsql.

yogthos avatar yogthos commented on July 17, 2024

Hmm, yeah that's odd. I just tried this on my machine at home and it works fine. When I tried it on a different machine earlier I got the same error as travis. Perhaps it's something to do with the version PG itself.

from hugsql.

yogthos avatar yogthos commented on July 17, 2024

Oh I think I figured it out. The query returns a randomworld key that's lower case. However, I was looking for the randomWorld key when updating. Nothing to do with HugSQL. :)

from hugsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.