Skip to content

Commit 69ab7fd

Browse files
committed
Add Apache AGE
1 parent 6d6b365 commit 69ab7fd

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ RUN apt-get update && \
102102
# runtime requirement for using spatialite with sqlite_fdw
103103
libsqlite3-mod-spatialite \
104104
pgagent \
105+
postgresql-$PG_MAJOR-age \
105106
postgresql-$PG_MAJOR-asn1oid \
106107
postgresql-$PG_MAJOR-credcheck \
107108
postgresql-$PG_MAJOR-cron \

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ For more detailed instructions about how to start and control your Postgres cont
2222

2323
## Available extensions
2424

25+
- [age](https://github.com/apache/age)
2526
- [asn1oid](https://github.com/df7cb/pgsql-asn1oid)
2627
- [credcheck](https://github.com/MigOpsRepos/credcheck)
2728
- [ddlx](https://github.com/lacanoid/pgddl)

tests/create_extensions.sql

+37
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,43 @@ CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;
2020
SELECT PostGIS_Full_Version();
2121

2222

23+
-- https://github.com/apache/age
24+
CREATE EXTENSION age;
25+
LOAD 'age';
26+
27+
BEGIN;
28+
29+
SET search_path = ag_catalog, "$user", public;
30+
31+
SELECT create_graph('graph_name');
32+
33+
-- create vertices
34+
SELECT * FROM cypher('graph_name', $$CREATE (:label {property:"Node A"})$$) as (v agtype);
35+
SELECT * FROM cypher('graph_name', $$CREATE (:label {property:"Node B"})$$) as (v agtype);
36+
37+
-- create an edge between two nodes and set its properties
38+
SELECT * FROM cypher(
39+
'graph_name',
40+
$$
41+
MATCH (a:label), (b:label)
42+
WHERE a.property = 'Node A' AND b.property = 'Node B'
43+
CREATE (a)-[e:RELTYPE {property:a.property + '<->' + b.property}]->(b)
44+
RETURN e
45+
$$
46+
) as (e agtype);
47+
48+
-- query the connected nodes
49+
SELECT * from cypher(
50+
'graph_name',
51+
$$
52+
MATCH (V)-[R]-(V2)
53+
RETURN V,R,V2
54+
$$
55+
) as (V agtype, R agtype, V2 agtype);
56+
57+
ROLLBACK;
58+
59+
2360
-- https://github.com/df7cb/pgsql-asn1oid
2461
CREATE EXTENSION IF NOT EXISTS asn1oid;
2562
SELECT '1.3.6.1.4.1'::asn1oid;

0 commit comments

Comments
 (0)