Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ github:
required_pull_request_reviews:
required_approving_review_count: 1

PG18:
required_pull_request_reviews:
required_approving_review_count: 1

PG17:
required_pull_request_reviews:
required_approving_review_count: 1
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ PG16:
PG17:
- base-branch: 'PG17'

PG18:
- base-branch: 'PG18'

master:
- base-branch: 'master'
33 changes: 17 additions & 16 deletions .github/workflows/installcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build / Regression
on:
push:
branches: [ "master" ]

pull_request:
branches: [ "master" ]

Expand All @@ -11,53 +12,53 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Get latest commit id of PostgreSQL 17
- name: Get latest commit id of PostgreSQL 18
run: |
echo "PG_COMMIT_HASH=$(git ls-remote https://git.postgresql.org/git/postgresql.git refs/heads/REL_17_STABLE | awk '{print $1}')" >> $GITHUB_ENV
echo "PG_COMMIT_HASH=$(git ls-remote https://git.postgresql.org/git/postgresql.git refs/heads/REL_18_STABLE | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache PostgreSQL 17
- name: Cache PostgreSQL 18
uses: actions/cache@v3
id: pg17cache
id: pg18cache
with:
path: ~/pg17
key: ${{ runner.os }}-v1-pg17-${{ env.PG_COMMIT_HASH }}
path: ~/pg18
key: ${{ runner.os }}-v1-pg18-${{ env.PG_COMMIT_HASH }}

- name: Install necessary dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison

- name: Install PostgreSQL 17 and some extensions
if: steps.pg17cache.outputs.cache-hit != 'true'
- name: Install PostgreSQL 18 and some extensions
if: steps.pg18cache.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch REL_17_STABLE https://git.postgresql.org/git/postgresql.git ~/pg17source
cd ~/pg17source
./configure --prefix=$HOME/pg17 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
git clone --depth 1 --branch REL_18_STABLE https://git.postgresql.org/git/postgresql.git ~/pg18source
cd ~/pg18source
./configure --prefix=$HOME/pg18 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
make install -j$(nproc) > /dev/null
cd contrib
cd fuzzystrmatch
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc) > /dev/null
cd ../pg_trgm
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc) > /dev/null

- uses: actions/checkout@v3

- name: Build AGE
id: build
run: |
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc)
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc)

- name: Pull and build pgvector
id: pgvector
run: |
git clone https://github.com/pgvector/pgvector.git
cd pgvector
make PG_CONFIG=$HOME/pg17/bin/pg_config install -j$(nproc) > /dev/null
make PG_CONFIG=$HOME/pg18/bin/pg_config install -j$(nproc) > /dev/null

- name: Regression tests
id: regression_tests
run: |
make PG_CONFIG=$HOME/pg17/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
make PG_CONFIG=$HOME/pg18/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
continue-on-error: true

- name: Dump regression test errors
Expand Down
12 changes: 6 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
#

# Build stage: Install necessary development tools for compilation and installation
FROM postgres:17 AS build
FROM postgres:18 AS build

RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
bison \
build-essential \
flex \
postgresql-server-dev-17
postgresql-server-dev-18

COPY . /age

Expand All @@ -34,7 +34,7 @@ RUN make && make install


# Final stage: Create a final image by copying the files created in the build stage
FROM postgres:17
FROM postgres:18

RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
Expand All @@ -48,9 +48,9 @@ ENV LANG=en_US.UTF-8
ENV LC_COLLATE=en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8

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

CMD ["postgres", "-c", "shared_preload_libraries=age"]
4 changes: 2 additions & 2 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
#


FROM postgres:17
FROM postgres:18

RUN apt-get update
RUN apt-get install --assume-yes --no-install-recommends --no-install-suggests \
bison \
build-essential \
flex \
postgresql-server-dev-17 \
postgresql-server-dev-18 \
locales

ENV LANG=en_US.UTF-8
Expand Down
30 changes: 15 additions & 15 deletions regress/expected/cypher_match.out
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ SELECT * FROM cypher('cypher_match', $$
$$) AS (i agtype);
i
----------------------------------------------------------------------------------
{"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex
{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex
{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex
{"id": 1688849860263939, "label": "v2", "properties": {"id": "end"}}::vertex
{"id": 1688849860263937, "label": "v2", "properties": {"id": "initial"}}::vertex
{"id": 1688849860263938, "label": "v2", "properties": {"id": "middle"}}::vertex
(4 rows)

SELECT * FROM cypher('cypher_match', $$
Expand Down Expand Up @@ -537,18 +537,18 @@ SELECT * FROM cypher('cypher_match', $$
$$) AS (i agtype, b agtype, c agtype);
i | b | c
---+-----------+-----------
| "end" | "middle"
0 | "end" | "middle"
1 | "end" | "middle"
| "middle" | "end"
0 | "middle" | "end"
1 | "middle" | "end"
| "middle" | "initial"
0 | "middle" | "initial"
1 | "middle" | "initial"
| "end" | "middle"
0 | "end" | "middle"
1 | "end" | "middle"
| "initial" | "middle"
0 | "initial" | "middle"
1 | "initial" | "middle"
| "middle" | "initial"
0 | "middle" | "initial"
1 | "middle" | "initial"
(12 rows)

SELECT * FROM cypher('cypher_match', $$
Expand All @@ -558,18 +558,18 @@ SELECT * FROM cypher('cypher_match', $$
$$) AS (i agtype, c agtype);
i | c
---+-----------
| "middle"
0 | "middle"
1 | "middle"
| "end"
0 | "end"
1 | "end"
| "initial"
0 | "initial"
1 | "initial"
| "middle"
0 | "middle"
1 | "middle"
| "middle"
0 | "middle"
1 | "middle"
| "initial"
0 | "initial"
1 | "initial"
(12 rows)

--
Expand Down Expand Up @@ -2421,8 +2421,8 @@ SELECT * FROM cypher('cypher_match', $$ MATCH p=(a)-[u {relationship: u.relation
SELECT * FROM cypher('cypher_match', $$ MATCH p=(a {name:a.name})-[u {relationship: u.relationship}]->(b {age:b.age}) RETURN p $$) as (a agtype);
a
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[{"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
[{"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
[{"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
(2 rows)

SELECT * FROM cypher('cypher_match', $$ CREATE () WITH * MATCH (x{n0:x.n1}) RETURN 0 $$) as (a agtype);
Expand Down
1 change: 1 addition & 0 deletions src/backend/catalog/ag_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "access/genam.h"
#include "catalog/indexing.h"
#include "executor/executor.h"
#include "nodes/makefuncs.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
Expand Down
2 changes: 2 additions & 0 deletions src/backend/executor/cypher_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "postgres.h"

#include "executor/executor.h"

#include "catalog/ag_label.h"
#include "executor/cypher_executor.h"
#include "executor/cypher_utils.h"
Expand Down
3 changes: 2 additions & 1 deletion src/backend/executor/cypher_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "postgres.h"

#include "executor/executor.h"
#include "storage/bufmgr.h"
#include "common/hashfn.h"

Expand Down Expand Up @@ -257,7 +258,7 @@ static agtype_value *extract_entity(CustomScanState *node,
tupleDescriptor = scanTupleSlot->tts_tupleDescriptor;

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

Expand Down
2 changes: 2 additions & 0 deletions src/backend/executor/cypher_merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "postgres.h"

#include "executor/executor.h"

#include "catalog/ag_label.h"
#include "executor/cypher_executor.h"
#include "executor/cypher_utils.h"
Expand Down
29 changes: 23 additions & 6 deletions src/backend/executor/cypher_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "postgres.h"

#include "executor/executor.h"
#include "storage/bufmgr.h"

#include "executor/cypher_executor.h"
Expand Down Expand Up @@ -102,6 +103,7 @@ static HeapTuple update_entity_tuple(ResultRelInfo *resultRelInfo,
TM_Result result;
CommandId cid = GetCurrentCommandId(true);
ResultRelInfo **saved_resultRels = estate->es_result_relations;
bool close_indices = false;

estate->es_result_relations = &resultRelInfo;

Expand All @@ -113,7 +115,16 @@ static HeapTuple update_entity_tuple(ResultRelInfo *resultRelInfo,

if (lock_result == TM_Ok)
{
ExecOpenIndices(resultRelInfo, false);
/*
* Open indices if not already open. The resultRelInfo may already
* have indices opened by the caller (e.g., create_entity_result_rel_info),
* so only open if needed and track that we did so for cleanup.
*/
if (resultRelInfo->ri_IndexRelationDescs == NULL)
{
ExecOpenIndices(resultRelInfo, false);
close_indices = true;
}
ExecStoreVirtualTuple(elemTupleSlot);
tuple = ExecFetchSlotHeapTuple(elemTupleSlot, true, NULL);
tuple->t_self = old_tuple->t_self;
Expand Down Expand Up @@ -141,7 +152,10 @@ static HeapTuple update_entity_tuple(ResultRelInfo *resultRelInfo,
errmsg("tuple to be updated was already modified")));
}

ExecCloseIndices(resultRelInfo);
if (close_indices)
{
ExecCloseIndices(resultRelInfo);
}
estate->es_result_relations = saved_resultRels;

return tuple;
Expand All @@ -160,7 +174,10 @@ static HeapTuple update_entity_tuple(ResultRelInfo *resultRelInfo,
(update_indexes == TU_Summarizing));
}

ExecCloseIndices(resultRelInfo);
if (close_indices)
{
ExecCloseIndices(resultRelInfo);
}
}
else if (lock_result == TM_SelfModified)
{
Expand Down Expand Up @@ -310,7 +327,7 @@ static void update_all_paths(CustomScanState *node, graphid id,
agtype_value *original_entity_value;

/* skip nulls */
if (scanTupleSlot->tts_tupleDescriptor->attrs[i].atttypid != AGTYPEOID)
if (TupleDescAttr(scanTupleSlot->tts_tupleDescriptor, i)->atttypid != AGTYPEOID)
{
continue;
}
Expand Down Expand Up @@ -414,7 +431,7 @@ static void process_update_list(CustomScanState *node)
continue;
}

if (scanTupleSlot->tts_tupleDescriptor->attrs[update_item->entity_position -1].atttypid != AGTYPEOID)
if (TupleDescAttr(scanTupleSlot->tts_tupleDescriptor, update_item->entity_position -1)->atttypid != AGTYPEOID)
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
Expand Down Expand Up @@ -588,7 +605,7 @@ static void process_update_list(CustomScanState *node)
}

estate->es_snapshot->curcid = cid;
/* close relation */
/* close relation */
ExecCloseIndices(resultRelInfo);
table_close(resultRelInfo->ri_RelationDesc, RowExclusiveLock);

Expand Down
1 change: 1 addition & 0 deletions src/backend/executor/cypher_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "postgres.h"

#include "executor/executor.h"
#include "nodes/makefuncs.h"
#include "parser/parse_relation.h"

Expand Down
4 changes: 2 additions & 2 deletions src/backend/parser/cypher_clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -2611,9 +2611,9 @@ static void get_res_cols(ParseState *pstate, ParseNamespaceItem *l_pnsi,
List *colnames = NIL;
List *colvars = NIL;

expandRTE(l_pnsi->p_rte, l_pnsi->p_rtindex, 0, -1, false,
expandRTE(l_pnsi->p_rte, l_pnsi->p_rtindex, 0, VAR_RETURNING_DEFAULT, -1, false,
&l_colnames, &l_colvars);
expandRTE(r_pnsi->p_rte, r_pnsi->p_rtindex, 0, -1, false,
expandRTE(r_pnsi->p_rte, r_pnsi->p_rtindex, 0, VAR_RETURNING_DEFAULT, -1, false,
&r_colnames, &r_colvars);

/* add in all colnames and colvars from the l_rte. */
Expand Down
8 changes: 3 additions & 5 deletions src/backend/utils/adt/agtype_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ static void parse_object(agtype_lex_context *lex, agtype_sem_action *sem);
static void parse_array_element(agtype_lex_context *lex,
agtype_sem_action *sem);
static void parse_array(agtype_lex_context *lex, agtype_sem_action *sem);
static void report_parse_error(agtype_parse_context ctx,
agtype_lex_context *lex)
pg_attribute_noreturn();
static void report_invalid_token(agtype_lex_context *lex)
pg_attribute_noreturn();
static pg_noreturn void report_parse_error(agtype_parse_context ctx,
agtype_lex_context *lex);
static pg_noreturn void report_invalid_token(agtype_lex_context *lex);
static int report_agtype_context(agtype_lex_context *lex);
static char *extract_mb_char(char *s);

Expand Down
3 changes: 3 additions & 0 deletions src/include/nodes/ag_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ typedef enum ag_node_tag
cypher_merge_information_t
} ag_node_tag;

extern const char *node_names[];
extern const ExtensibleNodeMethods node_methods[];

void register_ag_nodes(void);

ExtensibleNode *_new_ag_node(Size size, ag_node_tag tag);
Expand Down
Loading