PostgreSQL: Share operator-function formatting
diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs
index 2fd20dc..c1780e2 100644
--- a/src/ast/ddl.rs
+++ b/src/ast/ddl.rs
@@ -5101,17 +5101,13 @@
                 op_types,
                 function_name,
                 argument_types,
-            } => {
-                write!(f, "FUNCTION {support_number}")?;
-                if let Some(types) = op_types {
-                    write!(f, " ({})", display_comma_separated(types))?;
-                }
-                write!(f, " {function_name}")?;
-                if !argument_types.is_empty() {
-                    write!(f, "({})", display_comma_separated(argument_types))?;
-                }
-                Ok(())
-            }
+            } => fmt_operator_function(
+                f,
+                *support_number,
+                op_types.as_deref(),
+                function_name,
+                argument_types,
+            ),
             OperatorClassItem::Storage { storage_type } => {
                 write!(f, "STORAGE {storage_type}")
             }
@@ -5337,21 +5333,35 @@
                 op_types,
                 function_name,
                 argument_types,
-            } => {
-                write!(f, "FUNCTION {support_number}")?;
-                if let Some(types) = op_types {
-                    write!(f, " ({})", display_comma_separated(types))?;
-                }
-                write!(f, " {function_name}")?;
-                if !argument_types.is_empty() {
-                    write!(f, "({})", display_comma_separated(argument_types))?;
-                }
-                Ok(())
-            }
+            } => fmt_operator_function(
+                f,
+                *support_number,
+                op_types.as_deref(),
+                function_name,
+                argument_types,
+            ),
         }
     }
 }
 
+fn fmt_operator_function(
+    f: &mut fmt::Formatter,
+    support_number: u64,
+    op_types: Option<&[DataType]>,
+    function_name: &ObjectName,
+    argument_types: &[DataType],
+) -> fmt::Result {
+    write!(f, "FUNCTION {support_number}")?;
+    if let Some(types) = op_types {
+        write!(f, " ({})", display_comma_separated(types))?;
+    }
+    write!(f, " {function_name}")?;
+    if !argument_types.is_empty() {
+        write!(f, "({})", display_comma_separated(argument_types))?;
+    }
+    Ok(())
+}
+
 impl fmt::Display for OperatorFamilyDropItem {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs
index da83d4f..c99a065 100644
--- a/tests/sqlparser_postgres.rs
+++ b/tests/sqlparser_postgres.rs
@@ -11026,3 +11026,16 @@
         pg_and_generic().verified_stmt(sql);
     }
 }
+
+#[test]
+fn operator_function_display_preserves_empty_operator_types() {
+    for (op_types, expected) in [(None, "FUNCTION 1 f"), (Some(vec![]), "FUNCTION 1 () f")] {
+        let item = OperatorFamilyItem::Function {
+            support_number: 1,
+            op_types,
+            function_name: ObjectName::from(vec![Ident::new("f")]),
+            argument_types: vec![],
+        };
+        assert_eq!(item.to_string(), expected);
+    }
+}