Skip to content

Commit 7ff9c99

Browse files
localstack-spiral[bot]spiralhovaesco
authored
LAV-4358: Pin alert dollar literals and fix warehouse parity (#4584)
Capture a finite single-quoted versus $$-quoted CREATE/ALTER alert matrix against real Snowflake: interval/cron/invalid schedules, apostrophes and multiline COMMENT/CONFIG/RUNBOOK/tag values, empty properties, and warehouse strings. Pin the original full CREATE/ALTER sequence, including the exact ALTER CONFIG = $${"k":2}$$ and configuration observed by the executed action. Error tests snapshot verbatim connector messages, codes and SQL states. The original CONFIG path already works. Cloud replay exposed three remaining literal gaps: CREATE WAREHOUSE rejected dollars, ALTER WAREHOUSE stored SQL quoting instead of the value, and PostgreSQL-only tagged dollar literals were accepted. Fix the alert-specific parser and warehouse rewrite, and reject tagged literals within the CREATE header / ALTER SET clause only. Preserve verbatim alert bodies and existing property validation. Match Cloud's bare 091086 invalid-schedule message rather than adding a compilation header. No new setters, CREATE RUNBOOK, public types or native PostgreSQL signatures. Co-authored-by: Przemek Denkiewicz <przemyslaw.denkiewicz@localstack.cloud> ## Verification - Serial real-Snowflake capture: 59 new snapshot cells; subsequent focused error/terminator captures use the verbatim exception fixture. - make check: passed (clippy, warnings-as-errors, formatting). - make test-vendored-sqlparser: passed. - Focused make test-compat on test_alerts.py and test_alert_literals.py: 135 passed, covering creation, properties, tags, configuration execution, helper context errors, time helpers and execution-time body transformation. ## Test matrix original CREATE/ALTER CONFIG x stored + execution -> tests/queries/test_alert_literals.py::test_alert_ddl_dollar_quoted_literals tagged dollars / it's a comment-alter-if-exists x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[it's a comment-alter-if-exists] tagged dollars / it's a comment-alter x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[it's a comment-alter] tagged dollars / it's a comment-create-if-not-exists x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[it's a comment-create-if-not-exists] tagged dollars / it's a comment-create-replace x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[it's a comment-create-replace] tagged dollars / it's a comment-create x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[it's a comment-create] tagged dollars / plain-alter-if-exists x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[plain-alter-if-exists] tagged dollars / plain-alter x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[plain-alter] tagged dollars / plain-create-if-not-exists x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[plain-create-if-not-exists] tagged dollars / plain-create-replace x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[plain-create-replace] tagged dollars / plain-create x error -> tests/queries/test_alert_literals.py::test_alert_ddl_rejects_tagged_dollar_literals[plain-create] alter-comment-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-comment-dollar] alter-comment-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-comment-single] alter-config-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-config-dollar] alter-config-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-config-single] alter-cron-schedule-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-cron-schedule-dollar] alter-cron-schedule-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-cron-schedule-single] alter-empty-comment-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-comment-dollar] alter-empty-comment-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-comment-single] alter-empty-config-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-config-dollar] alter-empty-config-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-config-single] alter-empty-runbook-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-runbook-dollar] alter-empty-runbook-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-runbook-single] alter-empty-tag-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-tag-dollar] alter-empty-tag-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-empty-tag-single] alter-invalid-schedule-dollar x error -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-invalid-schedule-dollar] alter-invalid-schedule-single x error -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-invalid-schedule-single] alter-runbook-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-runbook-dollar] alter-runbook-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-runbook-single] alter-schedule-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-schedule-dollar] alter-schedule-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-schedule-single] alter-tag-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-tag-dollar] alter-tag-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-tag-single] alter-warehouse-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-warehouse-dollar] alter-warehouse-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[alter-warehouse-single] create-comment-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-comment-dollar] create-comment-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-comment-single] create-config-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-config-dollar] create-config-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-config-single] create-cron-schedule-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-cron-schedule-dollar] create-cron-schedule-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-cron-schedule-single] create-empty-comment-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-comment-dollar] create-empty-comment-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-comment-single] create-empty-config-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-config-dollar] create-empty-config-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-config-single] create-empty-tag-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-tag-dollar] create-empty-tag-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-tag-single] create-empty-with-tag-dollar x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-with-tag-dollar] create-empty-with-tag-single x boundary -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-empty-with-tag-single] create-invalid-schedule-dollar x error -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-invalid-schedule-dollar] create-invalid-schedule-single x error -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-invalid-schedule-single] create-schedule-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-schedule-dollar] create-schedule-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-schedule-single] create-tag-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-tag-dollar] create-tag-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-tag-single] create-warehouse-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-warehouse-dollar] create-warehouse-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-warehouse-single] create-with-tag-dollar x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-with-tag-dollar] create-with-tag-single x stored -> tests/queries/test_alert_literals.py::test_alert_ddl_string_position_matrix[create-with-tag-single] Co-authored-by: spiral <spiral@localhost> Co-authored-by: Przemek Denkiewicz <przemyslaw.denkiewicz@localstack.cloud>
1 parent 8f75cf3 commit 7ff9c99

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/parser/mod.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6315,7 +6315,11 @@ impl<'a> Parser<'a> {
63156315
loop {
63166316
if self.parse_keyword(Keyword::WAREHOUSE) {
63176317
self.expect_token(&Token::Eq)?;
6318-
warehouse = Some(self.parse_identifier()?);
6318+
warehouse = Some(if matches!(self.peek_token().token, Token::DollarQuotedString(_)) {
6319+
Ident::new(self.parse_literal_string()?)
6320+
} else {
6321+
self.parse_identifier()?
6322+
});
63196323
} else if self.parse_keyword(Keyword::SCHEDULE) {
63206324
self.expect_token(&Token::Eq)?;
63216325
schedule = if self.parse_keyword(Keyword::NULL) {

0 commit comments

Comments
 (0)