0

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

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Oh... that is nice! but sql-only is showing placeholders as it is without the values that are going.
You can also get the SQL text by setting log_statement = 'all' in postgresql.conf then getting it from PostgreSQL's logs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.