parseSubquery parses a subquery (SELECT or WITH statement). Expects current token to be SELECT or WITH.
()
| 394 | // parseSubquery parses a subquery (SELECT or WITH statement). |
| 395 | // Expects current token to be SELECT or WITH. |
| 396 | func (p *Parser) parseSubquery() (ast.Statement, error) { |
| 397 | if p.isType(models.TokenTypeWith) { |
| 398 | // WITH statement handles its own token consumption |
| 399 | return p.parseWithStatement() |
| 400 | } |
| 401 | |
| 402 | if p.isType(models.TokenTypeSelect) { |
| 403 | p.advance() // Consume SELECT |
| 404 | return p.parseSelectWithSetOperations() |
| 405 | } |
| 406 | |
| 407 | return nil, goerrors.ExpectedTokenError( |
| 408 | "SELECT or WITH", |
| 409 | p.currentToken.Token.Type.String(), |
| 410 | p.currentLocation(), |
| 411 | "", |
| 412 | ) |
| 413 | } |
no test coverage detected