-
Notifications
You must be signed in to change notification settings - Fork 63
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
Bump default version; add upgrade script #72
Conversation
@@ -25,7 +25,7 @@ else | |||
endif | |||
|
|||
EXTENSION = pg_shard | |||
DATA = pg_shard--1.0.sql | |||
DATA = pg_shard--1.1.sql pg_shard--1.0--1.1.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how does this work? Will both files be executed on a CREATE EXTENSION
command?
As I understand, and ALTER EXTENSION UPDATE
on a 1.0 installation will add the new UDF.
Should we be moving the UDF to the 1.1 file, and keeping the above line as pg_shard--1.1.sql only? If I run a CREATE EXTENSION
, shouldn't I expect the 1.1 file to include everything?
I'm not sure, so I'm just asking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how does this work? Will both files be executed on a
CREATE EXTENSION
command?
No, the extension will come with exactly one version: 1.1. If you want 1.0 you'd download that version instead.
So for installing from scratch, the 1.1 script is used. For upgrading from 1.0, PostgreSQL will route a path from 1.0 to 1.1. Here it's trivial (a single file), so it'll execute that to perform the upgrade.
Should we be moving the UDF to the 1.1 file, and keeping the above line as pg_shard--1.1.sql only?
The UDF is already in the 1.1 file. We checked it into 1.0, but this Pull Request renames the file to 1.1. The 1.1 standalone file should include everything (double check for me).
If I run a CREATE EXTENSION, shouldn't I expect the 1.1 file to include everything?
It does. Don't think about the code in develop
's history. Think about the history of releases. We released a 1.0 file in December. That's the only public install file so far. So for a 1.1 release we need two things:
- A 1.1 install file, to install 1.1 from scratch
- A 1.0-to-1.1 upgrade file, containing the delta between 1.0 and 1.1
This change renames the "main" install file to 1.1, satisfying the first requirement above and adds the upgrade script, satisfying the second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UDF is already in the 1.1 file. We checked it into 1.0, but this Pull Request renames the file to 1.1. The 1.1 standalone file should include everything (double check for me).
Ah, ok. That part I didn't realize. For some reason, I thought the UDF was only in the 1.0-1.1.sql file. The rest of it makes sense then. I checked, and the 1.1 sql file looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last question then. The create-extension command also supports a version. If I specify create-extension version 1.0, would that work? (And create 1.0 without the UDF?)
After checking on that, and assuming we've tested 1.0-1.1 upgrade and a 1.1 fresh install, you're good to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way to install version 1.0 would be to download 1.0 and use that. The state of affairs for our extensions seems to be:
- The latest download contains a script to install that latest version
- It also contains upgrade scripts from earlier versions
As a sanity check, I looked over at cstore, which looks exactly like pg_shard will after this Pull Request. |
Adding a new UDF means adding an upgrade script to augment existing installations of pg_shard.
78ffe34
to
c80bcbc
Compare
Testing (not currently automated in any fashion):
Here is the SQL for the upgrade: CREATE EXTENSION pg_shard VERSION '1.0';
ALTER EXTENSION pg_shard UPDATE;
# \dx
# List of installed extensions
# Name | Version | Schema | Description
# ----------+---------+------------+---------------------------------------------------------
# pg_shard | 1.1 | public | extension for sharding across remote PostgreSQL servers
# plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
# (2 rows) |
So yeah, the two caveats are:
But this patch works, works with an upgrade from 1.0, and matches what we're doing in cstore. |
Bump default version; add upgrade script cr: @sumedhpathak
Adding a new UDF means adding an upgrade script to augment existing installations of pg_shard.
fixes #69