Skip to content

Hierarchical query not working when parent's primary key column isn't SELECTed #46

Description

@rhuitl

This is more an inquiry than a bug report. It seems that hierarchical output is only possible when the SELECT statement retrieves the parent's primary key, it's not sufficient to select the child's foreign key.

For example with LanguageFilm, the query must look like (from the docs)

select language.language_id, language.name, film_id, title, release_year
from language
left outer join film on film.language_id = language.language_id

But this query doesn't work, although the SQL response yields the same data:

select film.language_id, language.name, film_id, title, release_year
from language
left outer join film on film.language_id = language.language_id

The output produced by restSQL in this case is a flat list, not the hierarchy produced by the first query.

Is this behavior documented somewhere? I guess I'm supposed to always select the primary keys, but maybe checks could be added if required columns are missing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions