Speaking of differences between mysql and postgres, since there is no
"replace into" to do an upsert in postgres, I wanted to do something
like:
// insert into rows (k, v) select 'foo', 'bar' where not exists
(select 1 from rows where k='foo');
as part of the solution, but I'm having some trouble with the
parameter placeholders for the select. if I try:
_, err = db.Exec(`INSERT INTO rows (k, v) SELECT $1, $2 WHERE NOT
EXISTS (SELECT 1 FROM rows WHERE k=$1)`, "foo", "bar")
I get this:
panic: pq: L:"305" D:"text versus character varying" C:"42P08" P:"32"
F:"parse_coerce.c" R:"coerce_type" M:"inconsistent types deduced for
parameter $1" S:"ERROR"
How do I pass these first $1 and $2 correctly so that they end up as
'foo' and 'bar' in the query?
the driver is
github.com/bmizerany/pq
> --
>
>