-
-
Notifications
You must be signed in to change notification settings - Fork 955
copy.go: Missing field to add options #688
Copy link
Copy link
Closed
Labels
Description
copy.go: Missing field to add options
According to the doc, when you use CopyIn you can add options at the end of the statement:
https://www.postgresql.org/docs/9.2/static/sql-copy.html
In my case I wanted to add options to handle null values. To fix it quickly I ended up writing a function that modify the statement before sending it to the database:
txn.Prepare(AddOptionToStmt(pq.CopyIn("column1", "column2", "column3")))
func AddOptionToStmt(inputStatement string) string {
outputStatement := inputStatement + WITH NULL 'NULL'
return outputStatement
}
It would be nice to handle options in the code directly in the pq.CopyIn function by adding a parameter.
Reactions are currently unavailable