Skip to content

Commit ab47a4d

Browse files
committed
feat: column masking policy is an ObjectName
1 parent 854548c commit ab47a4d

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/ast/ddl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ pub struct ColumnPolicyProperty {
16561656
/// ```
16571657
/// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table
16581658
pub with: bool,
1659-
pub policy_name: Ident,
1659+
pub policy_name: ObjectName,
16601660
pub using_columns: Option<Vec<Ident>>,
16611661
}
16621662

src/dialect/snowflake.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ fn parse_column_policy_property(
11741174
parser: &mut Parser,
11751175
with: bool,
11761176
) -> Result<ColumnPolicyProperty, ParserError> {
1177-
let policy_name = parser.parse_identifier()?;
1177+
let policy_name = parser.parse_object_name(false)?;
11781178
let using_columns = if parser.parse_keyword(Keyword::USING) {
11791179
parser.expect_token(&Token::LParen)?;
11801180
let columns = parser.parse_comma_separated(|p| p.parse_identifier())?;

tests/sqlparser_snowflake.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ fn test_snowflake_create_table_with_columns_masking_policy() {
694694
option: ColumnOption::Policy(ColumnPolicy::MaskingPolicy(
695695
ColumnPolicyProperty {
696696
with,
697-
policy_name: "p".into(),
697+
policy_name: ObjectName::from(vec![Ident::new("p")]),
698698
using_columns,
699699
}
700700
))
@@ -728,7 +728,7 @@ fn test_snowflake_create_table_with_columns_projection_policy() {
728728
option: ColumnOption::Policy(ColumnPolicy::ProjectionPolicy(
729729
ColumnPolicyProperty {
730730
with,
731-
policy_name: "p".into(),
731+
policy_name: ObjectName::from(vec![Ident::new("p")]),
732732
using_columns: None,
733733
}
734734
))
@@ -815,7 +815,7 @@ fn test_snowflake_create_table_with_several_column_options() {
815815
option: ColumnOption::Policy(ColumnPolicy::MaskingPolicy(
816816
ColumnPolicyProperty {
817817
with: true,
818-
policy_name: "p1".into(),
818+
policy_name: ObjectName::from(vec![Ident::new("p1")]),
819819
using_columns: Some(vec!["a".into(), "b".into()]),
820820
}
821821
)),
@@ -853,7 +853,7 @@ fn test_snowflake_create_table_with_several_column_options() {
853853
option: ColumnOption::Policy(ColumnPolicy::ProjectionPolicy(
854854
ColumnPolicyProperty {
855855
with: false,
856-
policy_name: "p2".into(),
856+
policy_name: ObjectName::from(vec![Ident::new("p2")]),
857857
using_columns: None,
858858
}
859859
)),

0 commit comments

Comments
 (0)