1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Alias visibility checking helpers.
//!
//! This module provides utilities for checking SQL alias visibility rules
//! across different dialects. Different SQL dialects have varying rules about
//! where SELECT list aliases can be referenced (GROUP BY, HAVING, ORDER BY, etc.).
use crate;
use crateDialect;
/// Emits a warning for unsupported alias usage in a SQL clause.
///
/// This helper centralizes the warning emission logic for alias visibility
/// checks across different clauses (GROUP BY, HAVING, ORDER BY, lateral aliases).
///
/// # Arguments
/// * `dialect` - The SQL dialect being used
/// * `clause_name` - The name of the clause where the alias is used (e.g., "GROUP BY", "HAVING")
/// * `alias_name` - The name of the alias being referenced
/// * `statement_index` - The index of the statement in the analysis request
///
/// # Returns
/// An `Issue` warning that can be pushed to the analyzer's issue list.
/// Emits a warning for unsupported lateral column alias usage.
///
/// Lateral column aliases allow referencing an alias defined earlier in the same
/// SELECT list. Not all dialects support this feature.
///
/// # Arguments
/// * `dialect` - The SQL dialect being used
/// * `alias_name` - The name of the alias being referenced
/// * `statement_index` - The index of the statement in the analysis request
///
/// # Returns
/// An `Issue` warning that can be pushed to the analyzer's issue list.