Dependency missed with a function used as default value
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
Direzione di ricerca
Riprodurre il problema con le definizioni della funzione e della tabella PostgreSQL fornite, quindi tracciare la convalida delle dipendenze e l’ordine delle istruzioni di migrazione che produce le istruzioni DROP FUNCTION e DROP TABLE. Il lavoro è completato quando l’uso esplicito della funzione nel valore predefinito della colonna viene riconosciuto come una dipendenza e la convalida produce un ordine sicuro senza l’errore segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello,
I have an issue with the following schema:
CREATE FUNCTION public.demo() RETURNS text
LANGUAGE plpgsql
AS $$
declare
begin
return 'hi';
end;
$$;
CREATE TABLE public.demo2 (
demo3 text DEFAULT public.demo() NOT NULL
);
The dependency between demo2 and demo is not detected, validation is not passing.
validating migration plan: running migration plan: executing migration statement: {DROP FUNCTION "public"."demo"() 3s 3s [HAS_UNTRACKABLE_DEPENDENCIES: Dependencies, i.e. other functions used in the function body, of non-sql functions cannot be tracked. As a result, we cannot guarantee that function dependencies are ordered properly relative to this statement. For drops, this means you need to ensure that all functions this function depends on are dropped after this statement.]}: ERROR: cannot drop function demo() because other objects depend on it (SQLSTATE 2BP01)
With generated statements lookings like this:
{
DDL: "DROP FUNCTION \"public\".\"demo\"()",
Timeout: 3000000000,
LockTimeout: 3000000000,
Hazards: {
{Type:"HAS_UNTRACKABLE_DEPENDENCIES", Message:"Dependencies, i.e. other functions used in the function body, of non-sql functions cannot be tracked. As a result, we cannot guarantee that function dependencies are ordered properly relative to this statement. For drops, this means you need to ensure that all functions this function depends on are dropped after this statement."},
},
},
{
DDL: "DROP TABLE \"public\".\"demo2\"",
Timeout: 1200000000000,
LockTimeout: 3000000000,
Hazards: {
{Type:"DELETES_DATA", Message:"Deletes all rows in the table (and the table itself)"},
},
},
I do understand that there are complexities tracking dependencies of functions, but could a 'obvious' dependency like that one, when the function is explicitly used somewhere else be detected?
I tried to dig a into the code but I was not sure where / how to find relevents part, if you have some pointers I would be happy to make a PR to improve that :)
- Lingua principale
- Go
- Stelle
- 894
- Fork
- 85
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stripe/pg-schema-diff
-
[BUG] "prohibited" misspelled as "prohited"Forse già presa @Hashim1999164 l’ha presa 90 giorni fa. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
stripe/pg-schema-diff#302 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
stripe/pg-schema-diff#283 · 1 reazione ·
-
[BUG] Dropping a column referenced only by an index predicate or expression failsForse già presa @xishell l’ha presa 28 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
stripe/pg-schema-diff#316 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
stripe/pg-schema-diff#301 ·
-
Is the repo active?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 15/100
stripe/pg-schema-diff#289 · 7 reazioni ·
Tutte le issue di stripe/pg-schema-diff
Issue simili
-
bug converter
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
grafana/sigma-rule-deployment#435 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
google/go-containerregistry#2491 ·
I maintainer di solito rispondono entro 1 giorno
-
stranded-follow-up sweep trusts any issue whose body carries the marker as the tracking issueApertatype:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nightgauge/nightgauge#2688 ·
I maintainer di solito rispondono entro 1 giorno
-
aiac enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno