From 805e530ccccae7f7895d907c62f92c73caa56e59 Mon Sep 17 00:00:00 2001 From: Jonathan Dance Date: Mon, 22 Jan 2024 16:32:51 -0600 Subject: [PATCH] rename to pg_stringtheory --- .github/workflows/build_and_test.yml | 14 ++++----- Makefile | 8 ++--- README.md | 12 ++++---- expected/equality.out | 19 ++++++------ expected/strstr.out | 29 +++++++++---------- sql/equality.sql | 14 +++++---- sql/strstr.sql | 20 ++++++++----- ...itas--1.0.0.sql => stringtheory--1.0.0.sql | 6 ++-- aequitas.control => stringtheory.control | 2 +- 9 files changed, 66 insertions(+), 58 deletions(-) rename aequitas--1.0.0.sql => stringtheory--1.0.0.sql (52%) rename aequitas.control => stringtheory.control (71%) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1b68e3b..488d37f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,4 +1,4 @@ -name: Aequitas Build and Test +name: pg_stringtheory Build and Test on: push: pull_request: @@ -12,7 +12,7 @@ jobs: steps: - name: Test details - run: echo Build and test Aequitas on ${{ matrix.os }} with PostgreSQL ${{ matrix.version }} branch + run: echo Build and test pg_stringtheory on ${{ matrix.os }} with PostgreSQL ${{ matrix.version }} branch - name: Checkout and build PostgreSQL code run: | @@ -34,16 +34,16 @@ jobs: ./pg_ctl -D data -l logfile start popd - - name: Checkout aequitas extension code + - name: Checkout pg_stringtheory extension code uses: actions/checkout@v4 with: - path: aequitas + path: stringtheory - - name: Build and test aequitas extension + - name: Build and test pg_stringtheory extension id: regression-tests run: | export PATH="${PWD}/postgres/inst/bin:$PATH" - pushd aequitas + pushd stringtheory make install make installcheck popd @@ -51,4 +51,4 @@ jobs: - name: Print regression.diffs if regression tests failed if: failure() && steps.regression-tests.outcome != 'success' run: | - cat aequitas/regression.diffs + cat stringtheory/regression.diffs diff --git a/Makefile b/Makefile index ece7dd1..1458810 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SRCS = src/text.cpp OBJS = $(subst .cpp,.o, $(SRCS)) -MODULE_big = aequitas +MODULE_big = stringtheory PG_CPPFLAGS = -O3 -std=c++17 -I src/sse @@ -19,9 +19,9 @@ ifeq ($(UNAME_S),x86_64) PG_CPPFLAGS += -msse4.2 endif -EXTENSION = aequitas -DATA = aequitas--1.0.0.sql -PGFILEDESC = "Aequitas - tools for testing equality" +EXTENSION = stringtheory +DATA = stringtheory--1.0.0.sql +PGFILEDESC = "stringtheory - tools for testing equality" PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) diff --git a/README.md b/README.md index 89278fb..d1692ff 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# Aequitas - Text Comparison for PostgreSQL +# pg_stringtheory - Text Comparison for PostgreSQL -Aequitas is an extension for PostgreSQL that provides string comparisons using SSE4.2 on x86_64 platforms, and SWAR64 on aarch64 and arm64 platforms. +pg_stringtheory is an extension for PostgreSQL that provides string comparisons using SSE4.2 on x86_64 platforms, and SWAR64 on aarch64 and arm64 platforms. ## Usage After installation: ```sql -CREATE EXTENSION aequitas; +CREATE EXTENSION stringtheory; ``` -This will create a `schema` called aequitas that contains the comparison functions: +This will create a schema called `stringtheory` that contains the comparison functions: -`aequitas.equals(a TEXT, b TEXT)` - returns `BOOLEAN`, `true` if there is an exact match, and `false` if there is not. +`stringtheory.equals(a TEXT, b TEXT)` - returns `BOOLEAN`, `true` if there is an exact match, and `false` if there is not. -`aequitas.strstr(haystack TEXT, needle TEXT)` - returns `INTEGER`, the position of where the needle is found in the haystack, or `-1` if it is not found. +`stringtheory.strstr(haystack TEXT, needle TEXT)` - returns `INTEGER`, the position of where the needle is found in the haystack, or `-1` if it is not found. diff --git a/expected/equality.out b/expected/equality.out index 4e85ac0..8e51018 100644 --- a/expected/equality.out +++ b/expected/equality.out @@ -1,29 +1,28 @@ -CREATE EXTENSION aequitas; +CREATE EXTENSION stringtheory; -- no match -SELECT aequitas.equals('hello', 'world'); - equals +SELECT stringtheory.equals('hello', 'world'); + equals -------- f (1 row) -- match -SELECT aequitas.equals('hello', 'hello'); - equals +SELECT stringtheory.equals('hello', 'hello'); + equals -------- t (1 row) -- match on a 16 byte boundary -SELECT aequitas.equals('1234567890123456', '1234567890123456'); - equals +SELECT stringtheory.equals('1234567890123456', '1234567890123456'); + equals -------- t (1 row) -- no match when partial -SELECT aequitas.equals('123456', '12345'); - equals +SELECT stringtheory.equals('123456', '12345'); + equals -------- f (1 row) - diff --git a/expected/strstr.out b/expected/strstr.out index f049f9a..ab2ac35 100644 --- a/expected/strstr.out +++ b/expected/strstr.out @@ -1,44 +1,43 @@ -CREATE EXTENSION aequitas; -ERROR: extension "aequitas" already exists +CREATE EXTENSION stringtheory; +ERROR: extension "stringtheory" already exists -- no match -SELECT aequitas.strstr('hello', 'world'); - strstr +SELECT stringtheory.strstr('hello', 'world'); + strstr -------- -1 (1 row) -- match with 0 -SELECT aequitas.strstr('hello', 'hello'); - strstr +SELECT stringtheory.strstr('hello', 'hello'); + strstr -------- 0 (1 row) -- match on a 16 byte boundary -SELECT aequitas.strstr('1234567890123456', '1234567890123456'); - strstr +SELECT stringtheory.strstr('1234567890123456', '1234567890123456'); + strstr -------- 0 (1 row) -- match when partial -SELECT aequitas.strstr('123456', '12345'); - strstr +SELECT stringtheory.strstr('123456', '12345'); + strstr -------- 0 (1 row) -- needle found in haystack -SELECT aequitas.strstr('hello world', 'ello'); - strstr +SELECT stringtheory.strstr('hello world', 'ello'); + strstr -------- 1 (1 row) -- haystack in needle not found -SELECT aequitas.strstr('ello', 'hello world'); - strstr +SELECT stringtheory.strstr('ello', 'hello world'); + strstr -------- -1 (1 row) - diff --git a/sql/equality.sql b/sql/equality.sql index 8f26647..42a0be7 100644 --- a/sql/equality.sql +++ b/sql/equality.sql @@ -1,13 +1,17 @@ -CREATE EXTENSION aequitas; +CREATE EXTENSION stringtheory; -- no match -SELECT aequitas.equals('hello', 'world'); +SELECT + stringtheory.equals('hello', 'world'); -- match -SELECT aequitas.equals('hello', 'hello'); +SELECT + stringtheory.equals('hello', 'hello'); -- match on a 16 byte boundary -SELECT aequitas.equals('1234567890123456', '1234567890123456'); +SELECT + stringtheory.equals('1234567890123456', '1234567890123456'); -- no match when partial -SELECT aequitas.equals('123456', '12345'); +SELECT + stringtheory.equals('123456', '12345'); diff --git a/sql/strstr.sql b/sql/strstr.sql index 5a0a1b1..aaebc26 100644 --- a/sql/strstr.sql +++ b/sql/strstr.sql @@ -1,19 +1,25 @@ -CREATE EXTENSION aequitas; +CREATE EXTENSION stringtheory; -- no match -SELECT aequitas.strstr('hello', 'world'); +SELECT + stringtheory.strstr('hello', 'world'); -- match with 0 -SELECT aequitas.strstr('hello', 'hello'); +SELECT + stringtheory.strstr('hello', 'hello'); -- match on a 16 byte boundary -SELECT aequitas.strstr('1234567890123456', '1234567890123456'); +SELECT + stringtheory.strstr('1234567890123456', '1234567890123456'); -- match when partial -SELECT aequitas.strstr('123456', '12345'); +SELECT + stringtheory.strstr('123456', '12345'); -- needle found in haystack -SELECT aequitas.strstr('hello world', 'ello'); +SELECT + stringtheory.strstr('hello world', 'ello'); -- haystack in needle not found -SELECT aequitas.strstr('ello', 'hello world'); +SELECT + stringtheory.strstr('ello', 'hello world'); diff --git a/aequitas--1.0.0.sql b/stringtheory--1.0.0.sql similarity index 52% rename from aequitas--1.0.0.sql rename to stringtheory--1.0.0.sql index 69d6c65..ddb7344 100644 --- a/aequitas--1.0.0.sql +++ b/stringtheory--1.0.0.sql @@ -1,11 +1,11 @@ -CREATE SCHEMA IF NOT EXISTS aequitas; +CREATE SCHEMA IF NOT EXISTS stringtheory; -CREATE OR REPLACE FUNCTION aequitas.strstr(left TEXT, right TEXT) +CREATE OR REPLACE FUNCTION stringtheory.strstr(left TEXT, right TEXT) RETURNS INTEGER AS 'MODULE_PATHNAME', 'pg_strstr' LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; -CREATE OR REPLACE FUNCTION aequitas.equals(left TEXT, right TEXT) +CREATE OR REPLACE FUNCTION stringtheory.equals(left TEXT, right TEXT) RETURNS BOOLEAN AS 'MODULE_PATHNAME', 'pg_equals' LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; diff --git a/aequitas.control b/stringtheory.control similarity index 71% rename from aequitas.control rename to stringtheory.control index dded13d..a7e2ad5 100644 --- a/aequitas.control +++ b/stringtheory.control @@ -1,5 +1,5 @@ # compare extension comment = 'tools for comparing strings' default_version = '1.0.0' -module_pathname = '$libdir/aequitas' +module_pathname = '$libdir/stringtheory' relocatable = true