Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Package for 9.1 and 9.2 as a proper extension.

This extensions used to be packaged primarily as an old-style extension and
is now primarily packaged as a new-style extension, with full support for
CREATE EXTENSION and ALTER EXTENSION UPDATE.

As a result, update debian packaging and documentation.
  • Loading branch information...
commit b289d0f44bb62968da4c2ad9645e7c516aa2519d 1 parent 6d09c67
@dimitri authored
View
53 Makefile
@@ -2,16 +2,10 @@ PKGNAME = prefix
PKGVERS = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
EXTVERS = $(shell awk -F "[= ']" '/default_version/ {print $$5}' prefix.control)
-DEBDIR = /tmp/$(PKGNAME)
-EXPORT = $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS)
-ORIG = $(DEBDIR)/export/$(PKGNAME)_$(PKGVERS).orig.tar.gz
-ARCHIVE= $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS).tar.gz
-DEBEXTS= {gz,changes,build,dsc}
-
EXTENSION = prefix
MODULES = prefix
-DATA = prefix--1.2.0.sql
-DOCS = $(wildcard *.txt)
+DATA = prefix--1.2.0.sql prefix--1.1.sql prefix--1.1--1.2.0.sql
+DOCS = $(wildcard *.md)
# support for 8.1 which didn't expose PG_VERSION_NUM -- another trick from ip4r
PREFIX_PGVER = $(shell echo $(VERSION) | awk -F. '{ print $$1*100+$$2 }')
@@ -21,41 +15,8 @@ PG_CONFIG ?= pg_config
PGXS = $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
-.PHONY: html site deb
-
-html: ${DOCS:.txt=.html}
-
-%.html:%.txt
- asciidoc -a toc $<
-
-site: html
- scp ${DOCS:.txt=.html} cvs.pgfoundry.org:/home/pgfoundry.org/groups/prefix/htdocs
-
-deb:
- # working copy from where to make the .orig archive
- rm -rf $(DEBDIR)
- mkdir -p $(DEBDIR)/$(PKGNAME)-$(PKGVERS)
- mkdir -p $(EXPORT)
- rsync -Ca . $(EXPORT)
-
- # get rid of temp and build files
- for n in ".#*" "*~" "build-stamp" "configure-stamp" "prefix.so"; do \
- find $(EXPORT) -name "$$n" -print0|xargs -0 rm -f; \
- done
-
- # prepare the .orig without the debian/ packaging stuff
- rsync -Ca $(EXPORT) $(DEBDIR)
- rm -rf $(DEBDIR)/$(PKGNAME)-$(PKGVERS)/debian
- (cd $(DEBDIR) && tar czf $(ORIG) $(PKGNAME)-$(PKGVERS))
-
- # have a copy of the $$ORIG file named $$ARCHIVE for non-debian packagers
- cp $(ORIG) $(ARCHIVE)
-
- # build the debian package and copy them to ..
- (cd $(EXPORT) && touch debian/control.in && debuild)
-
- cp $(EXPORT)/debian/control debian
- cp -a $(DEBDIR)/export/*.deb ..
- find $(DEBDIR)/export -name "*.$(DEBEXTS)" -print0| xargs -0 -I% cp -a % ..
- cp -a $(ARCHIVE) ..
- cp -a $(ORIG) ..
+deb: clean
+ make -f debian/rules debian/control
+ dh clean
+ make -f debian/rules orig
+ debuild -us -uc -sa
View
24 README.md
@@ -21,6 +21,14 @@ will try to match a phone number to the longest prefix in the table:
## Installation
+### debian and ubuntu packages
+
+ apt-get install postgresql-9.2-prefix
+ psql ...
+ =# create extension prefix;
+
+### from sources
+
Check `$PATH`, then
make
@@ -28,10 +36,18 @@ Check `$PATH`, then
psql <connection string> -c 'CREATE EXTENSION prefix;'
The `make install` step might have to be done as `root`, and the psql one
-has to be done as a PostgreSQL *superuser*. If you're running a very old
-PostgreSQL version such as `8.3`, `8.4` of `9.0` you can still install this
-extension by manually running the `prefix.sql` file from your `psql`
-console (either using `-f` or `\i`).
+has to be done as a PostgreSQL *superuser*.
+
+### before 9.1 (consider an upgrade)
+
+If you're running a very old PostgreSQL version such as `8.3`, `8.4` of
+`9.0` you can still install this extension manually:
+
+ psql ...
+ =# \i /usr/share/postgresql/X.Y/extension/prefix--1.2.0.sql
+
+You still have to edit this example to replace X.Y with your local
+PostgreSQL version number, such as `8.4`.
## Uninstall
View
8 debian/changelog
@@ -1,3 +1,11 @@
+prefix (1.2.0-1) unstable; urgency=low
+
+ * Fix GiST consisten function in non-leaf nodes (Closes: #690160)
+ * Refactors as a real PostgreSQL Extension
+ * Add explicit compatibility with PostgreSQL 9.2 and 9.3devel
+
+ -- Dimitri Fontaine <dim@tapoueh.org> Mon, 15 Oct 2012 11:52:44 +0200
+
prefix (1.1.1-1) unstable; urgency=low
* Test against 9.0 and 9.1
View
2  debian/control.in
@@ -2,7 +2,7 @@ Source: prefix
Section: database
Priority: extra
Maintainer: Dimitri Fontaine <dim@tapoueh.org>
-Build-Depends: debhelper (>= 7), postgresql-server-dev-all
+Build-Depends: debhelper (>= 7.0.50~), postgresql-server-dev-all
Standards-Version: 3.9.2
Package: postgresql-PGVERSION-prefix
View
4 debian/pgversions
@@ -3,4 +3,6 @@
8.3
8.4
9.0
-9.1
+9.1
+9.2
+9.3
View
3  debian/postgresql-8.3-prefix.docs
@@ -1 +1,2 @@
-README.txt
+README.md
+TESTS.md
View
2  debian/postgresql-8.3-prefix.install
@@ -1,2 +1,2 @@
debian/prefix-8.3/prefix.so usr/lib/postgresql/8.3/lib
-prefix.sql usr/share/postgresql/8.3/contrib
+prefix--1.2.0.sql usr/share/postgresql/8.3/contrib
View
3  debian/postgresql-8.4-prefix.docs
@@ -1 +1,2 @@
-README.txt
+README.md
+TESTS.md
View
2  debian/postgresql-8.4-prefix.install
@@ -1,2 +1,2 @@
debian/prefix-8.4/prefix.so usr/lib/postgresql/8.4/lib
-prefix.sql usr/share/postgresql/8.4/contrib
+prefix--1.2.0.sql usr/share/postgresql/8.4/contrib
View
3  debian/postgresql-9.0-prefix.docs
@@ -1 +1,2 @@
-README.txt
+README.md
+TESTS.md
View
2  debian/postgresql-9.0-prefix.install
@@ -1,2 +1,2 @@
debian/prefix-9.0/prefix.so usr/lib/postgresql/9.0/lib
-prefix.sql usr/share/postgresql/9.0/contrib
+prefix--1.2.0.sql usr/share/postgresql/9.0/contrib
View
3  debian/postgresql-9.1-prefix.docs
@@ -1 +1,2 @@
-README.txt
+README.md
+TESTS.md
View
5 debian/postgresql-9.1-prefix.install
@@ -1,4 +1,7 @@
debian/prefix-9.1/prefix.so usr/lib/postgresql/9.1/lib
prefix.control usr/share/postgresql/9.1/extension
-prefix.sql usr/share/postgresql/9.1/extension
+prefix--1.1.sql usr/share/postgresql/9.1/extension
+prefix--1.2.0.sql usr/share/postgresql/9.1/extension
+prefix--1.1--1.2.0.sql usr/share/postgresql/9.1/extension
prefix--unpackaged--1.1.sql usr/share/postgresql/9.1/extension
+prefix--unpackaged--1.2.0.sql usr/share/postgresql/9.1/extension
View
1  debian/postgresql-9.1-prefix.links
@@ -1 +0,0 @@
-usr/share/postgresql/9.1/extension/prefix.sql usr/share/postgresql/9.1/extension/prefix--1.1.sql
View
2  debian/postgresql-9.2-prefix.docs
@@ -0,0 +1,2 @@
+README.md
+TESTS.md
View
7 debian/postgresql-9.2-prefix.install
@@ -0,0 +1,7 @@
+debian/prefix-9.2/prefix.so usr/lib/postgresql/9.2/lib
+prefix.control usr/share/postgresql/9.2/extension
+prefix--1.1.sql usr/share/postgresql/9.2/extension
+prefix--1.2.0.sql usr/share/postgresql/9.2/extension
+prefix--1.1--1.2.0.sql usr/share/postgresql/9.2/extension
+prefix--unpackaged--1.1.sql usr/share/postgresql/9.2/extension
+prefix--unpackaged--1.2.0.sql usr/share/postgresql/9.2/extension
View
10 prefix--1.1--1.2.0.sql
@@ -0,0 +1,10 @@
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "ALTER EXTENSION prefix UPDATE TO '1.2.0'" to load this file. \quit
+
+-- version 1.2.0 adds restrict and join properties to the operator <@
+-- (prefix_range, prefix_range), but don't automatically update that here:
+--
+-- due to dependencies, that would mean dropping all your prefix_range
+-- columns and having to install the extension all over again. please
+-- consider doing so yourself if you need it.
+
View
66 prefix.sql → prefix--1.1.sql
@@ -4,22 +4,22 @@
CREATE OR REPLACE FUNCTION prefix_range_in(cstring)
RETURNS prefix_range
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_out(prefix_range)
RETURNS cstring
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_recv(internal)
RETURNS prefix_range
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_send(prefix_range)
RETURNS bytea
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE TYPE prefix_range (
INPUT = prefix_range_in,
@@ -32,17 +32,17 @@ COMMENT ON TYPE prefix_range IS 'prefix range: (prefix)?([a-b])?';
CREATE OR REPLACE FUNCTION prefix_range(text, text, text)
RETURNS prefix_range
AS '$libdir/prefix', 'prefix_range_init'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range(text)
RETURNS prefix_range
AS '$libdir/prefix', 'prefix_range_cast_from_text'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION text(prefix_range)
RETURNS text
AS '$libdir/prefix', 'prefix_range_cast_to_text'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE CAST (text as prefix_range) WITH FUNCTION prefix_range(text) AS IMPLICIT;
CREATE CAST (prefix_range as text) WITH FUNCTION text(prefix_range);
@@ -51,77 +51,77 @@ CREATE CAST (prefix_range as text) WITH FUNCTION text(prefix_range);
CREATE OR REPLACE FUNCTION prefix_range_eq(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_neq(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_lt(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_le(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_gt(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_ge(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_cmp(prefix_range, prefix_range)
RETURNS integer
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_overlaps(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contains(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contains_strict(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contained_by(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contained_by_strict(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_union(prefix_range, prefix_range)
RETURNS prefix_range
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_inter(prefix_range, prefix_range)
RETURNS prefix_range
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION length(prefix_range)
RETURNS int
AS '$libdir/prefix', 'prefix_range_length'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OPERATOR = (
LEFTARG = prefix_range,
@@ -250,57 +250,57 @@ AS
CREATE OR REPLACE FUNCTION gpr_consistent(internal, prefix_range, smallint, oid)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_consistent(internal, prefix_range, smallint, oid, internal)
RETURNS bool
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_compress(internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_decompress(internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_penalty(internal, internal, internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' STRICT;
+LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION pr_penalty(prefix_range, prefix_range)
RETURNS float4
AS '$libdir/prefix'
-LANGUAGE 'C' STRICT;
+LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION gpr_picksplit(internal, internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_picksplit_presort(internal, internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_picksplit_jordan(internal, internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_union(internal, internal)
RETURNS text
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_same(prefix_range, prefix_range, internal)
RETURNS internal
AS '$libdir/prefix'
-LANGUAGE 'C' IMMUTABLE STRICT;
+LANGUAGE C IMMUTABLE STRICT;
CREATE OPERATOR CLASS gist_prefix_range_ops
View
5 prefix--1.2.0.sql
@@ -1,6 +1,7 @@
---
--- prefix_range datatype installation
---
+
CREATE OR REPLACE FUNCTION prefix_range_in(cstring)
RETURNS prefix_range
AS '$libdir/prefix'
@@ -227,7 +228,9 @@ CREATE OPERATOR <@ (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_contained_by,
- COMMUTATOR = '@>'
+ COMMUTATOR = '@>',
+ RESTRICT = contsel,
+ JOIN = contjoinsel
);
COMMENT ON OPERATOR <@(prefix_range, prefix_range) IS 'contained by?';
View
48 prefix--unpackaged--1.2.0.sql
@@ -0,0 +1,48 @@
+ alter extension prefix add cast(prefix_range as text);
+ alter extension prefix add cast(text as prefix_range);
+ alter extension prefix add function gpr_compress(internal);
+ alter extension prefix add function gpr_consistent(internal,prefix_range,smallint,oid);
+ alter extension prefix add function gpr_consistent(internal,prefix_range,smallint,oid,internal);
+ alter extension prefix add function gpr_decompress(internal);
+ alter extension prefix add function gpr_penalty(internal,internal,internal);
+ alter extension prefix add function gpr_picksplit(internal,internal);
+ alter extension prefix add function gpr_picksplit_jordan(internal,internal);
+ alter extension prefix add function gpr_picksplit_presort(internal,internal);
+ alter extension prefix add function gpr_same(prefix_range,prefix_range,internal);
+ alter extension prefix add function gpr_union(internal,internal);
+ alter extension prefix add function length(prefix_range);
+ alter extension prefix add function prefix_range_cmp(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_contained_by(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_contained_by_strict(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_contains(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_contains_strict(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_eq(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_ge(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_gt(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_in(cstring);
+ alter extension prefix add function prefix_range_inter(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_le(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_lt(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_neq(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_out(prefix_range);
+ alter extension prefix add function prefix_range_overlaps(prefix_range,prefix_range);
+ alter extension prefix add function prefix_range_recv(internal);
+ alter extension prefix add function prefix_range_send(prefix_range);
+ alter extension prefix add function prefix_range(text);
+ alter extension prefix add function prefix_range(text,text,text);
+ alter extension prefix add function prefix_range_union(prefix_range,prefix_range);
+ alter extension prefix add function pr_penalty(prefix_range,prefix_range);
+ alter extension prefix add function text(prefix_range);
+ alter extension prefix add operator class btree_prefix_range_ops using btree;
+ alter extension prefix add operator class gist_prefix_range_ops using gist;
+ alter extension prefix add operator family btree_prefix_range_ops using btree;
+ alter extension prefix add operator family gist_prefix_range_ops using gist;
+ alter extension prefix add operator <=(prefix_range,prefix_range);
+ alter extension prefix add operator <(prefix_range,prefix_range);
+ alter extension prefix add operator =(prefix_range,prefix_range);
+ alter extension prefix add operator |(prefix_range,prefix_range);
+ alter extension prefix add operator @>(prefix_range,prefix_range);
+ alter extension prefix add operator <@(prefix_range,prefix_range);
+ alter extension prefix add operator &(prefix_range,prefix_range);
+ alter extension prefix add operator &&(prefix_range,prefix_range);
+ alter extension prefix add type prefix_range;
Please sign in to comment.
Something went wrong with that request. Please try again.