use crate::dialect::Dialect;
use core::iter::Peekable;
use core::str::Chars;
use super::PostgreSqlDialect;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RedshiftSqlDialect {}
impl Dialect for RedshiftSqlDialect {
fn is_nested_delimited_identifier_start(&self, ch: char) -> bool {
ch == '['
}
fn peek_nested_delimited_identifier_quotes(
&self,
mut chars: Peekable<Chars<'_>>,
) -> Option<(char, Option<char>)> {
if chars.peek() != Some(&'[') {
return None;
}
chars.next();
let mut not_white_chars = chars.skip_while(|ch| ch.is_whitespace()).peekable();
if let Some(&ch) = not_white_chars.peek() {
if ch == '"' {
return Some(('[', Some('"')));
}
if self.is_identifier_start(ch) {
return Some(('[', None));
}
}
None
}
fn is_identifier_start(&self, ch: char) -> bool {
PostgreSqlDialect {}.is_identifier_start(ch) || ch == '#'
}
fn is_identifier_part(&self, ch: char) -> bool {
PostgreSqlDialect {}.is_identifier_part(ch) || ch == '#'
}
fn convert_type_before_value(&self) -> bool {
true
}
fn supports_connect_by(&self) -> bool {
true
}
fn supports_top_before_distinct(&self) -> bool {
true
}
fn supports_partiql(&self) -> bool {
true
}
fn supports_string_escape_constant(&self) -> bool {
true
}
fn supports_geometric_types(&self) -> bool {
true
}
fn supports_bitwise_shift_operators(&self) -> bool {
true
}
fn supports_array_typedef_with_brackets(&self) -> bool {
true
}
fn allow_extract_single_quotes(&self) -> bool {
true
}
fn supports_string_literal_backslash_escape(&self) -> bool {
true
}
fn supports_select_wildcard_exclude(&self) -> bool {
true
}
fn supports_select_exclude(&self) -> bool {
true
}
fn supports_create_table_like_parenthesized(&self) -> bool {
true
}
fn supports_string_literal_concatenation_with_newline(&self) -> bool {
true
}
}