PostgreSQL
 SQL >> Database >  >> RDS >> PostgreSQL

Debug dell'errore “Key is not present in table” in PostgreSQL

L'errore può indicare che esistono due tabelle con lo stesso nome in schema diversi. Cerca tutte le tabelle bg:

SELECT * FROM pg_tables WHERE tablename = 'bg';

Controlla anche il search_path. In alternativa, l'indice potrebbe essere corrotto: prova REINDEX.

Se usi l'ereditarietà, ricorda che i vincoli foreign key non sono ereditati. Puoi verificare con:

SELECT * FROM ONLY bg WHERE bg_id = '470370111002'