Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create tables on cockroachdb #505

Closed
matreyes opened this issue Apr 7, 2020 · 3 comments
Closed

Cannot create tables on cockroachdb #505

matreyes opened this issue Apr 7, 2020 · 3 comments

Comments

@matreyes
Copy link

matreyes commented Apr 7, 2020

I'm starting a fresh new application with CockroachDB, and running the first migration it generates the error:

** (Postgrex.Error) ERROR 0A000 (feature_not_supported) at or near ",": syntax error: unimplemented: this syntax

    query: CREATE TABLE IF NOT EXISTS "schema_migrations" ("version" bigint, "inserted_at" timestamp(0), PRIMARY KEY ("version"))

    hint: You have attempted to use a feature that is not yet implemented.
See: https://github.com/cockroachdb/cockroach/issues/32098

at (ecto_sql) lib/ecto/adapters/sql.ex:612: Ecto.Adapters.SQL.raise_sql_call_error/1

It's an error with the timestamp precision which is not supported on CDB but last postgrex version has been tested on cockroach.

I'm using cockroachdb/cockroach:v19.2.5 (latest)

THANKS!

@matreyes
Copy link
Author

matreyes commented Apr 7, 2020

I've seen that the query is created on https://github.com/elixir-ecto/ecto_sql/blob/master/lib/ecto/adapters/postgres/connection.ex#L1033
not clear for me if it's postgrex or ecto_sql responsability

@josevalim
Copy link
Member

If the query works for Postgres but not CockroachDB, then it is rather a CockroachDB issue. We will gladly accept PRs that improve the generated query, but only as long compatibility with PG is still maintained. Thanks!

@matreyes
Copy link
Author

matreyes commented Apr 7, 2020

They fixed this: cockroachdb/cockroach#42580 but probably will always have differences from postgres that will have to be tunned:(cockroachdb/cockroach#33441).

As they are SQL differences, they should be managed as a different Ecto.Adapter implementation, and maybe keep using postgrex.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants