Skip to content

Commit d336d6d

Browse files
jrgemignaniuhayatMuhammadTahaNaveedx4mMunmud
authored
Master to PostgreSQL version 17 (#2197)
Conflicts: .asf.yaml .github/workflows/installcheck.yaml Changes to be committed: modified: .asf.yaml modified: .github/labeler.yml modified: .github/workflows/installcheck.yaml modified: README.md modified: docker/Dockerfile modified: docker/Dockerfile.dev modified: drivers/docker-compose.yml modified: src/backend/nodes/ag_nodes.c modified: src/backend/parser/cypher_analyze.c * Add support for PG17 (#2130) - A new node type is introduced for JSON support, that is JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for SQL/JSON constructors. - Added additional checks for JsonConstructorExpr expression node for which the walker would crash. - Removed palloc0fast function call (which is not available in PG17) * Update CI, README and repo settings for PG17 (#2156) - Currently, all workflows are targeting the `PG17_prepare` branch, which will be changed to `PG17` once the branch is renamed. - Updated all the github workflows - Updated the README - Updated repo settings - Updated the Dockerfiles * Remove stale bot and update .asf.yaml settings (#2171) - Removed stale bot. (https://lists.apache.org/thread/qh4h2z6hsjy2v7wg8mwfnl6cbjp28y08) - Decrease required PR approvals by one. (https://lists.apache.org/thread/kmz155t6k0h3b26fjpz36924zthqjlpm) - Fixed a warning reported by apache infra i.e. "An error occurred while processing the github feature in .asf.yaml: GitHub discussions can only be enabled if a mailing list target exists for it." * Update labeler.yml Adjust workflow/labeler.yml to add permissions. * Adjust CI for PG17 after rename from PG17_prepare (#2182) Adjusted the following CI files (workflows) for PG17, they originally pointed to PG17_prepare - 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: drivers/docker-compose.yml modified: .github/labeler.yml * Reimplement list comprehension (#2169) (#2188) * Revert "Fix issue 1955 - List comprehension in WHERE clause (#2094)" This reverts commit 0f0d9be. * Revert "Fix error using list comprehension with WITH * (#1838)" This reverts commit 5e08a2f. * Revert "Fix shift/reduce conflict in grammar (#1719)" This reverts commit fab3119. * Revert "Implement list comprehension (#1610)" This reverts commit 3b2b394. * Reimplement list comprehension - Reimplement list comprehension to use ARRAY sublinks. - Some test results were not correct. All the test results that are modified are correct and are verified with neo4j. - Also resolves the issue of using list comprehension in MERGE clause (1611) and issue 1850 * Add expression tree walkers for cypher nodes - Added cypher_raw_expr_tree_walker and cypher_expr_tree_walker, based on Postgres's raw_expression_tree_walker and expression_tree_walker. These follow the same walker API as Postgres and add support for Cypher-specific nodes. - Also added the agtype[] to agtype func and typecast to 1.5.0-y.y.y.sql - Simplifies logic for cypher_subquery handling in where clause. - Fixes a crash when list comprehension in the WHERE clause references a variable from the preceding MATCH clause. * Add support for operators in cypher query (#2172) - Fixed some operator signatures in .sql - Added support for PG operators in cypher. Some hardcoded operators are removed, since they are now covered by the general operator handling. - Added full typecast syntax that allows for type modifiers. - These changes also improve interoperability with other extensions, as reflected in the regression tests. - Added a new function to check if graph_oid exists. * Prevent object access hook from accesing not installed namespace (#2161) Currently we cannot install Age to shared_preload_libraries if pg_cron is installed. To prevent following error we must bail out early. postgres=# set backtrace_functions to 'get_namespace_oid'; SET postgres=# create extension pg_cron ; 2025-04-15 16:59:49.867 +05 [30402] ERROR: schema "ag_catalog" does not exist 2025-04-15 16:59:49.867 +05 [30402] BACKTRACE: 2 postgres 0x0000000102401ab0 get_namespace_oid + 204 3 age.so 0x0000000103285cd0 ag_catalog_namespace_id + 28 4 age.so 0x00000001032846fc ag_relation_id + 32 5 age.so 0x00000001032efe9c search_label_relation_cache_miss + 84 6 age.so 0x00000001032efe30 search_label_relation_cache + 100 7 age.so 0x00000001032842f4 object_access + 384 8 postgres 0x000000010240a7a0 RunObjectDropHook + 136 9 postgres 0x00000001023ee85c deleteOneObject + 108 10 postgres 0x00000001023eb860 deleteObjectsInList + 476 11 postgres 0x00000001023eba14 performMultipleDeletions + 316 12 postgres 0x0000000102560244 ATPostAlterTypeCleanup + 2144 13 postgres 0x0000000102559fb4 ATRewriteCatalogs + 516 14 postgres 0x00000001025543a8 ATController + 284 15 postgres 0x00000001025541bc AlterTable + 96 16 postgres 0x00000001028b8240 ProcessUtilitySlow + 1812 17 postgres 0x00000001028b600c standard_ProcessUtility + 3684 18 age.so 0x00000001032844f8 ag_ProcessUtility_hook + 200 19 postgres 0x00000001028b516c ProcessUtility + 392 20 postgres 0x000000010250e5b4 execute_sql_string + 812 21 postgres 0x000000010250d438 execute_extension_script + 2264 22 postgres 0x000000010250b330 ApplyExtensionUpdates + 1320 23 postgres 0x0000000102507954 CreateExtensionInternal + 1896 24 postgres 0x0000000102506ea4 CreateExtension + 1152 25 postgres 0x00000001028b8ed4 ProcessUtilitySlow + 5032 26 postgres 0x00000001028b600c standard_ProcessUtility + 3684 27 age.so 0x00000001032844f8 ag_ProcessUtility_hook + 200 28 postgres 0x00000001028b516c ProcessUtility + 392 29 postgres 0x00000001028b4768 PortalRunUtility + 232 30 postgres 0x00000001028b3660 PortalRunMulti + 756 31 postgres 0x00000001028b2abc PortalRun + 1008 32 postgres 0x00000001028ad870 exec_simple_query + 1436 33 postgres 0x00000001028ac990 PostgresMain + 2472 34 postgres 0x00000001027a49ac report_fork_failure_to_client + 0 35 postgres 0x00000001027a3e54 BackendStartup + 520 36 postgres 0x00000001027a29f0 ServerLoop + 812 37 postgres 0x000000010279fe0c PostmasterMain + 6484 38 postgres 0x000000010266acd0 startup_hacks + 0 39 dyld 0x000000018a3ab154 start + 2476 * Fix CSV import for edge with one property (#2175) - start_index marks where property fields begin. For edges, it's 4. If start_index >= total_fields, create empty properties; otherwise, parse the properties. --------- Co-authored-by: Umar Hayat <[email protected]> Co-authored-by: Muhammad Taha Naveed <[email protected]> Co-authored-by: Andrey Borodin <[email protected]> Co-authored-by: Moontasir Mahmood <[email protected]>
1 parent 1277b82 commit d336d6d

File tree

8 files changed

+50
-34
lines changed

8 files changed

+50
-34
lines changed

.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+
PG17:
54+
required_pull_request_reviews:
55+
required_approving_review_count: 2
56+
5357
PG16:
5458
required_pull_request_reviews:
5559
required_approving_review_count: 1

.github/labeler.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@ PG14:
1313
PG15:
1414
- base-branch: 'PG15'
1515

16+
PG16:
17+
- base-branch: 'PG16'
18+
19+
PG17:
20+
- base-branch: 'PG17'
21+
1622
master:
17-
- base-branch: 'master'
23+
- base-branch: 'master'

.github/workflows/installcheck.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,53 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- name: Get latest commit id of PostgreSQL 16
14+
- name: Get latest commit id of PostgreSQL 17
1515
run: |
16-
echo "PG_COMMIT_HASH=$(git ls-remote https://git.postgresql.org/git/postgresql.git refs/heads/REL_16_STABLE | awk '{print $1}')" >> $GITHUB_ENV
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
1717
18-
- name: Cache PostgreSQL 16
18+
- name: Cache PostgreSQL 17
1919
uses: actions/cache@v3
20-
id: pg16cache
20+
id: pg17cache
2121
with:
22-
path: ~/pg16
23-
key: ${{ runner.os }}-v1-pg16-${{ env.PG_COMMIT_HASH }}
22+
path: ~/pg17
23+
key: ${{ runner.os }}-v1-pg17-${{ env.PG_COMMIT_HASH }}
2424

2525
- name: Install necessary dependencies
2626
run: |
2727
sudo apt-get update
2828
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison
2929
30-
- name: Install PostgreSQL 16 and some extensions
31-
if: steps.pg16cache.outputs.cache-hit != 'true'
30+
- name: Install PostgreSQL 17 and some extensions
31+
if: steps.pg17cache.outputs.cache-hit != 'true'
3232
run: |
33-
git clone --depth 1 --branch REL_16_STABLE https://git.postgresql.org/git/postgresql.git ~/pg16source
34-
cd ~/pg16source
35-
./configure --prefix=$HOME/pg16 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
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
3636
make install -j$(nproc) > /dev/null
3737
cd contrib
3838
cd fuzzystrmatch
39-
make PG_CONFIG=$HOME/pg16/bin/pg_config install -j$(nproc) > /dev/null
39+
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
4040
cd ../pg_trgm
41-
make PG_CONFIG=$HOME/pg16/bin/pg_config install -j$(nproc) > /dev/null
41+
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
4242
4343
- uses: actions/checkout@v3
4444

4545
- name: Build AGE
4646
id: build
4747
run: |
48-
make PG_CONFIG=$HOME/pg16/bin/pg_config install -j$(nproc)
49-
48+
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc)
49+
5050
- name: Pull and build pgvector
5151
id: pgvector
5252
run: |
5353
git clone https://github.com/pgvector/pgvector.git
5454
cd pgvector
55-
make PG_CONFIG=$HOME/pg16/bin/pg_config install -j$(nproc) > /dev/null
55+
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
5656
5757
- name: Regression tests
5858
id: regression_tests
5959
run: |
60-
make PG_CONFIG=$HOME/pg16/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
60+
make PG_CONFIG=$HOME/pg17/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
6161
continue-on-error: true
6262

6363
- 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.5.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/16/index.html">
37-
<img src="https://img.shields.io/badge/Version-Postgresql 16-00008B?labelColor=gray&style=flat&link=https://www.postgresql.org/docs/16/index.html"/>
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"/>
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. 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. 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/16/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/17/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 are supported. If you have any other version of Postgres, you will need to install PostgreSQL version 11, 12, 13, 14, 15, or 16.
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.
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:16 AS build
20+
FROM postgres:17 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-16
27+
postgresql-server-dev-17
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:16
37+
FROM postgres:17
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/16/lib/age.so /usr/lib/postgresql/16/lib/
52-
COPY --from=build /usr/share/postgresql/16/extension/age--1.5.0.sql /usr/share/postgresql/16/extension/
53-
COPY --from=build /usr/share/postgresql/16/extension/age.control /usr/share/postgresql/16/extension/
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.5.0.sql /usr/share/postgresql/17/extension/
53+
COPY --from=build /usr/share/postgresql/17/extension/age.control /usr/share/postgresql/17/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:16
20+
FROM postgres:17
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-16 \
27+
postgresql-server-dev-17 \
2828
locales
2929

3030
ENV LANG=en_US.UTF-8

src/backend/nodes/ag_nodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ExtensibleNode *_new_ag_node(Size size, ag_node_tag tag)
158158
{
159159
ExtensibleNode *n;
160160

161-
n = (ExtensibleNode *)palloc0fast(size);
161+
n = (ExtensibleNode *)palloc0(size);
162162
n->type = T_ExtensibleNode;
163163
n->extnodename = node_names[tag];
164164

src/backend/parser/cypher_analyze.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,17 @@ static bool convert_cypher_walker(Node *node, ParseState *pstate)
168168
* OpExpr - expression node for an operator invocation
169169
* Const - constant value or expression node
170170
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
171+
* JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for
172+
* SQL/JSON constructors
171173
*
172174
* These are a special case that needs to be ignored.
173175
*
174176
*/
175177
if (IsA(funcexpr, SQLValueFunction)
176178
|| IsA(funcexpr, CoerceViaIO)
177179
|| IsA(funcexpr, Var) || IsA(funcexpr, OpExpr)
178-
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr))
180+
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr)
181+
|| IsA(funcexpr, JsonConstructorExpr))
179182
{
180183
return false;
181184
}
@@ -340,14 +343,17 @@ static bool is_func_cypher(FuncExpr *funcexpr)
340343
* OpExpr - expression node for an operator invocation
341344
* Const - constant value or expression node
342345
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
346+
* JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for
347+
* SQL/JSON constructors
343348
*
344349
* These are a special case that needs to be ignored.
345350
*
346351
*/
347352
if (IsA(funcexpr, SQLValueFunction)
348353
|| IsA(funcexpr, CoerceViaIO)
349354
|| IsA(funcexpr, Var) || IsA(funcexpr, OpExpr)
350-
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr))
355+
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr)
356+
|| IsA(funcexpr, JsonConstructorExpr))
351357
{
352358
return false;
353359
}

0 commit comments

Comments
 (0)