Coder Social home page Coder Social logo

music_db_workshop's People

Contributors

darinwilson avatar zberkom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

music_db_workshop's Issues

PostgreSQL versions prior to 9.5 are not supported

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".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.