01 - Basic Query

Your first IO::Async::Pg query. Demonstrates connecting to PostgreSQL, running simple queries, and accessing results.

What it shows

Prerequisites

A running PostgreSQL server. No tables needed - uses built-in functions.

Running

# With default localhost connection
perl app.pl

# With custom database URL
DATABASE_URL='postgresql://user:pass@host:5432/dbname' perl app.pl

Expected output

Connected to PostgreSQL!

PostgreSQL version:
  PostgreSQL 16.1 on x86_64-pc-linux-musl, compiled by gcc...

Math check:
  1 + 1 = 2
  2 * 3 = 6

Generated series (5 rows):
  n = 1
  n = 2
  n = 3
  n = 4
  n = 5

Connection released.
Done!