override previous O
shared keys @ AllSelection
& rowMode: 'array'
processing @ PostgresDriver
.
#1101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey 👋
fixes #1094.
Running the following query:
On the 4 core dialects in our tests,
yields the following values for the shared
id
column:As you can see,
pg
's results takeperson.id
values, and nottoy.id
values. Other dialects do the opposite.To align
pg
results with the other dialects, this PR usesrowMode: 'array'
inPostgresDriver
to get the raw values and produce objects that take the last value of a column with the same name. This is a breaking change for PostgreSQL users who relied on the default behavior ofpg
.This PR doesn't handle the
.selectAll()
AND.selectAll(['person', 'toy'])
cases. Here we'll get a union of all possible values of a shared column which is not accurate, but can be$narrowType
'd..selectAll(['person', 'toy'])
can be solved with compile-time array recursion (which afaik is not that performant - not worth it??)..selectAll()
requires a lot of testing - probably affected by order of introduction of tables to query context - if so, will require a huge refactor toTB[]
and basically most types.We can recommend our users to use multiple single-table calls, as the tightest option.
We can deprecate the multi-table variant and even the empty variant of
selectAll
.Should we allow users to switch back to
pg
's default row processing with a flag in the dialect config?