SELECT chooses all columns when using quoted queries

Open
#615 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
fsharp, sql
Domain
databases

Research direction

Start by running the quoted F# query against a supported database and inspect the generated SQL for the nested query. Trace the query translation involved in selecting fields from the quoted result; done means the statement selects only Card.Id and User.Id rather than every column.

Written by the indexing model from the issue text.

Description

enhancement

Consider this:

let cardsAndUsers =
  <@ query {
    for c in ctx.Dbo.Card do
    for u in ctx.Dbo.User do
    select (c, u)
  } @>

let cardIdsAndUserIds =
  query {
    for c, u in (%cardsAndUsers) do
    select (c.Id, u.Id)
  }

When I execute this, I would expect the SQL statement to only SELECT Card.Id, User.Id, but instead, all columns of Card and User appear in the SELECT.

Dominant language
F#
Stars
627
Forks
147
Avg merge
2h 2m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fsprojects/SQLProvider

All issues in fsprojects/SQLProvider

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.