Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/impls/translator_impls/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1997,6 +1997,9 @@ impl crate::traits::translator::TranslatorWithContext for Statement {
drop_with_warning("ALTER FUNCTION", REASON_ACCESS_CONTROL, emit)
}
Self::CreateServer(_) => drop_with_warning("CREATE SERVER", REASON_FOREIGN_DATA, emit),
Self::CreateForeignTable(_) => {
drop_with_warning("CREATE FOREIGN TABLE", REASON_FOREIGN_DATA, emit)
}
Self::CreateConnector(_) => {
drop_with_warning("CREATE CONNECTOR", REASON_FOREIGN_DATA, emit)
}
Expand Down
1 change: 1 addition & 0 deletions tests/test_no_statement_is_silently_dropped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ const CASES: &[Case] = &[
warned("DROP SEQUENCE seq"),
// Warned and dropped: foreign data and credentials.
warned("CREATE SERVER srv FOREIGN DATA WRAPPER postgres_fdw"),
warned("CREATE FOREIGN TABLE ft (id INT) SERVER srv"),
warned("CREATE CONNECTOR c TYPE 'mysql'"),
warned("ALTER CONNECTOR c SET URL 'u'"),
warned("DROP CONNECTOR c"),
Expand Down
11 changes: 11 additions & 0 deletions tests/test_translation_warnings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ fn create_server_emits_lossy_drop_warning() {
assert_lossy_drop(&warns[0], "CREATE SERVER");
}

#[test]
fn create_foreign_table_emits_lossy_drop_warning() {
let warns = warnings_for(
"CREATE SERVER s FOREIGN DATA WRAPPER w;\n\
CREATE FOREIGN TABLE f (id INT) SERVER s;",
);
assert_eq!(warns.len(), 2);
assert_lossy_drop(&warns[0], "CREATE SERVER");
assert_lossy_drop(&warns[1], "CREATE FOREIGN TABLE");
}

#[test]
fn create_role_emits_lossy_drop_warning() {
let warns = warnings_for("CREATE ROLE alice;");
Expand Down
Loading