Skip to content

Commit e04bab0

Browse files
Initial PG16 version (#1237)
Fixed empty string handling. Previously, the PG 16 outToken emitted NULL for an empty string, but now it emits an empty string "". Consequently, our cypher read function required modification to properly decode the empty string as a plain token, thereby addressing the comparison issue. Compared the branches and added the necessary changes so that the query's rteperminfos variable doesn't stay NULL. Fix missing include varatt.h (causing undefined symbol VARDATA_ANY) & Fixing some test cases of the failings Added missing include varatt.h to fix the undefined symbol while loading age into postgresql because usage of VARDATA_ANY needs to import varatt.h in PG16 Modified initialisation of ResultRelInfo and removed unnecessary RTEs Compared the branches and added the necessary changes so that the query's rteperminfos variable doesn't stay NULL. Modified initialisation of ResultRelInfo and removed unnecessary RTEs One of the problems that we were facing was related to the ResultRelInfo pointing at the wrong RTE via its ri_RangeTableIndex. The create_entity_result_rel_info() function does not have the capability of setting the ri_RootResultRelInfo to the correct ResultRelInfo node because it does not have access to the ModifyTableState node. The solution for this was to set the third argument in InitResultRelInfo() to be zero instead of list_length(estate->es_range_table). In the update_entity_tuple() function, when we call table_tuple_update() and assign the returned value to the result variable, the buffer variable receives the value of 0. Made a workaround so that the original value isn't lost. This is a work in progress for the new field that was added to the struct Var called varnullingrels. According to the documentation, this field is responsible for marking the Vars as nullable, if they are coming from a JOIN, either LEFT JOIN, RIGHT JOIN, or FULL OUTER JOIN. The changes were made following an "optional match" clause which is being treated as a LEFT JOIN from our extension. A function markRelsAsNulledBy is added because its internal in Postgres and doesn't belong in a header file, therefore it can't be exported. This function is added before the creation of the Vars from the make_vertex_expr and make_edge_expr, to correctly mark the specific PNSI as nullable, so later in the planner stage, the Vars will be correctly nulled. Fix incorrect typecasting in agtype_to_graphid function. Fix incorrect returns to the fuction _label_name, _ag_build_vertex and _ag_build_edge. Contributors Panagiotis Foliadis <[email protected]> Matheus Farias <[email protected]> Mohamed Mokhtar <[email protected]> Hannan Aamir <[email protected]> John Gemignani <[email protected]> Muhammad Taha Naveed <[email protected]> Wendel de Lana <[email protected]> ---------
1 parent a26d6a6 commit e04bab0

27 files changed

+183
-142
lines changed

.github/workflows/go-driver.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Go Driver Tests
22

33
on:
44
push:
5-
branches: [ "master", "PG15" ]
5+
branches: [ "master", "PG16" ]
66

77
pull_request:
8-
branches: [ "master", "PG15" ]
8+
branches: [ "master", "PG16" ]
99

1010
jobs:
1111
build:
@@ -26,14 +26,14 @@ jobs:
2626
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
2727
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
2828
echo "TAG=latest" >> $GITHUB_ENV
29-
elif [[ "$GITHUB_REF" == "refs/heads/PG15" ]]; then
30-
echo "TAG=PG15_latest" >> $GITHUB_ENV
29+
elif [[ "$GITHUB_REF" == "refs/heads/PG16" ]]; then
30+
echo "TAG=PG16_latest" >> $GITHUB_ENV
3131
fi
3232
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
3333
if [[ "$GITHUB_BASE_REF" == "master" ]]; then
3434
echo "TAG=latest" >> $GITHUB_ENV
35-
elif [[ "$GITHUB_BASE_REF" == "PG15" ]]; then
36-
echo "TAG=PG15_latest" >> $GITHUB_ENV
35+
elif [[ "$GITHUB_BASE_REF" == "PG16" ]]; then
36+
echo "TAG=PG16_latest" >> $GITHUB_ENV
3737
fi
3838
fi
3939

.github/workflows/installcheck.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,45 @@ name: Build / Regression
22

33
on:
44
push:
5-
branches: [ 'master', 'PG15' ]
5+
branches: [ 'master', 'PG16' ]
66
pull_request:
7-
branches: [ 'master', 'PG15' ]
7+
branches: [ 'master', 'PG16' ]
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

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

25-
- name: Install PostgreSQL 15
26-
if: steps.pg15cache.outputs.cache-hit != 'true'
25+
- name: Install PostgreSQL 16
26+
if: steps.pg16cache.outputs.cache-hit != 'true'
2727
run: |
28-
git clone --depth 1 --branch REL_15_STABLE git://git.postgresql.org/git/postgresql.git ~/pg15source
29-
cd ~/pg15source
30-
./configure --prefix=$HOME/pg15 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
28+
git clone --depth 1 --branch REL_16_STABLE git://git.postgresql.org/git/postgresql.git ~/pg16source
29+
cd ~/pg16source
30+
./configure --prefix=$HOME/pg16 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
3131
make install -j$(nproc) > /dev/null
3232
3333
- uses: actions/checkout@v3
3434

3535
- name: Build
3636
id: build
3737
run: |
38-
make PG_CONFIG=$HOME/pg15/bin/pg_config install -j$(nproc)
38+
make PG_CONFIG=$HOME/pg16/bin/pg_config install -j$(nproc)
3939
4040
- name: Regression tests
4141
id: regression_tests
4242
run: |
43-
make PG_CONFIG=$HOME/pg15/bin/pg_config installcheck
43+
make PG_CONFIG=$HOME/pg16/bin/pg_config installcheck
4444
continue-on-error: true
4545

4646
- name: Dump regression test errors

.github/workflows/jdbc-driver.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: JDBC Driver Tests
22

33
on:
44
push:
5-
branches: [ "master", "PG15" ]
5+
branches: [ "master", "PG16" ]
66

77
pull_request:
8-
branches: [ "master", "PG15" ]
8+
branches: [ "master", "PG16" ]
99

1010
jobs:
1111
build:
@@ -28,14 +28,14 @@ jobs:
2828
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
2929
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
3030
echo "TAG=latest" >> $GITHUB_ENV
31-
elif [[ "$GITHUB_REF" == "refs/heads/PG15" ]]; then
32-
echo "TAG=PG15_latest" >> $GITHUB_ENV
31+
elif [[ "$GITHUB_REF" == "refs/heads/PG16" ]]; then
32+
echo "TAG=PG16_latest" >> $GITHUB_ENV
3333
fi
3434
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
3535
if [[ "$GITHUB_BASE_REF" == "master" ]]; then
3636
echo "TAG=latest" >> $GITHUB_ENV
37-
elif [[ "$GITHUB_BASE_REF" == "PG15" ]]; then
38-
echo "TAG=PG15_latest" >> $GITHUB_ENV
37+
elif [[ "$GITHUB_BASE_REF" == "PG16" ]]; then
38+
echo "TAG=PG16_latest" >> $GITHUB_ENV
3939
fi
4040
fi
4141

.github/workflows/nodejs-driver.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Nodejs Driver Tests
22

33
on:
44
push:
5-
branches: [ "master", "PG15" ]
5+
branches: [ "master", "PG16" ]
66

77
pull_request:
8-
branches: [ "master", "PG15" ]
8+
branches: [ "master", "PG16" ]
99

1010
jobs:
1111
build:
@@ -23,14 +23,14 @@ jobs:
2323
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
2424
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
2525
echo "TAG=latest" >> $GITHUB_ENV
26-
elif [[ "$GITHUB_REF" == "refs/heads/PG15" ]]; then
27-
echo "TAG=PG15_latest" >> $GITHUB_ENV
26+
elif [[ "$GITHUB_REF" == "refs/heads/PG16" ]]; then
27+
echo "TAG=PG16_latest" >> $GITHUB_ENV
2828
fi
2929
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
3030
if [[ "$GITHUB_BASE_REF" == "master" ]]; then
3131
echo "TAG=latest" >> $GITHUB_ENV
32-
elif [[ "$GITHUB_BASE_REF" == "PG15" ]]; then
33-
echo "TAG=PG15_latest" >> $GITHUB_ENV
32+
elif [[ "$GITHUB_BASE_REF" == "PG16" ]]; then
33+
echo "TAG=PG16_latest" >> $GITHUB_ENV
3434
fi
3535
fi
3636

.github/workflows/python-driver.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Python Driver Tests
22

33
on:
44
push:
5-
branches: [ "master", "PG15" ]
5+
branches: [ "master", "PG16" ]
66

77
pull_request:
8-
branches: [ "master", "PG15" ]
8+
branches: [ "master", "PG16" ]
99

1010
jobs:
1111
build:
@@ -23,14 +23,14 @@ jobs:
2323
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
2424
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
2525
echo "TAG=latest" >> $GITHUB_ENV
26-
elif [[ "$GITHUB_REF" == "refs/heads/PG15" ]]; then
27-
echo "TAG=PG15_latest" >> $GITHUB_ENV
26+
elif [[ "$GITHUB_REF" == "refs/heads/PG16" ]]; then
27+
echo "TAG=PG16_latest" >> $GITHUB_ENV
2828
fi
2929
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
3030
if [[ "$GITHUB_BASE_REF" == "master" ]]; then
3131
echo "TAG=latest" >> $GITHUB_ENV
32-
elif [[ "$GITHUB_BASE_REF" == "PG15" ]]; then
33-
echo "TAG=PG15_latest" >> $GITHUB_ENV
32+
elif [[ "$GITHUB_BASE_REF" == "PG16" ]]; then
33+
echo "TAG=PG16_latest" >> $GITHUB_ENV
3434
fi
3535
fi
3636

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ age--*.*.*.sql
77
.DS_Store
88
*.tokens
99
*.interp
10+
*.dylib

src/backend/catalog/ag_catalog.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,15 @@ void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char *queryString, bool re
9797
(*prev_process_utility_hook) (pstmt, queryString, readOnlyTree, context, params,
9898
queryEnv, dest, qc);
9999
else
100+
{
101+
Assert(IsA(pstmt, PlannedStmt));
102+
Assert(pstmt->commandType == CMD_UTILITY);
103+
Assert(queryString != NULL); /* required as of 8.4 */
104+
Assert(qc == NULL || qc->commandTag == CMDTAG_UNKNOWN);
100105
standard_ProcessUtility(pstmt, queryString, readOnlyTree, context, params, queryEnv,
101106
dest, qc);
107+
}
108+
102109
}
103110

104111
static void drop_age_extension(DropStmt *stmt)

src/backend/catalog/ag_graph.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ void insert_graph(const Name graph_name, const Oid nsp_id)
4949
HeapTuple tuple;
5050

5151

52-
AssertArg(graph_name);
53-
AssertArg(OidIsValid(nsp_id));
52+
Assert(graph_name);
53+
Assert(OidIsValid(nsp_id));
5454

5555
ag_graph = table_open(ag_graph_relation_id(), RowExclusiveLock);
5656
values[Anum_ag_graph_oid - 1] = ObjectIdGetDatum(nsp_id);

src/backend/catalog/ag_label.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ void insert_label(const char *label_name, Oid graph_oid, int32 label_id,
6363
* NOTE: Is it better to make use of label_id and label_kind domain types
6464
* than to use assert to check label_id and label_kind are valid?
6565
*/
66-
AssertArg(label_name);
67-
AssertArg(label_id_is_valid(label_id));
68-
AssertArg(label_kind == LABEL_KIND_VERTEX ||
66+
Assert(label_name);
67+
Assert(label_id_is_valid(label_id));
68+
Assert(label_kind == LABEL_KIND_VERTEX ||
6969
label_kind == LABEL_KIND_EDGE);
70-
AssertArg(OidIsValid(label_relation));
71-
AssertArg(seq_name);
70+
Assert(OidIsValid(label_relation));
71+
Assert(seq_name);
7272

7373
ag_label = table_open(ag_label_relation_id(), RowExclusiveLock);
7474

@@ -188,8 +188,9 @@ Datum _label_name(PG_FUNCTION_ARGS)
188188
uint32 label_id;
189189

190190
if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
191-
ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
192-
errmsg("graph_oid and label_id must not be null")));
191+
PG_RETURN_NULL();
192+
//ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
193+
// errmsg("graph_oid and label_id must not be null")));
193194

194195
graph = PG_GETARG_OID(0);
195196

@@ -241,7 +242,7 @@ Datum _extract_label_id(PG_FUNCTION_ARGS)
241242
}
242243
graph_oid = AG_GETARG_GRAPHID(0);
243244

244-
PG_RETURN_INT32(get_graphid_label_id(graph_oid));
245+
PG_RETURN_INT64(get_graphid_label_id(graph_oid));
245246
}
246247

247248
bool label_id_exists(Oid graph_oid, int32 label_id)

src/backend/commands/label_commands.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ static void remove_relation(List *qname)
808808
Oid rel_oid;
809809
ObjectAddress address;
810810

811-
AssertArg(list_length(qname) == 2);
811+
Assert(list_length(qname) == 2);
812812

813813
// concurrent is false so lockmode is AccessExclusiveLock
814814

@@ -868,8 +868,7 @@ static void range_var_callback_for_remove_relation(const RangeVar *rel,
868868

869869
// relkind == expected_relkind
870870

871-
if (!pg_class_ownercheck(rel_oid, GetUserId()) &&
872-
!pg_namespace_ownercheck(get_rel_namespace(rel_oid), GetUserId()))
871+
if (!object_ownercheck(rel_oid, get_rel_namespace(rel_oid), GetUserId()))
873872
{
874873
aclcheck_error(ACLCHECK_NOT_OWNER,
875874
get_relkind_objtype(get_rel_relkind(rel_oid)),

0 commit comments

Comments
 (0)