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

declarative schema ignores grants with columns on views

Aperta
#6,761 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, sql, typescript
Ambito
cli, database, devtools

Direzione di ricerca

Look at the declarative schema sync logic in the CLI, likely in a file handling PostgreSQL grants and view parsing. The issue is that column-specific grants on views are not being output. Start by searching for 'GRANT' and 'VIEW' in the codebase, then examine how grants are collected and compared. The test case provided gives a clear reproduction; verify the missing grant statement is generated. Check the output of the sync command against the expected SQL.

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

Descrizione

bug supabase/cli
Affected area

Database

Supabase CLI version

v2.117.0

Operating system

macOS

Installation method

brew

Command
supabase db schema declarative sync
Actual output
CREATE TABLE "private"."items" (
  "id"        integer NOT NULL,
  "name"      text    NOT NULL,
  "is_active" boolean NOT NULL DEFAULT true,
  CONSTRAINT "items_pkey" PRIMARY KEY (id)
);

CREATE VIEW "api"."items" WITH (security_invoker=true) AS  SELECT id,
    name,
    is_active
   FROM private.items;

GRANT INSERT ("name") ON TABLE "private"."items" TO "authenticated";

GRANT DELETE, INSERT, MAINTAIN, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLE "private"."items" TO "postgres", "service_role";

GRANT DELETE, INSERT, MAINTAIN, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLE "api"."items" TO "postgres", "service_role";
Expected behavior

Output should include the missing grant statement as described in "steps to reproduce" section

GRANT INSERT ("name") ON TABLE "api"."items" TO "authenticated";
Steps to reproduce
  1. Create minimal declaration files:

supabase/database/private/schema.sql

CREATE SCHEMA "private";

GRANT CREATE, USAGE ON SCHEMA "private" TO "postgres";

GRANT USAGE ON SCHEMA "private" TO "service_role", "supabase_auth_admin";

supabase/database/api/schema.sql

CREATE SCHEMA "api";

GRANT USAGE ON SCHEMA "api" TO "authenticated";

GRANT CREATE, USAGE ON SCHEMA "api" TO "postgres";

GRANT USAGE ON SCHEMA "api" TO "service_role";

supabase/database/private/tables/items.sql

CREATE TABLE "private"."items"(
  "id" integer NOT NULL PRIMARY KEY,
  "name" text NOT NULL,
  "is_active" boolean NOT NULL DEFAULT TRUE
);

GRANT DELETE, INSERT, MAINTAIN, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLE "private"."items" TO "postgres", "service_role";

GRANT INSERT ("name") ON TABLE "private"."items" TO "authenticated";

supabase/database/api/views/.sql

CREATE VIEW "api"."items" WITH ( security_invoker = TRUE
) AS
SELECT
  id,
  name,
  is_active
FROM
  private.items;

GRANT DELETE, INSERT, MAINTAIN, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLE "api"."items" TO "postgres", "service_role";

GRANT INSERT ("name") ON TABLE "api"."items" TO "authenticated";
  1. Execute supabase db schema declarative sync
Crash report ID

No response

Docker and service versions

Additional context

No response

Lingua principale
TypeScript
Stelle
2.4k
Fork
523
Merge medio
1g 1h
PR unite (30g)
268

Guida per i contributori

Apri la guida per i contributori

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 supabase/cli

Tutte le issue di supabase/cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.