go-pg / pg

Golang ORM with focus on PostgreSQL features and performance
https://pg.uptrace.dev/
BSD 2-Clause "Simplified" License
5.65k stars 401 forks source link

feat(orm): add materialization to SELECT CTE statements #1948

Closed maximerety closed 2 years ago

maximerety commented 2 years ago

For emergency situations where we would want to force CTE materialization:

func (q *Query) With(name string, subq *Query) *Query                // WITH "name" AS (...)
func (q *Query) WithMaterialized(name string, subq *Query) *Query    // WITH "name" AS MATERIALIZED (...)
func (q *Query) WithNotMaterialized(name string, subq *Query) *Query // WITH "name" AS NOT MATERIALIZED (...)
maximerety commented 2 years ago

Merge request created upstream by mistake. Sorry about the noise 🙇