From f229b2e1bbbb89bc742561c1c6bf8380e8aa1698 Mon Sep 17 00:00:00 2001
From: Christoph Berg <myon@debian.org>
Date: Wed, 22 Nov 2023 05:55:14 +0100
Subject: [PATCH 1/3] spherepoint_hash32: float8 needs wrapping into a Datum
 (#107)

---
 src/point.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/point.c b/src/point.c
index f4df15c..26ae5f5 100644
--- a/src/point.c
+++ b/src/point.c
@@ -315,8 +315,8 @@ Datum
 spherepoint_hash32(PG_FUNCTION_ARGS)
 {
 	SPoint	   *p1 = (SPoint *) PG_GETARG_POINTER(0);
-	Datum		h1 = DirectFunctionCall1(hashfloat8, p1->lat);
-	Datum		h2 = DirectFunctionCall1(hashfloat8, p1->lng);
+	Datum		h1 = DirectFunctionCall1(hashfloat8, Float8GetDatum(p1->lat));
+	Datum		h2 = DirectFunctionCall1(hashfloat8, Float8GetDatum(p1->lng));
 
 	PG_RETURN_INT32(DatumGetInt32(h1) ^ DatumGetInt32(h2));
 }

From 902ba8da469da799dd18ca3b68b8915bd4d381b5 Mon Sep 17 00:00:00 2001
From: Vitaly Davydov <vitprof@gmail.com>
Date: Wed, 22 Nov 2023 08:17:39 +0300
Subject: [PATCH 2/3] Add version.sql test

Current version check was moved from init.sql into version.sql because
init.sql it is not executed with the 'test' target.
---
 Makefile             | 2 +-
 expected/init.out    | 9 +--------
 expected/version.out | 7 +++++++
 sql/init.sql         | 5 +----
 sql/version.sql      | 3 +++
 5 files changed, 13 insertions(+), 13 deletions(-)
 create mode 100644 expected/version.out
 create mode 100644 sql/version.sql

diff --git a/Makefile b/Makefile
index 5b1c4e2..249e1c2 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ DATA_built  = $(RELEASE_SQL) \
 			  pg_sphere--1.3.1--1.4.0.sql
 
 DOCS        = README.pg_sphere COPYRIGHT.pg_sphere
-TESTS       = tables points euler circle line ellipse poly path box \
+TESTS       = version tables points euler circle line ellipse poly path box \
               index contains_ops contains_ops_compat bounding_box_gist gnomo \
               epochprop contains overlaps spoint_brin sbox_brin selectivity
 REGRESS     = init $(TESTS)
diff --git a/expected/init.out b/expected/init.out
index e4dcdfd..374e2a3 100644
--- a/expected/init.out
+++ b/expected/init.out
@@ -1,11 +1,4 @@
 --
--- first, define the datatype.  Turn off echoing so that expected file
--- does not depend on contents of pg_sphere.sql.
+-- Initialize the extension.
 --
 CREATE EXTENSION pg_sphere;
-select pg_sphere_version();
- pg_sphere_version 
--------------------
- 1.4.0
-(1 row)
-
diff --git a/expected/version.out b/expected/version.out
new file mode 100644
index 0000000..075d008
--- /dev/null
+++ b/expected/version.out
@@ -0,0 +1,7 @@
+-- Check current pgsphere version
+SELECT pg_sphere_version();
+ pg_sphere_version 
+-------------------
+ 1.4.0
+(1 row)
+
diff --git a/sql/init.sql b/sql/init.sql
index 05b3516..374e2a3 100644
--- a/sql/init.sql
+++ b/sql/init.sql
@@ -1,7 +1,4 @@
 --
--- first, define the datatype.  Turn off echoing so that expected file
--- does not depend on contents of pg_sphere.sql.
+-- Initialize the extension.
 --
 CREATE EXTENSION pg_sphere;
-
-select pg_sphere_version();
diff --git a/sql/version.sql b/sql/version.sql
new file mode 100644
index 0000000..89f6266
--- /dev/null
+++ b/sql/version.sql
@@ -0,0 +1,3 @@
+-- Check current pgsphere version
+SELECT pg_sphere_version();
+

From 2cb0c2869e3568ac400cda3af8bb42c246e18676 Mon Sep 17 00:00:00 2001
From: Vitaly Davydov <vitprof@gmail.com>
Date: Wed, 22 Nov 2023 08:22:07 +0300
Subject: [PATCH 3/3] Increment the version number to 1.4.1

---
 Makefile                                       | 6 +++++-
 Makefile.common.mk                             | 2 +-
 expected/version.out                           | 2 +-
 pg_sphere.control                              | 2 +-
 upgrade_scripts/pg_sphere--1.4.0--1.4.1.sql.in | 1 +
 5 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 upgrade_scripts/pg_sphere--1.4.0--1.4.1.sql.in

diff --git a/Makefile b/Makefile
index 249e1c2..88c082b 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,8 @@ DATA_built  = $(RELEASE_SQL) \
 			  pg_sphere--1.2.2--1.2.3.sql \
 			  pg_sphere--1.2.3--1.3.0.sql \
 			  pg_sphere--1.3.0--1.3.1.sql \
-			  pg_sphere--1.3.1--1.4.0.sql
+			  pg_sphere--1.3.1--1.4.0.sql \
+			  pg_sphere--1.4.0--1.4.1.sql \
 
 DOCS        = README.pg_sphere COPYRIGHT.pg_sphere
 TESTS       = version tables points euler circle line ellipse poly path box \
@@ -204,6 +205,9 @@ endif
 pg_sphere--1.3.1--1.4.0.sql: pgs_circle_sel.sql.in pgs_hash.sql.in
 	cat upgrade_scripts/$@.in $^ > $@
 
+pg_sphere--1.4.0--1.4.1.sql:
+	cat upgrade_scripts/$@.in $^ > $@
+
 # end of local stuff
 
 src/sscan.o : src/sparse.c
diff --git a/Makefile.common.mk b/Makefile.common.mk
index aaaf096..42c2376 100644
--- a/Makefile.common.mk
+++ b/Makefile.common.mk
@@ -5,4 +5,4 @@
 #----------------------------------------------------------------------------
 
 EXTENSION        	:= pg_sphere
-PGSPHERE_VERSION 	:= 1.4.0
+PGSPHERE_VERSION 	:= 1.4.1
diff --git a/expected/version.out b/expected/version.out
index 075d008..c05ab96 100644
--- a/expected/version.out
+++ b/expected/version.out
@@ -2,6 +2,6 @@
 SELECT pg_sphere_version();
  pg_sphere_version 
 -------------------
- 1.4.0
+ 1.4.1
 (1 row)
 
diff --git a/pg_sphere.control b/pg_sphere.control
index 41ae5a7..fdf8f98 100644
--- a/pg_sphere.control
+++ b/pg_sphere.control
@@ -1,5 +1,5 @@
 # pg_sphere extension
 comment = 'spherical objects with useful functions, operators and index support'
-default_version = '1.4.0'
+default_version = '1.4.1'
 module_pathname = '$libdir/pg_sphere'
 relocatable = true
diff --git a/upgrade_scripts/pg_sphere--1.4.0--1.4.1.sql.in b/upgrade_scripts/pg_sphere--1.4.0--1.4.1.sql.in
new file mode 100644
index 0000000..8ea3baa
--- /dev/null
+++ b/upgrade_scripts/pg_sphere--1.4.0--1.4.1.sql.in
@@ -0,0 +1 @@
+-- Nothing to upgrade in the schema
