Skip to content

Support for preloading subqueries #2152

@zachdaniel

Description

@zachdaniel

Elixir Version: 1.4.5
Database Version: PostgreSQL 9.5
Ecto Version: ecto 2.2.0-dev (https://github.com/elixir-ecto/ecto.git) (mix)
Database Adapter: postgrex 0.13.3 (Hex package) (mix
Operating system: OSX

Current behavior

When put a query into a keyword list preload statement, I get:

** (FunctionClauseError) no function clause matching in Ecto.Repo.Preloader.query!/1

The offending code is clearly:
https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/repo/preloader.ex#L315

Expected behavior

Subqueries can be passed into the preloader, or a better error message expressing that it is not possible.

Was that pattern match intended to restrict things like subqueries? If so, lets add a nicer error message. If not, how do we get subqueries to work in preloads?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions