CheckIsWindowOrAgg returns an error if the function definition is not a window function or an aggregate.
(def *FunctionDefinition)
| 826 | // CheckIsWindowOrAgg returns an error if the function definition is not a |
| 827 | // window function or an aggregate. |
| 828 | func CheckIsWindowOrAgg(def *FunctionDefinition) error { |
| 829 | switch def.Class { |
| 830 | case AggregateClass: |
| 831 | case WindowClass: |
| 832 | default: |
| 833 | return pgerror.Newf(pgcode.WrongObjectType, |
| 834 | "OVER specified, but %s() is neither a window function nor an aggregate function", |
| 835 | def.Name) |
| 836 | } |
| 837 | return nil |
| 838 | } |
| 839 | |
| 840 | // TypeCheck implements the Expr interface. |
| 841 | func (expr *FuncExpr) TypeCheck( |