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
why drop instead of CREATE OR REPLACE ?