Question

Any idea what is this exception trying to convey ? I am using sqlKorma with Postgres 9.3. I am trying to insert multiple rows at once in a table and I am getting a syntax error.

Now neither do I have a "0" anywhere in my query nor am I writing raw SQL to be messing up the syntax.

the korma docs are also not very clear.

Failure to execute query with SQL:
DO 0  ::  []
PSQLException:
 Message: ERROR: syntax error at or near "0"
  Position: 4
 SQLState: 42601
 Error Code: 0
org.postgresql.util.PSQLException: ERROR: syntax error at or near "0"
  Position: 4

Thats my code

(insert vendor-subsidiary-allowance                                                                                                       
          (values (vec (for [p (seq percentages)]                                                                                           
                         {:id (java.util.UUID/randomUUID)                                                                                   
                          :type "%"                                                                                                         
                          :id_allowance_category (utils.uuid/from-str (p 0))                                                                
                          :id_vendor_subsidiary (allowance-form "vendor_sub_id")                                                            
                          :value  (parse-number (p 1))})))) 

NOTE: percentages is a dictionary with uuid strings as keys and value as some numeric string

Was it helpful?

Solution

Perhaps you want to read this to find the way to print the generated SQL to console. You can use sql-only or dry-run macro to do this.

Print the generated SQL with sql-only or dry-run and check that the SQL is okay.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top