Skip to content

[BUG]: Nested partial select type inconsistency between simple query and pgView #4401

Open
@someone635

Description

@someone635

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.41.0

What version of drizzle-kit are you using?

0.30.6

Other packages

No response

Describe the Bug

What is the undesired behavior?

In this minimal ts-playground . We see r and r2 do not have the same resulting type. Both use nested select object syntax, one directly on a query, and the other on a pgView. The simple query returns the whole b table object as nullable, but not the id field, whereas the view makes the id field nullable, but not the b table object

What is the desired result?

Both should have the same type. As stated in the docs:

To avoid plethora of nullable fields when joining tables with lots of columns we can utilise our nested select object syntax, our smart type inference will make whole object nullable instead of making all table fields nullable!

So both should make the b object table nullable, not the id field

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions