Skip to content

Cannot Use CTEs in Custom Sql Query #2735

@oluatte

Description

@oluatte

Howdy and thanks for all the hard work on Marten.

I am resurrecting (somewhat dormant) Marten project and just upgraded to latest. All custom sql queries in the project that uses a CTE are broken with an exception like below...

Could not determine an 'id/Id' field or property for requested document type Api.Orders.Application.Handlers.GetOrganizationStatsQueryHandler+GetOrganizationStatsQueryResultSummaryPoco

The problem might be this line which assumes every custom sql query starts with a SELECT. Queries using CTEs naturally start with WITH which fail the check and lead down the known / mapped T route.

Is using CTEs in custom queries no longer allowed?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions