Skip to content
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

Open
esabol opened this issue Nov 30, 2023 · 4 comments
Open

Upgrade scripts should use CREATE OR REPLACE and the like #111

esabol opened this issue Nov 30, 2023 · 4 comments

Comments

@esabol
Copy link
Contributor

esabol commented Nov 30, 2023

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

ERROR:  function "spoly" already exists with same argument types

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.

@msdemlei
Copy link
Contributor

msdemlei commented Nov 30, 2023 via email

@df7cb
Copy link
Contributor

df7cb commented Dec 1, 2023

I'm surprised that using create or replace in the upgrade script worked to fix the problem because it actually shouldn't: postgres/postgres@b9b21ac

@esabol
Copy link
Contributor Author

esabol commented Dec 1, 2023

I'm surprised that using create or replace in the upgrade script worked to fix the problem because it actually shouldn't: postgres/postgres@b9b21ac

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?

@df7cb
Copy link
Contributor

df7cb commented Dec 1, 2023

Ah right, I had assumed you had created an spoly function outside of pg_sphere and then the upgrade complained it's already there, but it was a function from inside pg_sphere. That explains why it worked, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants