I think you misunderstood my point. You mentioned that "SQL isn't type-safe", which is NOT true. Any decent RDB engine allows to perform typechecking and validation of your query without executing it. This means that SQL is typesafe at compile time.
Fair enough. This is a small consolation for practitioners, especially since much SQL is often composed dynamically, and the engine can't tell you about where the composition went wrong (unlike Rust, TS, etc). Maybe if SQL had its own hygienic macro language, but I'm not sure how that would compare to libraries like Prisma.