sqlparser/dialect/
redshift.rs1use crate::dialect::Dialect;
19use core::iter::Peekable;
20use core::str::Chars;
21
22use super::PostgreSqlDialect;
23
24#[derive(#[automatically_derived]
impl ::core::fmt::Debug for RedshiftSqlDialect {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "RedshiftSqlDialect")
}
}Debug, #[automatically_derived]
impl ::core::default::Default for RedshiftSqlDialect {
#[inline]
fn default() -> RedshiftSqlDialect { RedshiftSqlDialect {} }
}Default, #[automatically_derived]
impl ::core::clone::Clone for RedshiftSqlDialect {
#[inline]
fn clone(&self) -> RedshiftSqlDialect { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for RedshiftSqlDialect { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for RedshiftSqlDialect {
#[inline]
fn eq(&self, other: &RedshiftSqlDialect) -> bool { true }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for RedshiftSqlDialect {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for RedshiftSqlDialect {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {}
}Hash, #[automatically_derived]
impl ::core::cmp::PartialOrd for RedshiftSqlDialect {
#[inline]
fn partial_cmp(&self, other: &RedshiftSqlDialect)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for RedshiftSqlDialect {
#[inline]
fn cmp(&self, other: &RedshiftSqlDialect) -> ::core::cmp::Ordering {
::core::cmp::Ordering::Equal
}
}Ord)]
26#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
27pub struct RedshiftSqlDialect {}
28
29impl Dialect for RedshiftSqlDialect {
36 fn is_nested_delimited_identifier_start(&self, ch: char) -> bool {
45 ch == '['
46 }
47
48 fn peek_nested_delimited_identifier_quotes(
60 &self,
61 mut chars: Peekable<Chars<'_>>,
62 ) -> Option<(char, Option<char>)> {
63 if chars.peek() != Some(&'[') {
64 return None;
65 }
66
67 chars.next();
68
69 let mut not_white_chars = chars.skip_while(|ch| ch.is_whitespace()).peekable();
70
71 if let Some(&ch) = not_white_chars.peek() {
72 if ch == '"' {
73 return Some(('[', Some('"')));
74 }
75 if self.is_identifier_start(ch) {
76 return Some(('[', None));
77 }
78 }
79
80 None
81 }
82
83 fn is_identifier_start(&self, ch: char) -> bool {
84 PostgreSqlDialect {}.is_identifier_start(ch) || ch == '#'
87 }
88
89 fn is_identifier_part(&self, ch: char) -> bool {
90 PostgreSqlDialect {}.is_identifier_part(ch) || ch == '#'
93 }
94
95 fn convert_type_before_value(&self) -> bool {
98 true
99 }
100
101 fn supports_connect_by(&self) -> bool {
102 true
103 }
104
105 fn supports_top_before_distinct(&self) -> bool {
108 true
109 }
110
111 fn supports_partiql(&self) -> bool {
113 true
114 }
115
116 fn supports_string_escape_constant(&self) -> bool {
117 true
118 }
119
120 fn supports_geometric_types(&self) -> bool {
121 true
122 }
123
124 fn supports_bitwise_shift_operators(&self) -> bool {
125 true
126 }
127
128 fn supports_array_typedef_with_brackets(&self) -> bool {
129 true
130 }
131
132 fn allow_extract_single_quotes(&self) -> bool {
133 true
134 }
135
136 fn supports_string_literal_backslash_escape(&self) -> bool {
137 true
138 }
139
140 fn supports_select_wildcard_exclude(&self) -> bool {
141 true
142 }
143
144 fn supports_select_exclude(&self) -> bool {
145 true
146 }
147
148 fn supports_create_table_like_parenthesized(&self) -> bool {
149 true
150 }
151
152 fn supports_string_literal_concatenation_with_newline(&self) -> bool {
153 true
154 }
155}