Strategy for making Postgres support multiple versions of client code
I cannot immediately see a problem with your idea, except that you have to change all code to use functions instead of data modifying SQL statements.

I can think of an alternative as follows: When you install your schema changes, also create a number of views that look just like the old tables and &ldquo;do the right thing&rdquo;:


SELECTs on the view return the same data you would get in the old version.
The views have triggers for INSERT, UPDATE and DELETE that perform the correct actions on the underlying tables.


Since the names of the views will collide with the table names, place the views in a different schema. You could pick a schema name based on the application version, and you can use search_path to assign different default schemas to the two application versions.

Once all clients are using the new version, you can drop the schema with the views.