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

Ability to perform “preloading” for Postgresql in a single query #7228

Open
meftunca opened this issue Oct 7, 2024 · 0 comments
Open
Assignees
Labels
type:question general questions

Comments

@meftunca
Copy link

meftunca commented Oct 7, 2024

Your Question

Do we have the ability to do “preloading” in a single query? We can get data in a single query in the form of Postgresql lateral join (select Array(...query)). If Gorm supports this, it would be really perfect for me :)

Expected answer

select f.*, array_to_json(questions.list) from survey.forms f
left join lateral(
    select Array(
           select to_jsonb(*) from survey.form_items fi where fi.form_id = f.id
           ) as list
    ) questions on true;
@meftunca meftunca added the type:question general questions label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question general questions
Projects
None yet
Development

No branches or pull requests

2 participants