elixir-phoenix-realworld-example-app
elixir-phoenix-realworld-example-app copied to clipboard
Cockroachdb issues tracker
Trying cockroachdb on 2.1 beta (v2.1.0-beta.20181015):
- Cannot create a database automatically, but can migrate with ecto.migrate (expected)
- Getting list of tags fails Replaced query with:
def list_tags do
Ecto.Adapters.SQL.query!(Repo, "select count(*) as tag_count, ut.tag
from articles, (select unnest(tag_list) from articles) as ut(tag)
group by ut.tag
order by tag_count desc limit 5;").rows
|> Enum.map(fn v -> Enum.at(v, 1) end)
end
Also replaced:
def filter_by_tags(query, tag) do
query
|> join(:inner, [a], p in fragment(
"""
WITH articles AS( SELECT a.id, unnest(a.tag_list) tag FROM articles a ORDER BY a.id, a.created_at) select * from articles
"""), a.id == p.id)
|> where([a], fragment("tag = ?", ^tag))
end
As of Cockroachdb 4.2.1 the subquery issue is gone, but the system doesn't work.
Hi @fire I'm not sure I follow. This project uses Postgres as the DB, I believe there are more changes required to make it work with a different DB.
Can you share elixir / otp version and what are the changes you made to try to make this work?
The same ecto driver for postgresql is able to be used for cockroachdb.