DEV Community

Bhaskar Sharma
Bhaskar Sharma

Posted on

1

Installing PostgreSQL & Apache AGE for debugging (Part 2)

Introduction

This is part 2 of a guide for setting up PostgreSQL and Apache AGE on a Linux (Ubuntu) machine for debugging. After following this blogpost, you'll be able to:

  • Install Apache AGE from source for debugging.

Installing Apache AGE from Source

Clone the Apache AGE GitHub repo from here

Before proceeding with installing, make a slight change to make debugging easier later.

Open the makefile, and go the line that starts with 'PG_CPPFLAGS'. At the end of this line, append the -O0 flag. This will tell compiler to keep the optimization level at 0, which will make it easier to step through the code with the debugger.

Now install AGE while telling it your PG_CONFIG path

sudo make PG_CONFIG=/usr/local/pgsql/bin/pg_config install

PostgreSQL and AGE installation with debugging enabled has been completed.

Setting up a database with Apache AGE

(The rest of the section serves as a short tutorial for using AGE).
Once the installation has been completed, now we will move to running Apache AGE.

  • Firstly, start the server using pg_ctl utility.
  • Enter the psql command line.
  • Create a database and connect to it using: CREATE DATABASE db_name \c db_name
  • Run the following commands next CREATE EXTENSION age; LOAD ‘age’; SET search_path = ag_catalog, "$user", public; The CREATE EXTENSION only has to be run once, but remember that the LOAD and SET commands have to be re-entered every time you enter psql.
  • Let's create a graph called 'test' using create_graph command in the ag_catalog namespace: SELECT * FROM ag_catalog.create_graph('test');
  • Now we can use cypher commands to manipulate the graph, for example SELECT * FROM cypher('test', $$ CREATE (x:test {name:'test node'}) RETURN x $$) AS (x agtype); The above query will create a vertex with label 'test', and name 'test node' in the 'test' graph.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️