Guide to Apache AGE 1.3.0 Release for PostgreSQL 13
Tags: apacheage, postgres, database, db
Published: 2023-04-09 15:14:51


## Introduction
**Apache AGE** is an open-source extension for PostgreSQL database management system. It is the world's first graph database extension that runs inside a traditional relational database system, bringing together the power and versatility of graph databases with the reliability and scalability of PostgreSQL.

**Recently**, Apache AGE has released its latest version 1.3.0, which comes with lots of new features, performance improvements, and bug fixes. In this guide, we'll take a closer look at the new features of Apache AGE 1.3.0 release for PostgreSQL 13.

## Requirements

Note: If you have not already installed AGE/POSTGRESQL stack on your machine, you will need to do the same procedure with Postgrsql 11 and AGE 1.1.0 *latest release* to compare the previous and new changes :) 

[DISCUSS] Apache AGE 1.3.0 Release for PostgreSQL 13 said: ```
NOTE: Due to this being the first release for PostgreSQL 13, there is no
upgrade path from other versions.
```
**Which means we will have only single sql script named age--1.3.0.sql**

## Setup
### PostgreSQL 13 and AGE 1.3.0
Lets create a directory called bitnine and having our testing and reporting inside
```sh
mkdir bitnine
```
Lets start with PostgreSQL 13 installation in a custom path
Reference: [https://www.postgresql.org/docs/13/install-short.html](https://www.postgresql.org/docs/13/install-short.html)

1. Download the source code from [https://www.postgresql.org/ftp/source/v13.0/](https://www.postgresql.org/ftp/source/v13.0/)
2. Move the download file to bitnine and extract the source code into
3. Follow the following commands
```sh
# move the source code to our new created directory
mv ~/Downloads/postgresql-13.0.tar.gz ~/bitnie/
# change directory to bitnine 
cd ~/bitnine
# extract the source code
tar xzf postgresql-13.0.tar.gz
# make directory for having the build of the postgres
mkdir pg13
# make directory for holding the data
mkdir pg13data
# go to postgresql-13.0
cd postgresql-13.0
# configure the source code build
./configure --prefix=/home/rrr/bitnine/pg13 --enable-debug --with-pgport=5431
make
sudo make install
# ensure installation
cd ..
cd pg13
# expected dirs: bin  include  lib  share
ls
# add new user or just skip it and use your preferred 
adduser postgres
# change ownership to the user
chown postgres pg13data
# switch to the user
su - postgres
# Update LD_LIBRARY_PATH (very important step)
LD_LIBRARY_PATH=/home/rrr/bitnine/pg13/lib
export LD_LIBRARY_PATH
# init db cluster
./pg13/bin/initdb -D ./pg13data
# start the server
./pg13/bin/postgres -D ./pg13data/ -p 5431 >logfile 2>&1 &
# create database 'test' 
./pg13/bin/createdb test -p 5431
# start postgresql session
# output psql (13.0)
./pg13/bin/psql test
\q
```

Lets then install AGE 1.3.0
Apache AGE 1.3.0 for PostgreSQL 13 Release Notes

The target link we will have AGE 1.3.0 from is the release from their repository: [AGE-1.3.0](https://github.com/apache/age/releases/tag/PG13/v1.3.0-rc0)

1. Download source code [https://github.com/apache/age/releases/tag/PG13/v1.3.0-rc0](https://github.com/apache/age/releases/tag/PG13/v1.3.0-rc0)
2. Move it to bitnine
```sh
mv ~/Downloads/apache-age-1.3.0-src.tar.gz ~/bitnine/
tar xzf apache-age-1.3.0-src.tar.gz
cd apache-age-1.3.0
# If you opened a new terminal / you have not set it automatically
LD_LIBRARY_PATH=/home/rrr/bitnine/pg13/lib
export LD_LIBRARY_PATH
# install
sudo make PG_CONFIG=/home/rrr/bitnine/pg13/bin/pg_config install
# installcheck
sudo make clean
make PG_CONFIG=/home/rrr/bitnine/pg13/bin/pg_config installcheck
./pg13/bin/psql test
CREATE EXTENSION age;
LOAD 'age';
SELECT * FROM ag_catalog.create_graph('test_graph');
```

Reporting: 
1. All tests passes 24/24 

2.Tested the implementation of CALL ...[YIELD] for cypher functions. (#630 <https://github.com/apache/age/pull/630>)
3. I see that feature already implemented and mentioned on AGE 1.2.0 and it works properly there I think there is no point to get it mentioned in the new version as well `Graph names with the empty string '' are no more allowed. (#251)` 

4. Reviewed the typo changes 

5. Reviewed the regressions tests

6. Signature Check => check and pass

7. License and Notice => check and pass

8. No binary files => check and pass

9. Graph names with the empty string '' are no more allowed. (#251) : I see that feature already
implemented and mentioned on AGE 1.2.0 and it works properly there. I think there is no point in getting
it mentioned in the new version as well. If the comparison between AGE 1.3.0 and 1.1.0 then it's okay.  

10. At drop_graph with ‘’ empty string it outputs graph "" does not exist while name is not valid should
both are valid but for consistency I think it may be similar the the create_graph output.

11. Running a session with multiple queries contains the age clauses.

12. Tested queries contains multiple data types returning queries.

## Feedback
 I liked the upgrade overall because it will be necessary to be adaptable with all and most recent PG’s
versions so it is a great effort and work, well done.

## References and resources
- https://github.com/apache/age
- https://www.postgresql.org/docs/13/installation.html
- https://age.apache.org/

## Changes log

- Implement CALL ...[YIELD] for cypher functions. (#630)
- Graph names with the empty string '' are no more allowed. (#251)
- Fix typos at multiple locations. (#470)
- Fix Bug with CALL... [YIELD], clause ignores WHERE.
- Fix EXPLAIN to allow for nested cypher commands.
- Fix delete_global_graphs and add regression tests. (#336)
- Invalid labels now return NULL.
- Update CONTRIBUTING.md (#348)
- Fix null pointer on name compare. (#376)
- Fix Travis CI warning messages.
- Additional regression tests added for age_global_graph. (#341)
- Readme Added for AGE-JDBC-Driver. (#383)
- Updated volitility categories for many functions.
- Fix issue 339 - entities in WHERE clause have wrong Expr. (#391)
- Create complete graph function. (#342) (#662)
- Fix issue 317: Graph naming convention. (#349)
- Update SET clause to support assigning a map to a variable. (#468)
- Patch to address PR 203 that appears to be inactive. (#671)
- Add additional comments for create_graph function. (#582)
- Optimize age_exists function. (#586)
- Implement plus-equal operator in SET clause. (#638)
- Implement CI test for python driver. (#587)
- Move from travis CI to github actions for build. (#673)
- Update all driver CIs to Github actions.
- Fix build warnings. (#709)
- Updated Readme for drivers folder. (#642)
- Removed async from function definitions. (#680)
- Barbell graph generation (#648) and Barbell regress tests. (#708)
- UPDATED Python Driver ANTLR 4.9.3 -> 4.11.1 (#706)
- Fix WITH ignoring WHERE clause. (#646)
- Implement isEmpty() predicate function. (#710)
- Fix cypher function input argument checks. (#718)
- Fix Issue 693 - server termination from return exists(path). (#721)
- Update regression tests for cypher_with. (#725)
- Fix issue 733 - create_complete_graph() terminates the server. (#734)
- Prevent MATCH from following OPTIONAL MATCH. (#740)
- Fix property constraints against resolved variables. (#724) (#751) (#701) (#747)
- Include invalid labels in reused variables. (#751) (#762)
- Fix update_entity_tuple to use correct CommandId. (#769)
- Remove check for scalar agtypes in unwind. (#736)
- Update PG13 CI workflows. (#775)
- Update readme and version for python driver. (#780)
- Update README.md

## References and resources

-     https://github.com/apache/age
-     https://age.apache.org/
-     https://github.com/apache/age/releases/tag/PG13%2Fv1.3.0-rc0
-     https://lists.apache.org/list.html?dev@age.apache.org