Skip to content

Commit 8b8b859

Browse files
committed
Create both the standalone and extension sql scripts from the same .in
1 parent fd2d231 commit 8b8b859

File tree

4 files changed

+13
-236
lines changed

4 files changed

+13
-236
lines changed

lib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/.deps/
22
/pg_reorg.sql
3+
/pg_reorg--1.0.sql

lib/Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ OBJS = reorg.o pgut/pgut-be.o pgut/pgut-spi.o
1010
EXTENSION = pg_reorg
1111

1212
#supports both EXTENSION (for >=9.1) and without_EXTENSION (for <PG 9.1)
13-
DATA_built = pg_reorg.sql
14-
DATA = pg_reorg--1.0.sql pg_reorg--unpackaged--1.0.sql uninstall_pg_reorg.sql
15-
13+
DATA_built = pg_reorg.sql pg_reorg--1.0.sql
14+
DATA = pg_reorg--unpackaged--1.0.sql uninstall_pg_reorg.sql
1615
ifndef USE_PGXS
1716
top_builddir = ../../..
1817
makefile_global = $(top_builddir)/src/Makefile.global
@@ -34,3 +33,13 @@ endif
3433
# remove dependency to libxml2 and libxslt
3534
LIBS := $(filter-out -lxml2, $(LIBS))
3635
LIBS := $(filter-out -lxslt, $(LIBS))
36+
37+
pg_reorg.sql: pg_reorg.sql.in
38+
echo "BEGIN;\n" > $@; \
39+
echo "CREATE SCHEMA reorg;\n" >> $@; \
40+
sed 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' $< >> $@; \
41+
echo "\nCOMMIT;" >> $@;
42+
43+
pg_reorg--1.0.sql: pg_reorg.sql.in
44+
echo '\echo Use "CREATE EXTENSION pg_reorg" to load this file. \quit' > $@; \
45+
cat $< >> $@;

lib/pg_reorg--1.0.sql

Lines changed: 0 additions & 224 deletions
This file was deleted.

lib/pg_reorg.sql.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
* Portions Copyright (c) 2011, Itagaki Takahiro
66
*/
77

8-
-- Adjust this setting to control where the objects get created.
9-
SET search_path = public;
10-
11-
BEGIN;
12-
13-
CREATE SCHEMA reorg;
14-
158
CREATE FUNCTION reorg.version() RETURNS text AS
169
'MODULE_PATHNAME', 'reorg_version'
1710
LANGUAGE C IMMUTABLE STRICT;
@@ -241,5 +234,3 @@ LANGUAGE C VOLATILE STRICT;
241234
CREATE FUNCTION reorg.reorg_drop(oid) RETURNS void AS
242235
'MODULE_PATHNAME', 'reorg_drop'
243236
LANGUAGE C VOLATILE STRICT;
244-
245-
COMMIT;

0 commit comments

Comments
 (0)