@@ -308,19 +308,31 @@ pub(crate) fn classify_name_ref(node: &SyntaxNode) -> Option<NameRefClass> {
308308 return Some ( NameRefClass :: Schema ) ;
309309 }
310310
311- // Check for function/procedure reference in CREATE OPERATOR before the type check
311+ // Check for function/procedure reference in CREATE OPERATOR / CREATE AGGREGATE
312+ // before the type check
312313 for ancestor in node. ancestors ( ) {
313314 if let Some ( attr_option) = ast:: AttributeOption :: cast ( ancestor. clone ( ) )
314315 && let Some ( name) = attr_option. name ( )
315316 {
316317 let attr_name = Name :: from_node ( & name) ;
317- if attr_name == Name :: from_string ( "function" )
318- || attr_name == Name :: from_string ( "procedure" )
319- {
320- for outer in attr_option. syntax ( ) . ancestors ( ) {
321- if ast:: CreateOperator :: can_cast ( outer. kind ( ) ) {
322- return Some ( NameRefClass :: FunctionName ) ;
323- }
318+ for outer in attr_option. syntax ( ) . ancestors ( ) {
319+ if ast:: CreateOperator :: can_cast ( outer. kind ( ) )
320+ && ( attr_name == Name :: from_string ( "function" )
321+ || attr_name == Name :: from_string ( "procedure" ) )
322+ {
323+ return Some ( NameRefClass :: FunctionName ) ;
324+ }
325+ if ast:: CreateAggregate :: can_cast ( outer. kind ( ) )
326+ && ( attr_name == Name :: from_string ( "sfunc" )
327+ || attr_name == Name :: from_string ( "finalfunc" )
328+ || attr_name == Name :: from_string ( "combinefunc" )
329+ || attr_name == Name :: from_string ( "serialfunc" )
330+ || attr_name == Name :: from_string ( "deserialfunc" )
331+ || attr_name == Name :: from_string ( "msfunc" )
332+ || attr_name == Name :: from_string ( "minvfunc" )
333+ || attr_name == Name :: from_string ( "mfinalfunc" ) )
334+ {
335+ return Some ( NameRefClass :: FunctionName ) ;
324336 }
325337 }
326338 }
0 commit comments