1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Add the AS MATERIALIZED and AS NOT MATERIALIZED syntax that works like it

does in PostgreSQL.

FossilOrigin-Name: a6bb272ec0c758ab069bfc07443624e0ea7910b1f23224ee078d050fa3ccf068
This commit is contained in:
drh
2021-02-22 03:04:25 +00:00
parent a79e2a2d28
commit 745912efac
7 changed files with 52 additions and 28 deletions

View File

@@ -3895,8 +3895,16 @@ struct Cte {
Select *pSelect; /* The definition of this CTE */
const char *zCteErr; /* Error message for circular references */
CteUse *pUse; /* Usage information for this CTE */
u8 eM10d; /* The MATERIALIZED flag */
};
/*
** Allowed values for the materialized flag (eM10d):
*/
#define M10d_Yes 0 /* AS MATERIALIZED */
#define M10d_Any 1 /* Not specified. Query planner's choice */
#define M10d_No 2 /* AS NOT MATERIALIZED */
/*
** An instance of the With object represents a WITH clause containing
** one or more CTEs (common table expressions).
@@ -3924,6 +3932,7 @@ struct CteUse {
int regRtn; /* Return address register for addrM9e subroutine */
int iCur; /* Ephemeral table holding the materialization */
LogEst nRowEst; /* Estimated number of rows in the table */
u8 eM10d; /* The MATERIALIZED flag */
};
@@ -4930,7 +4939,7 @@ const char *sqlite3JournalModename(int);
int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
#endif
#ifndef SQLITE_OMIT_CTE
Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*);
Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*,u8);
void sqlite3CteDelete(sqlite3*,Cte*);
With *sqlite3WithAdd(Parse*,With*,Cte*);
void sqlite3WithDelete(sqlite3*,With*);