3 ms·
> 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
by jerrysievert 5y ago
> 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 ?
- marcus_holmes 5y agoCREATE 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 https://www.postgresql.org/docs/13/sql-createfunction.html