From fa7e8da72c509a1fbaa214e36c60472dba9122a3 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 10 Jun 2026 13:32:17 -0700 Subject: [PATCH 1/4] Stop suncalc.sql from being loaded outside of CREATE EXTENSION --- suncalc/suncalc.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/suncalc/suncalc.sql b/suncalc/suncalc.sql index 338d435..3f123d6 100644 --- a/suncalc/suncalc.sql +++ b/suncalc/suncalc.sql @@ -1,3 +1,5 @@ +\echo Use "CREATE EXTENSION suncalc_postgres" to load this file. \quit + CREATE OR REPLACE FUNCTION sc_fmod( dividend double precision, divisor double precision @@ -336,4 +338,4 @@ BEGIN RETURN NEXT; END LOOP; END ; -$$ LANGUAGE plpgsql IMMUTABLE; \ No newline at end of file +$$ LANGUAGE plpgsql IMMUTABLE; From 20eb38d20b52a278c2d4ac70164af843ec1ebb9c Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 10 Jun 2026 13:34:44 -0700 Subject: [PATCH 2/4] Move SQL to versioned file --- suncalc/suncalc.sql => suncalc_postgres--0.0.1.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename suncalc/suncalc.sql => suncalc_postgres--0.0.1.sql (100%) diff --git a/suncalc/suncalc.sql b/suncalc_postgres--0.0.1.sql similarity index 100% rename from suncalc/suncalc.sql rename to suncalc_postgres--0.0.1.sql From 363c375cc0f5584c7204cbbcebc3c17739af7af0 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 10 Jun 2026 13:37:37 -0700 Subject: [PATCH 3/4] Add suncalc_postgres.control --- suncalc_postgres.control | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 suncalc_postgres.control diff --git a/suncalc_postgres.control b/suncalc_postgres.control new file mode 100644 index 0000000..7de65f3 --- /dev/null +++ b/suncalc_postgres.control @@ -0,0 +1,5 @@ +comment = 'Solar event calculations for Postgres' +default_version = '0.0.1' +module_pathname = '$libdir/suncalc_postgres' +relocatable = true +requires = '' From bc588c0d069e3bf199325cd2378ed995fac30423 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 10 Jun 2026 13:38:07 -0700 Subject: [PATCH 4/4] Add Makefile --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5125f60 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +EXTENSION = suncalc_postgres + +DATA = suncalc_postgres--0.0.1.sql +#TESTS = $(wildcard test/sql/*.sql) + +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS)