psql -d mydb -U me -h localhost -f db_log.sql -v db_user_string='Me' -v version="1.7.3"
into the script
begin;
create table db_log (
db_owner varchar(255) not null,
db_user varchar(255) not null,
version varchar(255) not null,
created timestamp,
id serial primary key
);
insert into db_log (db_owner, db_user, version, created)
VALUES (current_user, :db_user_string, :version, current_timestamp);
commit;
gives…
psql:db_log.sql:10: ERROR: syntax error at or near ".3"
Any ideas?
I am using 9.3.0
Best Answer
Try an extra layer of quotes around your variables: