News for hackers. Stuff that matters.
Re:How We Went All In on sqlc/pgx for Postgres and Go by jerrysievert on Thursday September 09, 2021 @07:54AM (#28468668)
> I had each function definition in its own .sql file, with a preceding "drop function" call, and a Makefile clause to run them all.

why drop instead of CREATE OR REPLACE ?

Re:How We Went All In on sqlc/pgx for Postgres and Go by marcus_holmes on Thursday September 09, 2021 @08:48AM (#28469087)
CREATE OR REPLACE requires that the new function has the same signature as the old one [0]. I understand why, but I needed to change the signature sometimes. It was easier to do a Drop and then a Create as standard. Though this did mean having to manage dependencies between files myself (I prefixed the .sql files with 00_, 01_,02_ etc to indicate order of dependencies). It sounds like a lot of work, but in practice it was easy - it broke very quickly and very loudly if I got it wrong at all ;)

[0] https://www.postgresql.org/docs/13/sql-createfunction.html