-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade scripts should use CREATE OR REPLACE and the like #111
Comments
On Wed, Nov 29, 2023 at 04:26:52PM -0800, Ed Sabol wrote:
I was testing 1.4.0 in a database here before it was it was 1.4.0. When I went to upgrade to 1.4.1 and got
```
ERROR: function "spoly" already exists with same argument types
```
My solution was to change all the "CREATE FUNCTION" statements to
"CREATE OR REPLACE FUNCTION". The upgrade then worked fine. I feel
this should be the standard practice for all upgrade scripts, past
and future.
+1 on this. Re-runnable SQL is great; if all statements in our SQL
are re-runnable we can perhaps one day stop maintaining the upgraders
entirely (except perhaps a single cleanup script to drop severely
misguided material) and just run the full SQL on every upgrade.
The main trouble I see is that someone would need to research when IF
EXISTS and OR REPLACE were added where; I'm not absolutely sure all
versions we promise to support know about them in all constructs we
use in our SQL scripts.
|
I'm surprised that using |
Are we reading the same commit message? It says, "Hence, forbid CREATE OR REPLACE of an existing object unless it already belongs to the extension." (Emphasis mine.) So why shouldn't it work? |
Ah right, I had assumed you had created an |
I was testing 1.4.0 in a database here before it was it was 1.4.0. When I went to upgrade that database to 1.4.1, I got
My solution was to change all the "CREATE FUNCTION" statements in the upgrade script to "CREATE OR REPLACE FUNCTION". The upgrade then worked fine. I feel this should be the standard practice for all upgrade scripts, past and future.
The text was updated successfully, but these errors were encountered: