Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ON CONFLICT syntax error in Postgres 9.5.0

In Postgres documentation INSERT there is an example of ON CONFLICT use:

INSERT INTO distributors (did, dname) VALUES (7, 'Redline GmbH')
ON CONFLICT (did) DO NOTHING;

I try the same thing:

INSERT INTO name_map VALUES ('key_value', 'val1','val2') 
ON CONFLICT (key_column) DO NOTHING;

But get ERROR: syntax error at or near "ON".

What am I missing?

postgres --version
> 9.5.0
like image 666
frankhond Avatar asked Jan 20 '16 08:01

frankhond


1 Answers

As several people pointed out in the comments, it turns out the wrong version of postgres is running.

select version()

in psql revealed this.

There must be an old installation of 9.4.5 hiding somewhere in my system.

like image 141
frankhond Avatar answered Oct 01 '22 04:10

frankhond