darinwilson / music_db_workshop Goto Github PK
View Code? Open in Web Editor NEWA playground for experimenting with Ecto
A playground for experimenting with Ecto
I'm getting an error running the bin/setup script:
...
15:50:09.435 [debug] QUERY ERROR db=0.0ms queue=6.3ms
INSERT INTO "genres" ("name","wiki_tag","inserted_at","updated_at") VALUES ($1,$2,$3,$4) ON CONFLICT ("name") DO UPDATE SET "name" = EXCLUDED."name","wiki_tag" = EXCLUDED."wiki_tag","inserted_at" = EXCLUDED."inserted_at","updated_at" = EXCLUDED."updated_at" RETURNING "id" ["jazz", "Jazz", ~N[2019-08-22 19:50:09], ~N[2019-08-22 19:50:09]]
** (Postgrex.Error) ERROR 42601 (syntax_error) syntax error at or near "ON"
query: INSERT INTO "genres" ("name","wiki_tag","inserted_at","updated_at") VALUES ($1,$2,$3,$4) ON CONFLICT ("name") DO UPDATE SET "name" = EXCLUDED."name","wiki_tag" = EXCLUDED."wiki_tag","inserted_at" = EXCLUDED."inserted_at","updated_at" = EXCLUDED."updated_at" RETURNING "id"
(ecto_sql) lib/ecto/adapters/sql.ex:621: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto) lib/ecto/repo/schema.ex:649: Ecto.Repo.Schema.apply/4
(ecto) lib/ecto/repo/schema.ex:262: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
(ecto) lib/ecto/repo/schema.ex:164: Ecto.Repo.Schema.insert!/4
priv/repo/seeds.exs:4: (file)
Unable to setup the database - please check the settings in config/dev.exs
The error seems to be due to the ON CONFLICT
clause in the SQL command being executed and that makes sense as I'm running PostgreSQL 9.4.5:
✘-1 ~/@code/music_db_workshop [master ↑·1|…1]
(ins)15:50 $ psql -d postgres
psql (9.4.5)
Type "help" for help.
(ins)postgres=# SELECT version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.4.5 on x86_64-apple-darwin15.0.0, compiled by Apple LLVM version 7.0.0 (clang-700.1.76), 64-bit
(1 row)
... and that clause doesn't seem to be supported in 9.4.x versions:
It does seem supported in versions since 9.5 tho:
The simplest 'fix' would be to update the README to state that the prerequisite is "PostgreSQL >= 9.5".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.