Skip to content

Commit 0af231d

Browse files
committed
Use a single version number for program, library and SQL
Having the SQL on a different numbering scheme is useful to provide an ungrade path. But pg_repack has no need of such a path as it can be uninstalled with no problem, so we are not going to provide update script. Hence it's much easier to have a single version number for everything.
1 parent ffe5a2b commit 0af231d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

lib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.deps/
22
/pg_repack.sql
33
/pg_repack--[0-9.]*.sql
4+
/pg_repack.control

lib/Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,14 @@ OBJS = repack.o pgut/pgut-be.o pgut/pgut-spi.o
1717
REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \
1818
| sed -e 's/\s*"version":\s*"\(.*\)",/\1/')
1919

20-
# The version of the extension, read from the .control file.
21-
# Note that it doesn't need to be the same of the library version: it should
22-
# be increased only when the sql changes.
23-
EXTVER = $(shell grep -e '^default_version' $(EXTENSION).control \
24-
| sed -e "s/[^']*'\([^']*\)'.*/\1/")
25-
2620
PG_CPPFLAGS = -DREPACK_VERSION=$(REPACK_VERSION)
2721

2822
# Support CREATE EXTENSION for PG >= 9.1 and a simple sql script for PG < 9.1
2923
HAVE_EXTENSION = $(shell $(PG_CONFIG) --version \
3024
| grep -qE " 8\.| 9\.0" && echo no || echo yes)
3125

3226
ifeq ($(HAVE_EXTENSION),yes)
33-
DATA_built = pg_repack--$(EXTVER).sql
27+
DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control
3428
else
3529
DATA_built = pg_repack.sql
3630
DATA = uninstall_pg_repack.sql
@@ -49,5 +43,8 @@ pg_repack.sql: pg_repack.sql.in
4943
sed 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' $< >> $@; \
5044
echo "\nCOMMIT;" >> $@;
5145

52-
pg_repack--$(EXTVER).sql: pg_repack.sql.in
46+
pg_repack--$(REPACK_VERSION).sql: pg_repack.sql.in
5347
cat $< > $@;
48+
49+
pg_repack.control: pg_repack.control.in
50+
sed 's,REPACK_VERSION,$(REPACK_VERSION),g' $< > $@
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pg_repack extension
22
comment = 'Reorganize tables in PostgreSQL databases with minimal locks'
3-
default_version = '1.2dev0'
3+
default_version = 'REPACK_VERSION'
44
module_pathname = '$libdir/pg_repack'
55
relocatable = false

0 commit comments

Comments
 (0)