MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / ParseExpr

Method ParseExpr

pkg/sql/plpgsql/parser/lexer.go:626–637  ·  view source on GitHub ↗
(sqlStr string)

Source from the content-addressed store, hash-verified

624}
625
626func (l *lexer) ParseExpr(sqlStr string) (plpgsqltree.Expr, error) {
627 // Use ParseExprs instead of ParseExpr in order to correctly handle the case
628 // when multiple expressions are incorrectly passed.
629 exprs, err := parser.ParseExprs([]string{sqlStr})
630 if err != nil {
631 return nil, err
632 }
633 if len(exprs) != 1 {
634 return nil, pgerror.Newf(pgcode.Syntax, "query returned %d columns", len(exprs))
635 }
636 return exprs[0], nil
637}
638
639// ReadTarget reads a comma-separated list of target variables from the current
640// position.

Callers 3

ParseReturnExprMethod · 0.95
ParseMethod · 0.80

Calls 2

ParseExprsFunction · 0.92
NewfFunction · 0.92

Tested by

no test coverage detected