This was a classic case of seeing what I thought was there not what was
actually there :-(
> export PGOPTIONS="-d2"
> psql yourdb
This gave the show away, thanks Tom.
I had added an extra parameter, but gave it the same ALIAS as a column in
the insert, hence the syntax error. The column was rplace by $1.