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

v0.61.1 introduces bug in typescript generation for computed column

Aperta
#568 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
postgresql, typescript
Ambito
databases

Direzione di ricerca

Inizia dalla riga 44 di src/lib/sql/functions.sql e riproduci il problema con il comando gen types typescript fornito, usando la tabella people di esempio e la funzione full_name. Verifica che il campo full_name generato sia tipizzato come string | null anziché unknown | null, quindi verifica che l’output generato corrisponda alla struttura TypeScript prevista.

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

Descrizione

bug

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

The below line introduced the bug in v0.61.1
https://github.com/supabase/postgres-meta/blob/e4dc2177cded3e06d07301570b2395099d860d24/src/lib/sql/functions.sql#L44

- rt.typname as return_type,
+ pg_get_function_result(f.oid) as return_type,

The above results in computed column typehint always equal to unknown

To Reproduce

Setup Supabase with the following schema:

CREATE TABLE people (
  fname text,
  lname text
);

CREATE FUNCTION full_name(people) RETURNS text AS $$
  SELECT $1.fname || ' ' || $1.lname;
$$ LANGUAGE SQL;

Run

node \
  --no-warnings \
  dist/server/server.js \   
  gen types typescript \
  --include-schemas public

Or the following if docker-compose is setup with meta using v0.61.1:

docker-compose exec -T meta node \
  --no-warnings \
  dist/server/server.js \   
  gen types typescript \
  --include-schemas public

Expected behavior

The typescript generated should be

export interface Database {
  public: {
    Tables: {
      account: {
        Row: {
          fname: string | null;
          lname: string | null;
          full_name: string | null;
        };
      }
    }
...

Screenshots

The typescript generated is however

export interface Database {
  public: {
    Tables: {
      account: {
        Row: {
          fname: string | null;
          lname: string | null;
          full_name: unknown | null;
        };
      }
    }
...

System information

  • OS: macOS
  • Browser (if applies): N/A
  • Version of supabase-js: N/A
  • Version of Node.js: N/A

Additional context

Reverting the changes of the below resolve the issue
https://github.com/supabase/postgres-meta/blob/e4dc2177cded3e06d07301570b2395099d860d24/src/lib/sql/functions.sql#L44

- rt.typname as return_type,
+ pg_get_function_result(f.oid) as return_type,
Lingua principale
TypeScript
Stelle
1.2k
Fork
224
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 supabase/postgres-meta

Tutte le issue di supabase/postgres-meta

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.