Reputation: 1386
I don’t understand how to deal with schema changes and function definitions (which are by nature strings).
For example, if I have a table called tablename1
and/or a column called columnname1
, and these are referenced throughout my functions, how should I go about updating my (many) functions when I delete or rename either one in my schema (for example to tablename2
or columnname2
)?
I read this interesting Q&A.
My conclusion is that I should be using easily identifiable table/column names so that I may then easily Ctrl+F and replace in my favorite text editor the reference to those renamed tables or columns across all of the function definitions...
This sounds quite clunky and error prone, and I would imagine this need may occur often even in production environments?
I enjoy the benefits of Postgres functions and like to keep application logic as close to the database as possible but this seems like a reason not to do it? Or perhaps I am mistaken in changing tables and columns referenced in function bodies?
Upvotes: 0
Views: 86