Skip to content
Closed
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
40 changes: 40 additions & 0 deletions .github/workflows/installcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PG12 Regression

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]

jobs:
build:

runs-on: ubuntu-latest

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

- name: Cache PostgreSQL 12
uses: actions/cache@v2
id: pg12cache
with:
path: ~/pg12
key: ${{ runner.os }}-v1-pg12-${{ env.PG_COMMIT_HASH }}

- name: Install PostgreSQL 12
if: steps.pg12cache.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch REL_12_STABLE git://git.postgresql.org/git/postgresql.git ~/pg12source
cd ~/pg12source
./configure --prefix=$HOME/pg12 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
make install -j$(nproc) > /dev/null

- uses: actions/checkout@v2
- name: Regression
run: |
export PG_CONFIG=$HOME/pg12/bin/pg_config
make -j$(nproc)
make install
make installcheck
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.o
*.so
.gitignore
build.sh
.idea
.deps
.DS_Store
.DS_Store
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,28 @@ ag_regress_dir = $(srcdir)/regress
REGRESS_OPTS = --load-extension=age --inputdir=$(ag_regress_dir) --outputdir=$(ag_regress_dir) --temp-instance=$(ag_regress_dir)/instance --port=61958 --encoding=UTF-8

ag_regress_out = instance/ log/ results/ regression.*
EXTRA_CLEAN = $(addprefix $(ag_regress_dir)/, $(ag_regress_out)) src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h
EXTRA_CLEAN = $(addprefix $(ag_regress_dir)/, $(ag_regress_out)) src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h src/include/parser/cypher_kwlist_d.h

GEN_KEYWORDLIST = $(PERL) -I ./tools/ ./tools/gen_keywordlist.pl
GEN_KEYWORDLIST_DEPS = ./tools/gen_keywordlist.pl tools/PerfectHash.pm

ag_include_dir = $(srcdir)/src/include
PG_CPPFLAGS = -I$(ag_include_dir) -I$(ag_include_dir)/parser

PG_CONFIG = pg_config
PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

src/backend/parser/cypher_keywords.o: src/include/parser/cypher_kwlist_d.h

src/include/parser/cypher_kwlist_d.h: src/include/parser/cypher_kwlist.h $(GEN_KEYWORDLIST_DEPS)
$(GEN_KEYWORDLIST) --extern --varname CypherKeyword --output src/include/parser $<

src/include/parser/cypher_gram_def.h: src/backend/parser/cypher_gram.c

src/backend/parser/cypher_gram.c: BISONFLAGS += --defines=src/include/parser/cypher_gram_def.h

src/backend/parser/cypher_parser.o: src/backend/parser/cypher_gram.c
src/backend/parser/cypher_keywords.o: src/backend/parser/cypher_gram.c

src/backend/parser/ag_scanner.c: FLEX_NO_BACKUP=yes
src/backend/parser/ag_scanner.c: FLEX_NO_BACKUP=yes
18 changes: 11 additions & 7 deletions age--1.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
-- catalog tables
--


CREATE TABLE ag_graph (
graphid oid NOT NULL,
name name NOT NULL,
namespace regnamespace NOT NULL
) WITH (OIDS);
);

CREATE UNIQUE INDEX ag_graph_oid_index ON ag_graph USING btree (oid);
CREATE UNIQUE INDEX ag_graph_graphid_index ON ag_graph USING btree (graphid);

CREATE UNIQUE INDEX ag_graph_name_index ON ag_graph USING btree (name);

Expand All @@ -43,20 +45,22 @@ CREATE DOMAIN label_id AS int NOT NULL CHECK (VALUE > 0 AND VALUE <= 65535);
CREATE DOMAIN label_kind AS "char" NOT NULL CHECK (VALUE = 'v' OR VALUE = 'e');

CREATE TABLE ag_label (

name name NOT NULL,
graph oid NOT NULL,
id label_id,
kind label_kind,
relation regclass NOT NULL
) WITH (OIDS);

CREATE UNIQUE INDEX ag_label_oid_index ON ag_label USING btree (oid);
relation regclass NOT NULL,
CONSTRAINT fk_graph_oid
FOREIGN KEY(graph)
REFERENCES ag_graph(graphid)
);

CREATE UNIQUE INDEX ag_label_name_graph_index
ON ag_label
USING btree (name, graph);

CREATE UNIQUE INDEX ag_label_graph_id_index
CREATE UNIQUE INDEX ag_label_graph_oid_index
ON ag_label
USING btree (graph, id);

Expand Down
28 changes: 18 additions & 10 deletions regress/expected/age_load.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
\! cp -r regress/age_load/data regress/instance/data/age_load
LOAD 'age';
SET search_path TO ag_catalog;
Expand Down Expand Up @@ -190,16 +208,6 @@ SELECT * FROM cypher('agload_test_graph', $$MATCH(n:Country2 {iso2 : 'AT'})
1688849860263940 | "Austria" | "AT"
(1 row)

SELECT * FROM cypher('agload_test_graph', $$
MATCH (u:Country {region : "Europe"})
WHERE u.name =~ 'Cro.*'
RETURN u.name, u.region
$$) AS (result_1 agtype, result_2 agtype);
result_1 | result_2
-----------+----------
"Croatia" | "Europe"
(1 row)

SELECT drop_graph('agload_test_graph', true);
NOTICE: drop cascades to 7 other objects
DETAIL: drop cascades to table agload_test_graph._ag_label_vertex
Expand Down
1 change: 1 addition & 0 deletions regress/expected/agtype.out
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
-- Load extension and set path
--
LOAD 'age';
SET extra_float_digits = 0;
SET search_path TO ag_catalog;
--
-- Create a table using the AGTYPE type
Expand Down
12 changes: 6 additions & 6 deletions regress/expected/catalog.out
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NOTICE: graph "g" has been created

(1 row)

SELECT * FROM ag_graph WHERE name = 'g';
SELECT name, namespace FROM ag_graph WHERE name = 'g';
name | namespace
------+-----------
g | g
Expand Down Expand Up @@ -119,7 +119,7 @@ NOTICE: graph "GraphB" has been created
(1 row)

-- Show GraphA's construction to verify case is preserved.
SELECT * FROM ag_graph WHERE name = 'GraphA';
SELECT name, namespace FROM ag_graph WHERE name = 'GraphA';
name | namespace
--------+-----------
GraphA | "GraphA"
Expand All @@ -140,7 +140,7 @@ NOTICE: graph "GraphA" renamed to "GraphX"
(1 row)

-- Show GraphX's construction to verify case is preserved.
SELECT * FROM ag_graph WHERE name = 'GraphX';
SELECT name, namespace FROM ag_graph WHERE name = 'GraphX';
name | namespace
--------+-----------
GraphX | "GraphX"
Expand All @@ -153,14 +153,14 @@ SELECT nspname FROM pg_namespace WHERE nspname = 'GraphX';
(1 row)

-- Verify there isn't a graph GraphA anymore.
SELECT * FROM ag_graph WHERE name = 'GraphA';
SELECT name, namespace FROM ag_graph WHERE name = 'GraphA';
name | namespace
------+-----------
(0 rows)

SELECT * FROM pg_namespace WHERE nspname = 'GraphA';
nspname | nspowner | nspacl
---------+----------+--------
oid | nspname | nspowner | nspacl
-----+---------+----------+--------
(0 rows)

-- Sanity check that graphx does not exist - should return 0.
Expand Down
Loading