Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

New rules: ban dropping views, functions, types, triggers, and column defaults

Aperta
#1,370 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, rust, sql
Ambito
databases, tooling

Direzione di ricerca

Start by locating the existing ban-drop-column rule and its related tests, then trace how PostgreSQL statements are parsed and compatibility rules are registered. Done means coverage for dropping views, functions or procedures, types, defaults, and triggers, with behavior consistent with the existing rule naming and messages.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Hi, and thanks for Squawk! We run it in CI to verify that the previously deployed version of an app still runs against the new schema, so a rollback remains possible.

The ban-drop-*, renaming-*, and changing-column-type rules cover tables and columns well. Dropping other objects that application code depends on, however, is not covered.

On 2.66.0, none of these statements reports a compatibility rule. Only prefer-robust-stmts fires, on some of them:

DROP VIEW v;
DROP MATERIALIZED VIEW mv;
DROP FUNCTION f(int);
DROP TYPE t;
DROP TRIGGER trg ON tbl;
ALTER TABLE tbl ALTER COLUMN c DROP DEFAULT;

For comparison, ALTER TABLE tbl DROP COLUMN c reports ban-drop-column.

How these break existing clients:

  1. DROP VIEW / DROP MATERIALIZED VIEW: queries against the view fail with 42P01 undefined_table.
  2. DROP FUNCTION / DROP PROCEDURE: calls fail with 42883 undefined_function.
  3. DROP TYPE: casts or parameters that name the type fail with 42704 undefined_object. With CASCADE, it also drops every column of that type.
  4. ALTER COLUMN ... DROP DEFAULT: inserts that omit the column fail with 23502 not_null_violation on a NOT NULL column. On a nullable column, they silently write NULL.
  5. DROP TRIGGER: nothing errors, but code that relied on the trigger (e.g. maintaining updated_at or writing audit rows) silently loses that behaviour. This one, is a bit less important though, so I'd leave this up to your judgement.

I suggest adding the following rules, using the existing naming (roughly in priority order):

  • ban-drop-view (including materialized views)
  • ban-drop-function (including procedures)
  • ban-drop-type
  • ban-drop-default
  • ban-drop-trigger

The problem and solution text could mirror ban-drop-column: "Dropping a view may break existing clients. Update your application code to no longer use the view, then drop it in a later migration."

Related: #316, since these would fit the backwards-compatibility group suggested there, and #937, which makes the same case for rolling deploys and rollbacks.

Happy to open a PR for any of these if you're open to it. Thanks!

Lingua principale
Rust
Stelle
1.2k
Fork
72
Merge medio
2h 44m
PR unite (30g)
51

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sbdchd/squawk

Tutte le issue di sbdchd/squawk

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.