`ecpg` is pretty cool. You can embed SQL statements in C code.