From ca2bfbf32725bfa514289dc7577d980d49bbf0e2 Mon Sep 17 00:00:00 2001 From: Andreas Scherbaum Date: Fri, 24 Mar 2023 02:12:14 +0100 Subject: [PATCH 1/6] Enable GitHub Actions upgrade tests (#20) * Add GitHub Action tests for upgrades * Update GitHub Actions workflow --------- Co-authored-by: Andreas Scherbaum --- .github/workflows/test.yml | 193 +++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b1a4338 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,193 @@ +name: Test extension + +# Run this workflow every time a new commit pushed to your repository +on: + push: + branches: ['*'] + #branches-ignore: 'master' + + pull_request: + branches: ['*'] + #branches-ignore: 'master' + + workflow_dispatch: + + +defaults: + run: + shell: bash + + +jobs: + pr-test: + name: Test the extension + runs-on: ${{ matrix.os }} + env: + EXTENSION_NAME: hashtypes + EXTENSION_DB: ajtest + EXTENSION_BRANCH: master + EXTENSION_SUBDIRECTORY: "" + EXTENSION_TEST_QUERY: "" + strategy: + matrix: + # also test 'latest', eventually this will be upgraded to a newer version and might fail early + #os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest] + os: [ubuntu-latest] + #postgresql: [9.6, 10, 11, 12, 13, 14, 15] + postgresql: [12, 14, 15] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Versions + run: echo "${{ matrix.os }} - ${{ matrix.postgresql }}" + + - name: Calculate working directory + run: echo "PWD=$(realpath ./$EXTENSION_SUBDIRECTORY)" >> $GITHUB_OUTPUT + id: pwd + + - name: Working directory + run: echo "${{ steps.pwd.outputs.PWD }}" + + + # GitHub does only checkout the current branch + # in case this is a PR the check also needs $EXTENSION_BRANCH for the .control file + - name: get branch + run: git fetch --depth=5 origin $EXTENSION_BRANCH + + - name: See the .control file + run: git show origin/$EXTENSION_BRANCH:$EXTENSION_SUBDIRECTORY$EXTENSION_NAME.control + + + # there might be PostgreSQL packages pre-installed, remove them + - name: Installed PostgreSQL packages + run: dpkg --list | grep postgresql + + - name: Get list of PostgreSQL packages + run: echo "Packages=$(dpkg-query -f '${Package}\n' -W | grep ^postgresql | xargs)" >> $GITHUB_OUTPUT + id: preinstalled_packages + + - name: Remove preinstalled PostgreSQL packages + run: sudo dpkg --purge ${{ steps.preinstalled_packages.outputs.Packages }} + + + # verify result + - name: Installed PostgreSQL packages + run: dpkg --list | grep postgresql + continue-on-error: true + + + # install build tools + - name: Install build-essential and other tools + run: sudo apt-get install -y build-essential ruby curl ca-certificates gnupg + + + # enable PostgreSQL APT repository + - name: Install GPG Key for PostgreSQL repository + run: curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + + - name: Install repository + run: sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + + - name: Update repository + run: sudo apt-get update + + # install the requested version + - name: Install PostgreSQL + run: sudo apt-get install -y postgresql-${{ matrix.postgresql }} postgresql-server-dev-${{ matrix.postgresql }} postgresql-client-${{ matrix.postgresql }} + + # debug output + - name: Path of pg_config + run: which pg_config + + - name: pg_config output + run: pg_config + + - name: Update pg_hba.conf + run: sudo bash -c "echo 'local all all trust' > /etc/postgresql/${{ matrix.postgresql }}/main/pg_hba.conf" + + - name: Update pg_hba.conf + run: sudo bash -c "echo 'host all all 0/0 trust' >> /etc/postgresql/${{ matrix.postgresql }}/main/pg_hba.conf" + + - name: Restart PostgreSQL + run: sudo service postgresql reload + + + # do the actual compilation + - name: Compile the extension + run: cd ${{ steps.pwd.outputs.PWD }} && make + + - name: Test the extension + run: cd ${{ steps.pwd.outputs.PWD }} && make check + + # install extension + - name: Install the extension + run: cd ${{ steps.pwd.outputs.PWD }} && sudo make install + + - name: Test the extension + run: cd ${{ steps.pwd.outputs.PWD }} && make PGUSER=postgres installcheck + + + # start testing + + - name: Get current branch name + run: echo "Packages=$(git branch --show-current)" >> $GITHUB_OUTPUT + id: current_branch + + # in a PR this version might be different + - name: Get current extension version + run: echo "Version=$(cat $EXTENSION_SUBDIRECTORY$EXTENSION_NAME.control | grep default_version | sed 's/[^0-9\.]*//g')" >> $GITHUB_OUTPUT + id: current_extension_version + + # the version from the branch in $EXTENSION_BRANCH + - name: Get installed extension version + run: echo "Version=$(git show origin/$EXTENSION_BRANCH:$EXTENSION_SUBDIRECTORY$EXTENSION_NAME.control | grep default_version | sed 's/[^0-9\.]*//g')" >> $GITHUB_OUTPUT + id: installed_extension_version + + - name: Show versions + run: echo "${{ steps.installed_extension_version.outputs.Version }} - ${{ steps.current_extension_version.outputs.Version }}" + + - name: Test current version string + run: exit 1 + if: steps.current_extension_version.outputs.Version == '' + + - name: Test installed version string + run: exit 1 + if: steps.installed_extension_version.outputs.Version == '' + + - name: Create test database + run: createdb -U postgres $EXTENSION_DB + + # install the version from $EXTENSION_BRANCH + - name: Install extension in database + run: psql -U postgres -c "CREATE EXTENSION $EXTENSION_NAME VERSION '${{ steps.installed_extension_version.outputs.Version }}'" $EXTENSION_DB + + - name: Get extension version installed in the database - Step 1 + run: psql -U postgres -A -q -t -o /tmp/installed_version_step_1.txt -c "SELECT extversion FROM pg_catalog.pg_extension WHERE extname='$EXTENSION_NAME'" $EXTENSION_DB + + - name: Get extension version installed in the database - Step 2 + run: echo "Version=$(cat /tmp/installed_version_step_1.txt)" >> $GITHUB_OUTPUT + id: installed_version_step_1 + + - name: Show installed version - after extension install + run: echo "${{ steps.installed_version_step_1.outputs.Version }}" + + # if this is a PR, the version might be different - try an extension upgrade in this case + - name: Upgrade extension in database + run: psql -U postgres -c "ALTER EXTENSION $EXTENSION_NAME UPDATE TO '${{ steps.current_extension_version.outputs.Version }}'" $EXTENSION_DB + if: steps.installed_extension_version.outputs.Version != steps.current_extension_version.outputs.Version + + - name: Get extension version installed in the database - Step 1 + run: psql -U postgres -A -q -t -o /tmp/installed_version_step_2.txt -c "SELECT extversion FROM pg_catalog.pg_extension WHERE extname='$EXTENSION_NAME'" $EXTENSION_DB + + - name: Get extension version installed in the database - Step 2 + run: echo "Version=$(cat /tmp/installed_version_step_2.txt)" >> $GITHUB_OUTPUT + id: installed_version_step_2 + + - name: Show installed version - after extension update + run: echo "${{ steps.installed_version_step_2.outputs.Version }}" + + - name: Run test query + run: psql -U postgres -c "$EXTENSION_TEST_QUERY" $EXTENSION_DB + if: env.EXTENSION_TEST_QUERY != '' From 1c08e29edab2541ab06bd1c990ae68beb417e542 Mon Sep 17 00:00:00 2001 From: Artur Zakirov Date: Fri, 28 Apr 2023 16:31:23 +0200 Subject: [PATCH 2/6] Fix clang warnings and errors (#21) --- .gitignore | 5 ++++- expected/regress_sha.out | 14 ++++++++++++++ sql/regress_sha.sql | 6 ++++++ src/crc32.c | 16 +++++++--------- src/md5.c | 8 ++++---- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index a7cb72e..a384c72 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ sha*.sql.in sha*.sql sha*.c -sql/hashtypes--0.1.2--0.1.3.sql \ No newline at end of file +sql/hashtypes--0.1.2--0.1.3.sql +sql/*.sql.in + +results/ \ No newline at end of file diff --git a/expected/regress_sha.out b/expected/regress_sha.out index 039159f..f150546 100644 --- a/expected/regress_sha.out +++ b/expected/regress_sha.out @@ -70,3 +70,17 @@ SELECT * FROM md5test_after; 5e8862cd73694287ff341e75c95e3c6a (2 rows) +CREATE TABLE crc32test (val crc32); +INSERT INTO crc32test VALUES ('ab1'::crc32), ('ab2'::crc32); +SELECT val FROM crc32test WHERE val <> 'ab2'::crc32; + val +---------- + 00000ab1 +(1 row) + +SELECT val FROM crc32test WHERE val = 'ab2'::crc32; + val +---------- + 00000ab2 +(1 row) + diff --git a/sql/regress_sha.sql b/sql/regress_sha.sql index 5538659..c66816d 100644 --- a/sql/regress_sha.sql +++ b/sql/regress_sha.sql @@ -37,3 +37,9 @@ COPY md5test TO '/tmp/tst' WITH (FORMAT binary); COPY md5test_after FROM '/tmp/tst' WITH (FORMAT binary); SELECT * FROM md5test; SELECT * FROM md5test_after; + +CREATE TABLE crc32test (val crc32); +INSERT INTO crc32test VALUES ('ab1'::crc32), ('ab2'::crc32); + +SELECT val FROM crc32test WHERE val <> 'ab2'::crc32; +SELECT val FROM crc32test WHERE val = 'ab2'::crc32; diff --git a/src/crc32.c b/src/crc32.c index da8cc19..3adac76 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -11,6 +11,8 @@ Datum crc32_in(PG_FUNCTION_ARGS) { char *in = PG_GETARG_CSTRING(0); + char *p; + long int pout; if (strlen(in) > 8) { @@ -19,12 +21,9 @@ crc32_in(PG_FUNCTION_ARGS) errmsg("crc32 value cannot exceed 32 bits"))); } - crc32 *out = palloc(sizeof(crc32)); - - - char *p; errno = 0; - long int pout = strtol(in, &p, 16); + pout = strtol(in, &p, 16); + if (errno != 0 || *p != 0 || p == in) { ereport(ERROR, ( @@ -35,17 +34,16 @@ crc32_in(PG_FUNCTION_ARGS) /* I don't check if pout overflows uint32 because it's restricted by string * length check above. */ - out = (uint32_t)pout; - - PG_RETURN_CRC32(out); + PG_RETURN_CRC32(pout); } PG_FUNCTION_INFO_V1(crc32_out); Datum crc32_out(PG_FUNCTION_ARGS) { - crc32 *in = PG_GETARG_CRC32(0); + crc32 in = PG_GETARG_CRC32(0); char *out = (char *) palloc(10); + snprintf(out, 10, "%08x", in); PG_RETURN_CSTRING(out); } diff --git a/src/md5.c b/src/md5.c index e106cf1..19d97fd 100644 --- a/src/md5.c +++ b/src/md5.c @@ -52,7 +52,7 @@ md5_in(PG_FUNCTION_ARGS) { char *arg = PG_GETARG_CSTRING(0); Md5 *output; - + output = (Md5 *) cstring_to_hexarr(arg, MD5_LENGTH, "MD5"); PG_RETURN_MD5(output); @@ -63,7 +63,7 @@ Datum md5_recv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); - Md5 *result; + Md5 *result; int nbytes; nbytes = buf->len - buf->cursor; @@ -75,7 +75,7 @@ md5_recv(PG_FUNCTION_ARGS) result = palloc(sizeof(Md5)); - pq_copymsgbytes(buf, result->bytes, nbytes); + pq_copymsgbytes(buf, (char *) result->bytes, nbytes); PG_RETURN_MD5(result); } @@ -123,7 +123,7 @@ md5_to_text(PG_FUNCTION_ARGS) cstring = hexarr_to_cstring(value->bytes, MD5_LENGTH); textval = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(cstring))); - + PG_RETURN_TEXT_P(textval); } From 83539376d1c40c4828cca8e1a01ce155e4bc5103 Mon Sep 17 00:00:00 2001 From: Manuel Kniep Date: Wed, 31 May 2023 09:33:06 +0200 Subject: [PATCH 3/6] Align ci workflow (#22) We want an improved aligned workflow setup for all our postgres extensions. This workflow will run tests after pushing commits into the main branch and into any open pull request's branch. It runs tests on PostgreSQL Versions 10 to 15. One important thing here is that the workflow uses pgxn/pgxn-tools Docker image. It installs specified version of PostgreSQL and run tests by pg-build-test, which runs make installcheck under the hood. add ci badge to README.md Let anyone see directly the current build status --------- Co-authored-by: Artur Zakirov --- .github/workflows/ci.yml | 21 ---- .github/workflows/main.yml | 22 ++++ .github/workflows/test.yml | 193 ---------------------------------- Makefile | 2 +- README.hashtypes => README.md | 2 + 5 files changed, 25 insertions(+), 215 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/test.yml rename README.hashtypes => README.md (75%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 3a8ce51..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: CI - -on: - push: - branches: ['*'] - pull_request: - branches: ['*'] - -jobs: - test: - strategy: - fail-fast: false - matrix: - pg: [14, 13, 12, 11, 10, 9.6, 9.5] - name: PostgreSQL ${{ matrix.pg }} - runs-on: ubuntu-latest - container: zilder/pg-ext-check - steps: - - run: pg-setup ${{ matrix.pg }} - - uses: actions/checkout@v2 - - run: build-check diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..aca8b0d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + branches: + - master + - main + pull_request: + +jobs: + test: + strategy: + matrix: + pg: [15, 14, 13, 12, 11, 10] + name: 🐘 PostgreSQL ${{ matrix.pg }} + runs-on: ubuntu-latest + container: pgxn/pgxn-tools + steps: + - run: pg-start ${{ matrix.pg }} + - uses: actions/checkout@v2 + - run: pg-build-test + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index b1a4338..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,193 +0,0 @@ -name: Test extension - -# Run this workflow every time a new commit pushed to your repository -on: - push: - branches: ['*'] - #branches-ignore: 'master' - - pull_request: - branches: ['*'] - #branches-ignore: 'master' - - workflow_dispatch: - - -defaults: - run: - shell: bash - - -jobs: - pr-test: - name: Test the extension - runs-on: ${{ matrix.os }} - env: - EXTENSION_NAME: hashtypes - EXTENSION_DB: ajtest - EXTENSION_BRANCH: master - EXTENSION_SUBDIRECTORY: "" - EXTENSION_TEST_QUERY: "" - strategy: - matrix: - # also test 'latest', eventually this will be upgraded to a newer version and might fail early - #os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest] - os: [ubuntu-latest] - #postgresql: [9.6, 10, 11, 12, 13, 14, 15] - postgresql: [12, 14, 15] - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Versions - run: echo "${{ matrix.os }} - ${{ matrix.postgresql }}" - - - name: Calculate working directory - run: echo "PWD=$(realpath ./$EXTENSION_SUBDIRECTORY)" >> $GITHUB_OUTPUT - id: pwd - - - name: Working directory - run: echo "${{ steps.pwd.outputs.PWD }}" - - - # GitHub does only checkout the current branch - # in case this is a PR the check also needs $EXTENSION_BRANCH for the .control file - - name: get branch - run: git fetch --depth=5 origin $EXTENSION_BRANCH - - - name: See the .control file - run: git show origin/$EXTENSION_BRANCH:$EXTENSION_SUBDIRECTORY$EXTENSION_NAME.control - - - # there might be PostgreSQL packages pre-installed, remove them - - name: Installed PostgreSQL packages - run: dpkg --list | grep postgresql - - - name: Get list of PostgreSQL packages - run: echo "Packages=$(dpkg-query -f '${Package}\n' -W | grep ^postgresql | xargs)" >> $GITHUB_OUTPUT - id: preinstalled_packages - - - name: Remove preinstalled PostgreSQL packages - run: sudo dpkg --purge ${{ steps.preinstalled_packages.outputs.Packages }} - - - # verify result - - name: Installed PostgreSQL packages - run: dpkg --list | grep postgresql - continue-on-error: true - - - # install build tools - - name: Install build-essential and other tools - run: sudo apt-get install -y build-essential ruby curl ca-certificates gnupg - - - # enable PostgreSQL APT repository - - name: Install GPG Key for PostgreSQL repository - run: curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - - - - name: Install repository - run: sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' - - - name: Update repository - run: sudo apt-get update - - # install the requested version - - name: Install PostgreSQL - run: sudo apt-get install -y postgresql-${{ matrix.postgresql }} postgresql-server-dev-${{ matrix.postgresql }} postgresql-client-${{ matrix.postgresql }} - - # debug output - - name: Path of pg_config - run: which pg_config - - - name: pg_config output - run: pg_config - - - name: Update pg_hba.conf - run: sudo bash -c "echo 'local all all trust' > /etc/postgresql/${{ matrix.postgresql }}/main/pg_hba.conf" - - - name: Update pg_hba.conf - run: sudo bash -c "echo 'host all all 0/0 trust' >> /etc/postgresql/${{ matrix.postgresql }}/main/pg_hba.conf" - - - name: Restart PostgreSQL - run: sudo service postgresql reload - - - # do the actual compilation - - name: Compile the extension - run: cd ${{ steps.pwd.outputs.PWD }} && make - - - name: Test the extension - run: cd ${{ steps.pwd.outputs.PWD }} && make check - - # install extension - - name: Install the extension - run: cd ${{ steps.pwd.outputs.PWD }} && sudo make install - - - name: Test the extension - run: cd ${{ steps.pwd.outputs.PWD }} && make PGUSER=postgres installcheck - - - # start testing - - - name: Get current branch name - run: echo "Packages=$(git branch --show-current)" >> $GITHUB_OUTPUT - id: current_branch - - # in a PR this version might be different - - name: Get current extension version - run: echo "Version=$(cat $EXTENSION_SUBDIRECTORY$EXTENSION_NAME.control | grep default_version | sed 's/[^0-9\.]*//g')" >> $GITHUB_OUTPUT - id: current_extension_version - - # the version from the branch in $EXTENSION_BRANCH - - name: Get installed extension version - run: echo "Version=$(git show origin/$EXTENSION_BRANCH:$EXTENSION_SUBDIRECTORY$EXTENSION_NAME.control | grep default_version | sed 's/[^0-9\.]*//g')" >> $GITHUB_OUTPUT - id: installed_extension_version - - - name: Show versions - run: echo "${{ steps.installed_extension_version.outputs.Version }} - ${{ steps.current_extension_version.outputs.Version }}" - - - name: Test current version string - run: exit 1 - if: steps.current_extension_version.outputs.Version == '' - - - name: Test installed version string - run: exit 1 - if: steps.installed_extension_version.outputs.Version == '' - - - name: Create test database - run: createdb -U postgres $EXTENSION_DB - - # install the version from $EXTENSION_BRANCH - - name: Install extension in database - run: psql -U postgres -c "CREATE EXTENSION $EXTENSION_NAME VERSION '${{ steps.installed_extension_version.outputs.Version }}'" $EXTENSION_DB - - - name: Get extension version installed in the database - Step 1 - run: psql -U postgres -A -q -t -o /tmp/installed_version_step_1.txt -c "SELECT extversion FROM pg_catalog.pg_extension WHERE extname='$EXTENSION_NAME'" $EXTENSION_DB - - - name: Get extension version installed in the database - Step 2 - run: echo "Version=$(cat /tmp/installed_version_step_1.txt)" >> $GITHUB_OUTPUT - id: installed_version_step_1 - - - name: Show installed version - after extension install - run: echo "${{ steps.installed_version_step_1.outputs.Version }}" - - # if this is a PR, the version might be different - try an extension upgrade in this case - - name: Upgrade extension in database - run: psql -U postgres -c "ALTER EXTENSION $EXTENSION_NAME UPDATE TO '${{ steps.current_extension_version.outputs.Version }}'" $EXTENSION_DB - if: steps.installed_extension_version.outputs.Version != steps.current_extension_version.outputs.Version - - - name: Get extension version installed in the database - Step 1 - run: psql -U postgres -A -q -t -o /tmp/installed_version_step_2.txt -c "SELECT extversion FROM pg_catalog.pg_extension WHERE extname='$EXTENSION_NAME'" $EXTENSION_DB - - - name: Get extension version installed in the database - Step 2 - run: echo "Version=$(cat /tmp/installed_version_step_2.txt)" >> $GITHUB_OUTPUT - id: installed_version_step_2 - - - name: Show installed version - after extension update - run: echo "${{ steps.installed_version_step_2.outputs.Version }}" - - - name: Run test query - run: psql -U postgres -c "$EXTENSION_TEST_QUERY" $EXTENSION_DB - if: env.EXTENSION_TEST_QUERY != '' diff --git a/Makefile b/Makefile index 8d4f722..e7457ba 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ HASHTYPESVERSION = 0.1.5 EXTENSION = hashtypes -DOCS = README.hashtypes +DOCS = README.md MODULE_big = hashtypes OBJS = src/common.o src/md5.o src/crc32.o $(LN_OBJS) DATA_built = sql/hashtypes--$(HASHTYPESVERSION).sql sql/hashtypes--0.1.2--0.1.3.sql diff --git a/README.hashtypes b/README.md similarity index 75% rename from README.hashtypes rename to README.md index 047cd8f..0f38ce5 100644 --- a/README.hashtypes +++ b/README.md @@ -1,3 +1,5 @@ +[![CI](https://github.com/adjust/hashtypes/actions/workflows/main.yml/badge.svg)](https://github.com/adjust/hashtypes/actions/workflows/main.yml) + This extension is actually a fork of shatypes[1] which adds some other data types as crc32 and provides some fixes to original implementations. From c98489f0e5b56f9e12c12a9c421e98b422b596f5 Mon Sep 17 00:00:00 2001 From: Artur Zakirov Date: Thu, 21 Sep 2023 18:08:32 +0900 Subject: [PATCH 4/6] No need to install README.md as a documentation (#23) --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index e7457ba..1106c1e 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ HASHTYPESVERSION = 0.1.5 EXTENSION = hashtypes -DOCS = README.md MODULE_big = hashtypes OBJS = src/common.o src/md5.o src/crc32.o $(LN_OBJS) DATA_built = sql/hashtypes--$(HASHTYPESVERSION).sql sql/hashtypes--0.1.2--0.1.3.sql From ab58b52a0b99dcf48acddb905636db3b93383194 Mon Sep 17 00:00:00 2001 From: Perik Rigoudy <117086694+PerikAdjust@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:05:11 +0100 Subject: [PATCH 5/6] META.json update with new version for PGXN A new version was released and it was not up to date in the meta json, this also allows you to update the version on PGXN. --- META.json | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/META.json b/META.json index 1367185..4f85aa9 100644 --- a/META.json +++ b/META.json @@ -1,19 +1,32 @@ { "name": "hashtypes", "abstract": "data types for sha{1,256,512}, md5 and crc32", - "version": "0.1.4", - "maintainer": ["Chris Travers ", "Manuel Kniep "], - "license": "postgresql", - "meta-spec": { - "version": "1.0.0", - "url": "http://pgxn.org/meta/spec.txt" - }, + "version": "0.1.5", + "maintainer" : [ + "adjustgmbh" + ], + "license": { + "PostgreSQL": "http://www.postgresql.org/about/licence" + }, "provides": { "hashtypes": { - "file": "sql/hashtypes--0.1.4.sql", - "version": "0.1.4" + "file": "sql/hashtypes--0.1.5.sql", + "version": "0.1.5", + "abstract": "data types for sha{1,256,512}, md5 and crc32" } }, + "meta-spec": { + "version": "1.0.0", + "url": "http://pgxn.org/meta/spec.txt" + }, + "description": "data types for sha{1,256,512}, md5 and crc32", + "prereqs": { + "runtime": { + "requires": { + "PostgreSQL": "10.0.0" + } + } + }, "resources": { "bugtracker": { "web": "http://github.com/adjust/hashtypes/issues/" From e88f04f2b7236a9f536faaa70c0d15e89c2b3e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=B1dvan=20Korkmaz?= <155473546+ridvankorkmaz@users.noreply.github.com> Date: Thu, 8 Feb 2024 23:11:04 +0300 Subject: [PATCH 6/6] Update md5.c --- src/md5.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/md5.c b/src/md5.c index 19d97fd..dd97d58 100644 --- a/src/md5.c +++ b/src/md5.c @@ -8,6 +8,16 @@ */ #include "postgres.h" +// pg16-compability +#ifndef SET_VARSIZE +/* + * pg >= 16 reorganized the toastable header files + * https://github.com/postgres/postgres/commit/d952373a987bad331c0e499463159dd142ced1ef + * to ensure cross version compatibility we do a bit of a hack here + */ +#include "varatt.h" +#endif + #include "access/hash.h" #include "common.h" #include "fmgr.h"