Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Cockroachdb issues tracker #27

Open
fire opened this issue Oct 22, 2018 · 4 comments
Open

Cockroachdb issues tracker #27

fire opened this issue Oct 22, 2018 · 4 comments

Comments

@fire
Copy link

fire commented Oct 22, 2018

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
@fire
Copy link
Author

fire commented Oct 22, 2018

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

@fire
Copy link
Author

fire commented Dec 3, 2018

As of Cockroachdb 4.2.1 the subquery issue is gone, but the system doesn't work.

@lbighetti
Copy link
Collaborator

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?

@fire
Copy link
Author

fire commented Jan 4, 2020

The same ecto driver for postgresql is able to be used for cockroachdb.

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

No branches or pull requests

2 participants