Skip to content

Commit b3219fd

Browse files
jrgemignanikk-src
andauthored
Master to PostgreSQL version 18 (#2315)
* Updated CI, Labeler, Docker, and branch security files for PG18 (#2246) Updated the CI and Docker files for the PG18 Updated the labeler and branch security files for PG18. Some of these only apply to the master branch but are updated for consistency. modified: .asf.yaml modified: .github/labeler.yml modified: .github/workflows/go-driver.yml modified: .github/workflows/installcheck.yaml modified: .github/workflows/jdbc-driver.yaml modified: .github/workflows/nodejs-driver.yaml modified: .github/workflows/python-driver.yaml modified: docker/Dockerfile modified: docker/Dockerfile.dev modified: drivers/docker-compose.yml * PG18 port for AGE (#2251) * [PG18 port][Set1] Fix header dependencies and use TupleDescAttr macro - Include executor/executor.h for PG18 header reorganization and use TupleDescAttr() accessor macro instead of direct attrs[] access. * [PG18 port][Set2] Adapt to expandRTE signature change and pg_noreturn - Add VarReturningType parameter to expandRTE() calls using VAR_RETURNING_DEFAULT. - Replace pg_attribute_noreturn() with pg_noreturn prefix specifier. * [PG18 port][Set3] Fix double ExecOpenIndices call for PG18 compatibility - PG18 enforces stricter assertions in ExecOpenIndices, requiring ri_IndexRelationDescs to be NULL when called. - In update_entity_tuple(), indices may already be opened by the caller (create_entity_result_rel_info), causing assertion failures. - Add a check to only open indices if not already open, and track ownership with a boolean flag to ensure we only close what we opened. - Found when regression tests failed with assertions, which this change resolves. * [PG18 port][Set4] Update regression test expected output for ordering PG18's implementation changes result in different row ordering for queries without explicit ORDER BY clauses. Update expected output files to reflect the new ordering while maintaining identical result content. * [PG18 port][Set5] Address review comments - coding standard fix Note: Assisted by GitHub Copilot Agent mode. * Fix DockerHub build warning messages (#2252) PR fixes build warning messages on DockerHub and on my local build. No regression tests needed. modified: src/include/nodes/ag_nodes.h modified: src/include/optimizer/cypher_createplan.h modified: src/include/optimizer/cypher_pathnode.h modified: tools/gen_keywordlist.pl --------- Co-authored-by: Krishnakumar R (KK) <65895020+kk-src@users.noreply.github.com>
1 parent 1702ae0 commit b3219fd

19 files changed

Lines changed: 104 additions & 60 deletions

File tree

.asf.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ github:
5050
required_pull_request_reviews:
5151
required_approving_review_count: 1
5252

53+
PG18:
54+
required_pull_request_reviews:
55+
required_approving_review_count: 1
56+
5357
PG17:
5458
required_pull_request_reviews:
5559
required_approving_review_count: 1

.github/labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ PG16:
1919
PG17:
2020
- base-branch: 'PG17'
2121

22+
PG18:
23+
- base-branch: 'PG18'
24+
2225
master:
2326
- base-branch: 'master'

.github/workflows/installcheck.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Build / Regression
33
on:
44
push:
55
branches: [ "master" ]
6+
67
pull_request:
78
branches: [ "master" ]
89

@@ -11,53 +12,53 @@ jobs:
1112
runs-on: ubuntu-latest
1213

1314
steps:
14-
- name: Get latest commit id of PostgreSQL 17
15+
- name: Get latest commit id of PostgreSQL 18
1516
run: |
16-
echo "PG_COMMIT_HASH=$(git ls-remote https://git.postgresql.org/git/postgresql.git refs/heads/REL_17_STABLE | awk '{print $1}')" >> $GITHUB_ENV
17+
echo "PG_COMMIT_HASH=$(git ls-remote https://git.postgresql.org/git/postgresql.git refs/heads/REL_18_STABLE | awk '{print $1}')" >> $GITHUB_ENV
1718
18-
- name: Cache PostgreSQL 17
19+
- name: Cache PostgreSQL 18
1920
uses: actions/cache@v3
20-
id: pg17cache
21+
id: pg18cache
2122
with:
22-
path: ~/pg17
23-
key: ${{ runner.os }}-v1-pg17-${{ env.PG_COMMIT_HASH }}
23+
path: ~/pg18
24+
key: ${{ runner.os }}-v1-pg18-${{ env.PG_COMMIT_HASH }}
2425

2526
- name: Install necessary dependencies
2627
run: |
2728
sudo apt-get update
2829
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison
2930
30-
- name: Install PostgreSQL 17 and some extensions
31-
if: steps.pg17cache.outputs.cache-hit != 'true'
31+
- name: Install PostgreSQL 18 and some extensions
32+
if: steps.pg18cache.outputs.cache-hit != 'true'
3233
run: |
33-
git clone --depth 1 --branch REL_17_STABLE https://git.postgresql.org/git/postgresql.git ~/pg17source
34-
cd ~/pg17source
35-
./configure --prefix=$HOME/pg17 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
34+
git clone --depth 1 --branch REL_18_STABLE https://git.postgresql.org/git/postgresql.git ~/pg18source
35+
cd ~/pg18source
36+
./configure --prefix=$HOME/pg18 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
3637
make install -j$(nproc) > /dev/null
3738
cd contrib
3839
cd fuzzystrmatch
39-
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
40+
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc) > /dev/null
4041
cd ../pg_trgm
41-
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
42+
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc) > /dev/null
4243
4344
- uses: actions/checkout@v3
4445

4546
- name: Build AGE
4647
id: build
4748
run: |
48-
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc)
49+
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc)
4950
5051
- name: Pull and build pgvector
5152
id: pgvector
5253
run: |
5354
git clone https://github.com/pgvector/pgvector.git
5455
cd pgvector
55-
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
56+
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc) > /dev/null
5657
5758
- name: Regression tests
5859
id: regression_tests
5960
run: |
60-
make PG_CONFIG=$HOME/pg17/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
61+
make PG_CONFIG=$HOME/pg18/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
6162
continue-on-error: true
6263

6364
- name: Dump regression test errors

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
<img src="https://img.shields.io/badge/Release-v1.6.0-FFA500?labelColor=gray&style=flat&link=https://github.com/apache/age/releases"/>
3434
</a>
3535
&nbsp;
36-
<a href="https://www.postgresql.org/docs/17/index.html">
37-
<img src="https://img.shields.io/badge/Version-Postgresql 17-00008B?labelColor=gray&style=flat&link=https://www.postgresql.org/docs/17/index.html"/>
36+
<a href="https://www.postgresql.org/docs/18/index.html">
37+
<img src="https://img.shields.io/badge/Version-Postgresql 18-00008B?labelColor=gray&style=flat&link=https://www.postgresql.org/docs/18/index.html"/>
3838
</a>
3939
&nbsp;
4040
<a href="https://github.com/apache/age/issues">
@@ -125,7 +125,7 @@ Apache AGE is intended to be simple to install and run. It can be installed with
125125
&nbsp;Install PostgreSQL
126126
</h4>
127127

128-
You will need to install an AGE compatible version of Postgres<a>, for now AGE supports Postgres 11, 12, 13, 14, 15, 16 & 17. Supporting the latest versions is on AGE roadmap.
128+
You will need to install an AGE compatible version of Postgres<a>, for now AGE supports Postgres 11, 12, 13, 14, 15, 16, 17, & 18. Supporting the latest versions is on AGE roadmap.
129129

130130
<h4>
131131
&nbsp;Installation via Package Manager
@@ -143,7 +143,7 @@ sudo apt install postgresql
143143
&nbsp;Installation From Source Code
144144
</h4>
145145

146-
You can <a href="https://www.postgresql.org/ftp/source/"> download the Postgres </a> source code and install your own instance of Postgres. You can read instructions on how to install from source code for different versions on the <a href="https://www.postgresql.org/docs/17/installation.html">official Postgres Website.</a>
146+
You can <a href="https://www.postgresql.org/ftp/source/"> download the Postgres </a> source code and install your own instance of Postgres. You can read instructions on how to install from source code for different versions on the <a href="https://www.postgresql.org/docs/18/installation.html">official Postgres Website.</a>
147147

148148

149149

@@ -152,7 +152,7 @@ You can <a href="https://www.postgresql.org/ftp/source/"> download the Postgres
152152

153153
Clone the <a href="https://github.com/apache/age">github repository</a> or download the <a href="https://github.com/apache/age/releases">download an official release.
154154
</a>
155-
Run the pg_config utility and check the version of PostgreSQL. Currently, only PostgreSQL versions 11, 12, 13, 14, 15, 16 & 17 are supported. If you have any other version of Postgres, you will need to install PostgreSQL version 11, 12, 13, 14, 15, 16 & 17.
155+
Run the pg_config utility and check the version of PostgreSQL. Currently, only PostgreSQL versions 11, 12, 13, 14, 15, 16, 17, & 18 are supported. If you have any other version of Postgres, you will need to install PostgreSQL version 11, 12, 13, 14, 15, 16, 17, & 18.
156156
<br>
157157

158158
```bash

docker/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
#
1818

1919
# Build stage: Install necessary development tools for compilation and installation
20-
FROM postgres:17 AS build
20+
FROM postgres:18 AS build
2121

2222
RUN apt-get update \
2323
&& apt-get install -y --no-install-recommends --no-install-suggests \
2424
bison \
2525
build-essential \
2626
flex \
27-
postgresql-server-dev-17
27+
postgresql-server-dev-18
2828

2929
COPY . /age
3030

@@ -34,7 +34,7 @@ RUN make && make install
3434

3535

3636
# Final stage: Create a final image by copying the files created in the build stage
37-
FROM postgres:17
37+
FROM postgres:18
3838

3939
RUN apt-get update \
4040
&& apt-get install -y --no-install-recommends --no-install-suggests \
@@ -48,9 +48,9 @@ ENV LANG=en_US.UTF-8
4848
ENV LC_COLLATE=en_US.UTF-8
4949
ENV LC_CTYPE=en_US.UTF-8
5050

51-
COPY --from=build /usr/lib/postgresql/17/lib/age.so /usr/lib/postgresql/17/lib/
52-
COPY --from=build /usr/share/postgresql/17/extension/age--1.6.0.sql /usr/share/postgresql/17/extension/
53-
COPY --from=build /usr/share/postgresql/17/extension/age.control /usr/share/postgresql/17/extension/
51+
COPY --from=build /usr/lib/postgresql/18/lib/age.so /usr/lib/postgresql/18/lib/
52+
COPY --from=build /usr/share/postgresql/18/extension/age--1.6.0.sql /usr/share/postgresql/18/extension/
53+
COPY --from=build /usr/share/postgresql/18/extension/age.control /usr/share/postgresql/18/extension/
5454
COPY docker/docker-entrypoint-initdb.d/00-create-extension-age.sql /docker-entrypoint-initdb.d/00-create-extension-age.sql
5555

5656
CMD ["postgres", "-c", "shared_preload_libraries=age"]

docker/Dockerfile.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
#
1818

1919

20-
FROM postgres:17
20+
FROM postgres:18
2121

2222
RUN apt-get update
2323
RUN apt-get install --assume-yes --no-install-recommends --no-install-suggests \
2424
bison \
2525
build-essential \
2626
flex \
27-
postgresql-server-dev-17 \
27+
postgresql-server-dev-18 \
2828
locales
2929

3030
ENV LANG=en_US.UTF-8

regress/expected/cypher_match.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ SELECT * FROM cypher('cypher_match', $$
348348
$$) AS (i agtype);
349349
i
350350
----------------------------------------------------------------------------------
351-
{"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex
352-
{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex
353351
{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex
352+
{"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex
354353
{"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex
354+
{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex
355355
(4 rows)
356356

357357
SELECT * FROM cypher('cypher_match', $$
@@ -537,18 +537,18 @@ SELECT * FROM cypher('cypher_match', $$
537537
$$) AS (i agtype, b agtype, c agtype);
538538
i | b | c
539539
---+-----------+-----------
540-
| "end" | "middle"
541-
0 | "end" | "middle"
542-
1 | "end" | "middle"
543540
| "middle" | "end"
544541
0 | "middle" | "end"
545542
1 | "middle" | "end"
546-
| "middle" | "initial"
547-
0 | "middle" | "initial"
548-
1 | "middle" | "initial"
543+
| "end" | "middle"
544+
0 | "end" | "middle"
545+
1 | "end" | "middle"
549546
| "initial" | "middle"
550547
0 | "initial" | "middle"
551548
1 | "initial" | "middle"
549+
| "middle" | "initial"
550+
0 | "middle" | "initial"
551+
1 | "middle" | "initial"
552552
(12 rows)
553553

554554
SELECT * FROM cypher('cypher_match', $$
@@ -558,18 +558,18 @@ SELECT * FROM cypher('cypher_match', $$
558558
$$) AS (i agtype, c agtype);
559559
i | c
560560
---+-----------
561-
| "middle"
562-
0 | "middle"
563-
1 | "middle"
564561
| "end"
565562
0 | "end"
566563
1 | "end"
567-
| "initial"
568-
0 | "initial"
569-
1 | "initial"
570564
| "middle"
571565
0 | "middle"
572566
1 | "middle"
567+
| "middle"
568+
0 | "middle"
569+
1 | "middle"
570+
| "initial"
571+
0 | "initial"
572+
1 | "initial"
573573
(12 rows)
574574

575575
--
@@ -2421,8 +2421,8 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[u {relationship: u.relation
24212421
SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name:a.name})-[u {relationship: u.relationship}]->(b {age:b.age}) RETURN p $$) as (a agtype);
24222422
a
24232423
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2424-
[{"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path
24252424
[{"id": 281474976710661, "label": "", "properties": {"age": 4, "name": "T"}}::vertex, {"id": 4785074604081153, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710661, "properties": {"years": 3, "relationship": "friends"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path
2425+
[{"id": 281474976710659, "label": "", "properties": {"age": 3, "name": "orphan"}}::vertex, {"id": 4785074604081154, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710659, "properties": {"years": 4, "relationship": "enemies"}}::edge, {"id": 281474976710666, "label": "", "properties": {"age": 6}}::vertex]::path
24262426
(2 rows)
24272427

24282428
SELECT * FROM cypher('cypher_match', $$ CREATE () WITH * MATCH (x{n0:x.n1}) RETURN 0 $$) as (a agtype);

src/backend/catalog/ag_label.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "access/genam.h"
2323
#include "catalog/indexing.h"
24+
#include "executor/executor.h"
2425
#include "nodes/makefuncs.h"
2526
#include "utils/builtins.h"
2627
#include "utils/lsyscache.h"

src/backend/executor/cypher_create.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "postgres.h"
2121

22+
#include "executor/executor.h"
2223
#include "utils/rls.h"
2324

2425
#include "catalog/ag_label.h"

src/backend/executor/cypher_delete.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919

2020
#include "postgres.h"
2121

22+
#include "executor/executor.h"
23+
#include "storage/bufmgr.h"
2224
#include "common/hashfn.h"
2325
#include "miscadmin.h"
24-
#include "storage/bufmgr.h"
2526
#include "utils/acl.h"
2627
#include "utils/rls.h"
2728

@@ -260,7 +261,7 @@ static agtype_value *extract_entity(CustomScanState *node,
260261
tupleDescriptor = scanTupleSlot->tts_tupleDescriptor;
261262

262263
/* type checking, make sure the entity is an agtype vertex or edge */
263-
if (tupleDescriptor->attrs[entity_position -1].atttypid != AGTYPEOID)
264+
if (TupleDescAttr(tupleDescriptor, entity_position -1)->atttypid != AGTYPEOID)
264265
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
265266
errmsg("DELETE clause can only delete agtype")));
266267

0 commit comments

Comments
 (0)