mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-23 07:41:46 +00:00
A C-language routine's body from information_schema.routines is just the C symbol name, so its reconstructed stub (CREATE FUNCTION ... AS $gfx$ name $gfx$ LANGUAGE c) is unparseable by tree-sitter-sql, and the parser's error recovery consumes the statements that follow. With FK ALTER TABLEs emitted last, every references edge was silently lost on any DB with a common extension installed (uuid-ossp, pgcrypto, pg_trgm, fuzzystrmatch, ...). Emit the FK block before the routine DDL. FK statements only reference tables, which are emitted first, so the order is always safe. On a real DB with 35 tables / 41 FKs / 41 extension routines: 41/41 references edges vs 1/41 before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>