<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>pglayers blog</title>
    <link>https://pglayers.github.io/blog/</link>
    <description>Updates, guides, and announcements from the pglayers project -- by Ismaël Mejía &lt;iemejia@gmail.com&gt;.</description>
    <language>en-us</language>
    <managingEditor>Ismaël Mejía &lt;iemejia@gmail.com&gt;</managingEditor>
    <lastBuildDate>Wed, 25 Nov 2026 13:39:20 +0000</lastBuildDate>
    <atom:link href="https://pglayers.github.io/feed.xml" rel="self" type="application/rss+xml"/>

    <item>
      <title>PostgreSQL 19 is now supported in pglayers</title>
      <link>https://pglayers.github.io/blog/2026-11-25-postgresql-19-support.html</link>
      <guid>https://pglayers.github.io/blog/2026-11-25-postgresql-19-support.html</guid>
      <pubDate>Wed, 25 Nov 2026 12:42:05 +0000</pubDate>
      <dc:creator>Ismaël Mejía &lt;iemejia@gmail.com&gt;</dc:creator>
      <category>PostgreSQL</category>
      <category>Docker</category>
      <category>Containers</category>
      <description>PostgreSQL 19 support with 62 extension layers, Full and Azure profiles, amd64 and arm64 images, and examples for getting started without compiling extensions.</description>
      <content:encoded><![CDATA[
<p>PostgreSQL 19 support is now available in <strong>pglayers</strong>, with <strong>62 extension layers</strong>, ready-to-use <strong>Full and Azure profile images</strong>, and builds for both <strong>amd64 and arm64</strong>.</p>

<p>The images use the official <code>postgres:19</code> GA image. If you want PostgreSQL 19 with pgvector, PostGIS, pg_cron, pg_textsearch, or pg_lake, you can get started without compiling extensions yourself.</p>

<h2>A quick reminder: what is pglayers?</h2>

<p>The official PostgreSQL Docker images provide a familiar starting point, but installing additional extensions often means adding package repositories, build tools, and compilation steps to your Dockerfile.</p>

<p>pglayers publishes extensions as small, composable Docker image layers. You can copy individual layers onto an official PostgreSQL image, or use a preconfigured profile that already includes the extension paths, preload libraries, and startup settings.</p>

<p>The idea is simple: <strong>choose your extensions without maintaining their build environments.</strong></p>

<h2>Try PostgreSQL 19 with extensions</h2>

<p>The Full profile includes all 62 extensions currently available for PostgreSQL 19:</p>

<pre><code class="language-sh"><span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d --name</span> pglayers-pg19 \
  <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">change-me</span> \
  <span class="token-option" style="color: #818cf8">-p</span> <span class="token-number" style="color: #3b82f6">127.0.0.1:5432:5432</span> \
  <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-full:19</span></code></pre>

<p>Once PostgreSQL is ready, connect with:</p>

<pre><code class="language-sh"><span class="token-command" style="color: #f59e0b">docker</span> exec <span class="token-option" style="color: #818cf8">-it</span> pglayers-pg19 <span class="token-command" style="color: #f59e0b">psql</span> <span class="token-option" style="color: #818cf8">-U</span> postgres</code></pre>

<p>For example, enable pgvector and calculate a vector distance:</p>

<pre><code class="language-sql"><span class="token-keyword" style="color: #818cf8">CREATE EXTENSION IF NOT EXISTS</span> vector;

<span class="token-keyword" style="color: #818cf8">SELECT</span> <span class="token-string" style="color: #10b981">'[1,2,3]'</span>::vector <span class="token-operator" style="color: #818cf8">&lt;-&gt;</span> <span class="token-string" style="color: #10b981">'[4,5,6]'</span>::vector <span class="token-keyword" style="color: #818cf8">AS</span> distance;</code></pre>

<p>The profile takes care of the server configuration. You still create the SQL extensions you want to use in each database.</p>

<p>The PG19 collection includes tools for several kinds of workloads:</p>

<ul>
    <li><strong>AI and search:</strong> pgvector and pg_textsearch.</li>
    <li><strong>Geospatial queries:</strong> PostGIS, pgRouting, and H3.</li>
    <li><strong>Data lake access:</strong> pg_lake.</li>
    <li><strong>Background work:</strong> pg_cron, pg_net, and pg_incremental.</li>
    <li><strong>Application development:</strong> pgmq, temporal_tables, and PLV8.</li>
    <li><strong>Data protection and observability:</strong> PostgreSQL Anonymizer, pgAudit, and pg_stat_monitor.</li>
</ul>

<h2>What is available on each PostgreSQL version?</h2>

<p>The pglayers catalog now contains <strong>84 extensions</strong>, but that does not mean every image contains all 84.</p>

<p>Availability depends on the PostgreSQL major version, upstream compatibility, published packages, and whether extensions can run together.</p>

<div class="table-scroll" role="region" aria-label="Extension availability by PostgreSQL version" tabindex="0">
    <table>
        <thead>
            <tr>
                <th scope="col">PostgreSQL</th>
                <th scope="col">Individual extension layers</th>
                <th scope="col">Full profile</th>
                <th scope="col">Azure profile</th>
            </tr>
        </thead>
        <tbody>
            <tr><th scope="row">19</th><td>62</td><td>62</td><td>24</td></tr>
            <tr><th scope="row">18</th><td>84</td><td>83</td><td>31</td></tr>
            <tr><th scope="row">17</th><td>84</td><td>83</td><td>31</td></tr>
        </tbody>
    </table>
</div>

<p>These counts reflect the published images as of November 20, 2026.</p>

<p>Why do the PG17 and PG18 Full profiles contain 83 extensions rather than 84? They include <code>pg_duckdb</code> and deliberately exclude the conflicting <code>pg_lake</code> layer. Both remain available individually. On PG19, <code>pg_duckdb</code> is not yet available through our build path, and the Full profile includes <code>pg_lake</code>.</p>

<p>“Full” means the broadest compatible collection for that PostgreSQL major—not a promise that every extension in the catalog can be loaded together.</p>

<h2>The Azure profile also supports PG19</h2>

<p>If you want a smaller collection based on extensions available in Azure Database for PostgreSQL Flexible Server, use:</p>

<pre><code class="language-sh"><span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d --name</span> pglayers-azure-pg19 \
  <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">change-me</span> \
  <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-azure:19</span></code></pre>

<p>The PG19 Azure profile currently includes <strong>24 extensions</strong>, compared with <strong>31 on PG17 and PG18</strong>.</p>

<p>Seven profile members are not yet available in pglayers for PG19:</p>

<ul>
    <li><code>age</code></li>
    <li><code>documentdb</code></li>
    <li><code>pg_duckdb</code></li>
    <li><code>pg_failover_slots</code></li>
    <li><code>rum</code></li>
    <li><code>tds_fdw</code></li>
    <li><code>timescaledb</code></li>
</ul>

<p>The blockers differ. Some projects have PG19 compatibility changes under development or awaiting a release. Others still need compatible packages, container images, or supporting components.</p>

<p><strong>DocumentDB users should stay on PG17 or PG18 for now.</strong> Although <code>pglayers-azure:19</code> exists, it does not include DocumentDB or its MongoDB-compatible gateway.</p>

<p>As before, the Azure profile is a convenience for local development—not an exact reproduction of the managed service. Extension versions, configuration defaults, and platform-specific behavior can differ.</p>

<h2>Compose a smaller PG19 image</h2>

<p>You do not have to use a profile. Here is a complete Dockerfile that adds only pgvector:</p>

<pre><code class="language-dockerfile"><span class="token-keyword" style="color: #818cf8">FROM</span> <span class="token-string" style="color: #10b981">postgres:19</span>

<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-pgvector:19</span> \
    / /extensions/pgvector/

<span class="token-keyword" style="color: #818cf8">RUN</span> <span class="token-command" style="color: #f59e0b">echo</span> <span class="token-string" style="color: #10b981">"extension_control_path = '/extensions/pgvector/share:\$system'"</span> \
        &gt;&gt; /usr/share/postgresql/postgresql.conf.sample \
    &amp;&amp; <span class="token-command" style="color: #f59e0b">echo</span> <span class="token-string" style="color: #10b981">"dynamic_library_path = '/extensions/pgvector/lib:\$libdir'"</span> \
        &gt;&gt; /usr/share/postgresql/postgresql.conf.sample</code></pre>

<p>Build and run it normally:</p>

<pre><code class="language-sh"><span class="token-command" style="color: #f59e0b">docker</span> build <span class="token-option" style="color: #818cf8">-t</span> my-postgres:19 .

<span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d --name</span> my-postgres \
  <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">change-me</span> \
  my-postgres:19</code></pre>

<p>No extension compilation happens during this build. Docker copies the prebuilt layer.</p>

<p>Like PG18, PG19 uses pglayers’ <strong>isolated extension layout</strong>. Each extension lives under its own <code>/extensions/&lt;name&gt;/</code> directory. PostgreSQL discovers its control files through <code>extension_control_path</code> and its modules through <code>dynamic_library_path</code>.</p>

<p>Bundled runtime libraries are kept private to each extension, avoiding file overwrites and accidental dependencies on neighboring layers. This isolation does not make inherently incompatible extensions compatible, so checking the documented conflicts still matters.</p>

<h2>Tested beyond a successful build</h2>

<p>An extension compiling successfully is only the first step.</p>

<p>The PG19 release went through checks for:</p>

<ul>
    <li><strong>Self-containment:</strong> each layer resolves its runtime dependencies on the bare PostgreSQL image.</li>
    <li><strong>Cross-layer isolation:</strong> extensions do not accidentally load a sibling layer’s bundled libraries.</li>
    <li><strong>Loading and functionality:</strong> extensions load and pass their SQL integration tests.</li>
    <li><strong>Profile startup:</strong> both PG19 profiles start without warnings or errors.</li>
    <li><strong>Server health:</strong> tests detect backend and background-worker crashes.</li>
    <li><strong>Multi-architecture builds:</strong> images are built for amd64 and arm64.</li>
    <li><strong>Kubernetes integration:</strong> ImageVolume and CloudNativePG tests pass on PG19.</li>
</ul>

<p>The GA layers and both profiles are now published. PostgreSQL 17 and 18 remain supported and tested alongside 19.</p>

<h2>A note about upgrading</h2>

<p>Changing an image tag from <code>:18</code> to <code>:19</code> is <strong>not a database migration</strong>.</p>

<p>Treat this as a PostgreSQL major-version upgrade: check that every extension your database uses is available on PG19, back up your data, and follow an appropriate upgrade procedure such as <code>pg_upgrade</code> or dump and restore.</p>

<p>In particular, the smaller PG19 extension set means that some existing PG17/18 workloads should wait for upstream support before moving.</p>

<h2>Get started</h2>

<p>You can find the current counts and examples on the <a href="https://pglayers.github.io/#versions">pglayers website</a>, browse the <a href="https://github.com/pglayers/pglayers#available-extensions">extension catalog</a>, or read the <a href="https://github.com/pglayers/pglayers/blob/main/docs/pg19-evaluation.md">PG19 compatibility notes</a>.</p>

<p>Whether you want a preconfigured development database or a small image with a few carefully chosen extensions, PostgreSQL 19 is now another supported starting point.</p>
      ]]></content:encoded>
    </item>

    <item>
      <title>MongoDB on PostgreSQL: DocumentDB with pglayers-azure</title>
      <link>https://pglayers.github.io/blog/2026-08-26-mongodb-on-postgresql-documentdb.html</link>
      <guid>https://pglayers.github.io/blog/2026-08-26-mongodb-on-postgresql-documentdb.html</guid>
      <pubDate>Wed, 26 Aug 2026 00:00:00 +0000</pubDate>
      <dc:creator>Ismaël Mejía &lt;iemejia@gmail.com&gt;</dc:creator>
      <category>PostgreSQL</category>
      <category>Docker</category>
      <category>Containers</category>
      <description>Run the pglayers-azure image, enable the MongoDB-compatible DocumentDB extension, and connect from mongosh or pymongo over the MongoDB wire protocol.</description>
      <content:encoded><![CDATA[
<p>
  <a href="https://github.com/documentdb/documentdb">DocumentDB</a> is a
  MongoDB-compatible document database built on PostgreSQL. It adds the
  <strong>BSON</strong> data type and a full CRUD API to Postgres, and ships a
  gateway that speaks the <strong>MongoDB wire protocol</strong> -- so existing
  MongoDB clients (<code>mongosh</code>, <code>pymongo</code>, the Node.js driver)
  can connect to a PostgreSQL server as if it were MongoDB. It's the same engine
  behind Azure DocumentDB.
</p>

<p>
  DocumentDB is included in the <strong>pglayers-azure</strong> profile image,
  which mirrors the open-source extensions available in Azure Database for
  PostgreSQL. This post walks through running the image and talking to it from a
  MongoDB client end to end -- including a password gotcha that trips people up.
</p>

<h2>1. Start the container</h2>

<p>
  Run the <code>pglayers-azure</code> image, exposing PostgreSQL on 5432 and the
  DocumentDB gateway on <strong>10260</strong> (the port the wire protocol listens
  on):
</p>

<pre><code><span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d --name</span> pglayers-docdb \
  <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">secret</span> \
  <span class="token-option" style="color: #818cf8">-p</span> <span class="token-number" style="color: #3b82f6">5432:5432</span> <span class="token-option" style="color: #818cf8">-p</span> <span class="token-number" style="color: #3b82f6">10260:10260</span> \
  <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-azure:18</span></code></pre>

<p>
  The profile image auto-configures everything at boot: it sets
  <code>shared_preload_libraries</code> (including <code>pg_documentdb_gw_host</code>,
  the gateway worker), appends the required GUCs, and <strong>auto-creates the
  <code>documentdb</code> extension</strong> on first init. Within a second or two
  the log shows <code>TCP listener(s) bound to port 10260</code> and the gateway is
  ready. You don't need to run <code>CREATE EXTENSION</code> yourself.
</p>

<blockquote>
  <p>
    Use <strong>PG 18</strong> (isolated layout) or PG 17. DocumentDB is built only
    for 17 and 18 -- not 19 -- so don't use <code>pglayers-azure:19</code> for this.
  </p>
</blockquote>

<h2>2. Create a MongoDB user</h2>

<p>
  The gateway uses native SCRAM authentication, and its configuration blocks a set
  of role name prefixes (<code>documentdb</code>, <code>citus</code>, <code>pg</code>,
  <code>internal_role</code>). That means you can't reuse the <code>postgres</code>
  superuser -- you need a fresh role with a password.
</p>

<p>
  The intuitive approach is DocumentDB's own
  <code>documentdb_api.create_user()</code> function, but on a stock image it fails:
</p>

<pre><code><span class="token-error" style="color: #f87171">ERROR:</span>  password type is not a plain text
<span class="token-error" style="color: #f87171">CONTEXT:</span>  ... <span class="token-keyword" style="color: #818cf8">CREATE ROLE</span> mongoadmin <span class="token-keyword" style="color: #818cf8">WITH LOGIN PASSWORD</span> <span class="token-string" style="color: #10b981">'SCRAM-SHA-256$...'</span></code></pre>

<p>
  The reason: the server runs with <code>password_encryption = scram-sha-256</code>,
  so <code>create_user()</code> pre-hashes the password, but DocumentDB installs a
  <code>check_password</code> hook that wants the <strong>plaintext</strong> value
  (it builds the SCRAM verifier itself). The two disagree and the call is rejected.
</p>

<p>
  The path that works is a direct <code>CREATE ROLE</code> with a plaintext password,
  granting DocumentDB's built-in roles. The hook then computes the verifier the
  gateway expects:
</p>

<pre><code><span class="token-command" style="color: #f59e0b">docker</span> exec pglayers-docdb <span class="token-command" style="color: #f59e0b">psql</span> <span class="token-option" style="color: #818cf8">-U</span> postgres <span class="token-option" style="color: #818cf8">-c</span> \
  <span class="token-string" style="color: #10b981">"CREATE ROLE mongoadmin WITH LOGIN INHERIT PASSWORD 'Secret_123' \
   IN ROLE documentdb_admin_role, documentdb_readonly_role;"</span></code></pre>

<blockquote>
  <p>
    Upstream's standalone <code>documentdb-local</code> image sidesteps this by taking
    <code>--username</code>/<code>--password</code> at container start and
    bootstrapping the first user itself. In pglayers the gateway runs as a PostgreSQL
    background worker, so you create the user via SQL as above.
  </p>
</blockquote>

<h2>3. Connect from a MongoDB client</h2>

<p>
  The gateway serves TLS with an auto-generated self-signed certificate, so clients
  connect with TLS enabled and certificate validation relaxed. The connection string
  is:
</p>

<pre><code><span class="token-string" style="color: #10b981">mongodb://mongoadmin:Secret_123@localhost:10260/?tls=true&amp;tlsAllowInvalidCertificates=true&amp;authMechanism=SCRAM-SHA-256</span></code></pre>

<p>
  Here's a full round-trip with <code>mongosh</code> (run from a throwaway container
  on the host network) -- insert, filtered find, and an aggregation:
</p>

<pre><code><span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">--rm --network</span> host <span class="token-string" style="color: #10b981">mongodb/mongodb-community-server:latest</span> <span class="token-command" style="color: #f59e0b">mongosh</span> <span class="token-option" style="color: #818cf8">--quiet</span> \
  <span class="token-string" style="color: #10b981">"mongodb://mongoadmin:Secret_123@localhost:10260/?tls=true&amp;tlsAllowInvalidCertificates=true&amp;authMechanism=SCRAM-SHA-256"</span> \
  <span class="token-option" style="color: #818cf8">--eval</span> '<span class="token-keyword" style="color: #818cf8">const</span> db = db.getSiblingDB(<span class="token-string" style="color: #10b981">"shop"</span>);
          db.products.insertMany([{name:<span class="token-string" style="color: #10b981">"Widget"</span>,price:<span class="token-number" style="color: #3b82f6">9.99</span>},{name:<span class="token-string" style="color: #10b981">"Gadget"</span>,price:<span class="token-number" style="color: #3b82f6">19.5</span>}]);
          <span class="token-command" style="color: #f59e0b">printjson</span>(db.products.find({price:{$gte:<span class="token-number" style="color: #3b82f6">10</span>}}).toArray());
          <span class="token-command" style="color: #f59e0b">printjson</span>(db.products.aggregate([{$group:{_id:<span class="token-keyword" style="color: #818cf8">null</span>,avg:{$avg:<span class="token-string" style="color: #10b981">"$price"</span>}}}]).toArray());'</code></pre>

<p>
  This inserts two documents, returns <code>Gadget</code> for the <code>$gte</code>
  filter, and computes an average price of <code>14.745</code>. The exact same URI
  works from <code>pymongo</code> or the Node.js driver:
</p>

<pre><code><span class="token-keyword" style="color: #818cf8">from</span> pymongo <span class="token-keyword" style="color: #818cf8">import</span> MongoClient

client = <span class="token-command" style="color: #f59e0b">MongoClient</span>(
    <span class="token-string" style="color: #10b981">"mongodb://mongoadmin:Secret_123@localhost:10260/"</span>
    <span class="token-string" style="color: #10b981">"?tls=true&amp;tlsAllowInvalidCertificates=true&amp;authMechanism=SCRAM-SHA-256"</span>
)
db = client[<span class="token-string" style="color: #10b981">"shop"</span>]
db.products.insert_one({<span class="token-string" style="color: #10b981">"name"</span>: <span class="token-string" style="color: #10b981">"Sprocket"</span>, <span class="token-string" style="color: #10b981">"price"</span>: <span class="token-number" style="color: #3b82f6">4.5</span>})
<span class="token-command" style="color: #f59e0b">print</span>(db.products.find_one({<span class="token-string" style="color: #10b981">"name"</span>: <span class="token-string" style="color: #10b981">"Sprocket"</span>}))</code></pre>

<p>
  Because it's all PostgreSQL underneath, the same data is queryable from SQL -- for
  example via <code>documentdb_api.count_query('shop', ...)</code> -- so you can mix
  document workloads and relational queries against one database.
</p>

<h2>Production notes</h2>

<ul>
  <li><strong>TLS.</strong> <code>tlsAllowInvalidCertificates=true</code> is only
    appropriate for the bundled self-signed certificate. For production, mount your
    own certificate and a custom <code>/etc/documentdb/gateway_config.json</code> to
    set the port, TLS mode, and blocked role prefixes.</li>
  <li><strong>PostgreSQL version.</strong> Stick to PG 17 or 18; DocumentDB isn't
    built for 19 yet.</li>
  <li><strong>Auto-created extensions.</strong> The gateway needs the
    <code>documentdb</code> extension to exist, which the profile image creates for
    you on first init. To opt out, set <code>PGLAYERS_CREATE_EXTENSIONS=none</code>.</li>
</ul>

<h2>Try it</h2>

<p>
  Everything above is a single <code>docker run</code> plus one <code>CREATE ROLE</code>
  away. Pull the image and connect your favorite MongoDB client:
</p>

<pre><code><span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d -p</span> <span class="token-number" style="color: #3b82f6">5432:5432</span> <span class="token-option" style="color: #818cf8">-p</span> <span class="token-number" style="color: #3b82f6">10260:10260</span> \
  <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">secret</span> \
  <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-azure:18</span></code></pre>

<p>
  See the <a href="https://github.com/pglayers/pglayers">pglayers repository</a>
  for the full extension list and profile documentation, and the
  <a href="https://github.com/documentdb/documentdb">DocumentDB project</a> for the
  supported MongoDB API surface.
</p>
]]></content:encoded>
    </item>

    <item>
      <title>Introducing pglayers</title>
      <link>https://pglayers.github.io/blog/2026-07-05-introducing-pglayers.html</link>
      <guid>https://pglayers.github.io/blog/2026-07-05-introducing-pglayers.html</guid>
      <pubDate>Sun, 09 Aug 2026 00:00:00 +0000</pubDate>
      <dc:creator>Ismaël Mejía &lt;iemejia@gmail.com&gt;</dc:creator>
      <category>PostgreSQL</category>
      <category>Docker</category>
      <category>Containers</category>
      <description>50+ pre-built PostgreSQL extensions as stackable Docker layers. No compilation, no third-party images -- just COPY --from and go.</description>
      <content:encoded><![CDATA[
<p>
  The <a href="https://hub.docker.com/_/postgres">official PostgreSQL Docker images</a>
  are great -- they're well-maintained, secure, and reliable. But they ship
  with almost no extensions. If you need <strong>pgvector</strong> for AI embeddings,
  <strong>PostGIS</strong> for geospatial queries, or <strong>pg_cron</strong> for
  scheduled jobs, you're on your own: installing compilers, resolving
  dependencies, building from source, or trusting a third-party image that
  bundles a fixed set you can't change.
</p>

<p>
  <strong>pglayers</strong> fixes this. It gives you 50+ pre-built PostgreSQL
  extensions as stackable Docker image layers. You add one line per extension
  to your Dockerfile -- no compilation, no package managers, no build tools.
</p>

<h2>The problem</h2>

<p>
  Suppose you want PostgreSQL with pgvector and pg_cron. Today your options are:
</p>

<ol>
  <li><strong>Build from source.</strong> Install <code>build-essential</code>,
    <code>postgresql-server-dev-17</code>, clone the repos, run
    <code>make install</code>. Repeat every time you upgrade. Slow, fragile,
    and bloats your image with compilers you don't need at runtime.</li>
  <li><strong>Use a third-party image.</strong> Someone else built an image with
    a particular set of extensions. Maybe it includes what you need, maybe it
    doesn't. You lose control over the base image, update schedule, and
    security patches.</li>
  <li><strong>PGDG packages.</strong> Install from <code>apt.postgresql.org</code>.
    Works, but the package manager pulls transitive dependencies, and you're
    mixing package management with Docker layer caching in ways that complicate
    reproducibility.</li>
</ol>

<p>
  None of these compose well. If you need pgvector <em>and</em> PostGIS
  <em>and</em> TimescaleDB <em>and</em> pg_cron, each approach compounds its
  complexity.
</p>

<h2>How pglayers works</h2>

<p>
  Each extension is published as a minimal Docker image (built <code>FROM scratch</code>)
  containing only the extension's compiled binaries: the <code>.so</code> shared
  library, the <code>.control</code> file, and the SQL migration scripts. These
  files are laid out at exactly the paths PostgreSQL expects:
</p>

<pre><code><span class="token-path" style="color: #10b981">/usr/lib/postgresql/17/lib/vector.so</span>
<span class="token-path" style="color: #10b981">/usr/share/postgresql/17/extension/vector.control</span>
<span class="token-path" style="color: #10b981">/usr/share/postgresql/17/extension/vector--0.8.3.sql</span></code></pre>

<p>
  To use them, you write a standard multi-stage <code>COPY --from</code> in your
  Dockerfile:
</p>

<pre><code><span class="token-keyword" style="color: #818cf8">FROM</span> <span class="token-string" style="color: #10b981">postgres:17</span>

<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-pgvector:17</span>  / /
<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-pg_cron:17</span>   / /
<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-postgis:17</span>   / /</code></pre>

<p>
  That's it. Docker pulls the pre-built layers from the registry and overlays
  them onto the official image. No compilation happens at build time -- it's
  just file copies. The result is a single image with exactly the extensions
  you chose.
</p>

<p>Then you can <code>CREATE EXTENSION</code> as usual:</p>

<pre><code><span class="token-keyword" style="color: #818cf8">CREATE EXTENSION IF NOT EXISTS</span> vector;
<span class="token-keyword" style="color: #818cf8">CREATE EXTENSION IF NOT EXISTS</span> pg_cron;
<span class="token-keyword" style="color: #818cf8">CREATE EXTENSION IF NOT EXISTS</span> postgis;</code></pre>

<h2>Ready-to-use profile images</h2>

<p>
  If you don't want to pick individual extensions, pglayers provides pre-built
  combined images called <strong>profiles</strong>:
</p>

<pre><code><span class="token-comment" style="color: #8888a0"># All 50+ extensions, pre-configured</span>
<span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d -e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">secret</span> <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-full:17</span>

<span class="token-comment" style="color: #8888a0"># Extensions matching Azure Database for PostgreSQL</span>
<span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d -e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">secret</span> <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-azure:17</span></code></pre>

<p>
  Profile images come with <code>shared_preload_libraries</code> already
  configured, companion processes started (like pg_lake's DuckDB backend),
  and all the GUC settings extensions need. Just <code>docker run</code> and
  you have a fully-loaded PostgreSQL instance.
</p>

<p>
  The <strong>azure</strong> profile also includes <strong>DocumentDB</strong>,
  which provides MongoDB wire protocol compatibility on port 10260. MongoDB
  clients (mongosh, pymongo, the Node.js driver) connect directly -- same
  engine as Azure DocumentDB.
</p>

<h2>What's included</h2>

<p>
  pglayers ships 53 extensions across PostgreSQL 17, 18, and 19. A few
  highlights:
</p>

<ul>
  <li><strong>pgvector + pgvectorscale</strong> -- vector similarity search for
    AI/ML embeddings, with high-performance DiskANN indexing</li>
  <li><strong>PostGIS + pgRouting</strong> -- the full geospatial stack
    (geometry, geography, raster, routing)</li>
  <li><strong>TimescaleDB</strong> -- hypertables, compression, and continuous
    aggregates for time-series data</li>
  <li><strong>pg_cron</strong> -- cron-like job scheduler running inside the
    database</li>
  <li><strong>DocumentDB</strong> -- MongoDB-compatible document engine with
    wire protocol support</li>
  <li><strong>pg_lake</strong> -- query Iceberg tables and data lake files
    (Parquet, CSV, JSON) directly from PostgreSQL</li>
  <li><strong>pg_duckdb</strong> -- DuckDB's columnar analytics engine embedded
    in Postgres for OLAP workloads</li>
  <li><strong>Apache AGE</strong> -- graph database with openCypher query
    support</li>
</ul>

<p>
  All images are multi-architecture (linux/amd64 and linux/arm64), so Docker
  automatically pulls the right binary for your platform -- whether you're on
  an M-series Mac or an x86 CI runner.
</p>

<h2>Quality guarantees</h2>

<p>
  Every extension goes through a CI pipeline that checks:
</p>

<ul>
  <li><strong>No file collisions</strong> -- extension pairs are compared to
    ensure they don't overwrite each other's files</li>
  <li><strong>No base image overwrites</strong> -- extensions never replace
    files from the official postgres image</li>
  <li><strong>Shared library resolution</strong> -- <code>ldd</code> verifies
    all transitive dependencies are present</li>
  <li><strong>CREATE EXTENSION</strong> -- every extension loads successfully</li>
  <li><strong>Functional smoke tests</strong> -- each extension is exercised
    with real queries, not just loaded</li>
</ul>

<h2>Getting started</h2>

<p>
  The fastest way to try pglayers is the full profile image:
</p>

<pre><code><span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d -p</span> <span class="token-number" style="color: #3b82f6">5432:5432</span> <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">secret</span> \
  <span class="token-string" style="color: #10b981">ghcr.io/pglayers/pglayers-full:17</span></code></pre>

<p>
  Then connect and enable any extension:
</p>

<pre><code><span class="token-command" style="color: #f59e0b">psql</span> <span class="token-option" style="color: #818cf8">-h</span> localhost <span class="token-option" style="color: #818cf8">-U</span> postgres
<span class="token-keyword" style="color: #818cf8">CREATE EXTENSION</span> vector;
<span class="token-keyword" style="color: #818cf8">CREATE EXTENSION</span> postgis;
<span class="token-keyword" style="color: #818cf8">SELECT</span> <span class="token-string" style="color: #10b981">'[1,2,3]'</span>::vector <span class="token-operator" style="color: #818cf8">&lt;-&gt;</span> <span class="token-string" style="color: #10b981">'[4,5,6]'</span>::vector <span class="token-keyword" style="color: #818cf8">AS</span> distance;</code></pre>

<p>
  To build a custom image with only the extensions you need, create a
  Dockerfile:
</p>

<pre><code><span class="token-keyword" style="color: #818cf8">FROM</span> <span class="token-string" style="color: #10b981">postgres:17</span>

<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-pgvector:17</span>       / /
<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-timescaledb:17</span>    / /
<span class="token-keyword" style="color: #818cf8">COPY</span> <span class="token-option" style="color: #818cf8">--from=</span><span class="token-string" style="color: #10b981">ghcr.io/pglayers/pgx-pg_cron:17</span>        / /

<span class="token-keyword" style="color: #818cf8">RUN</span> <span class="token-command" style="color: #f59e0b">echo</span> <span class="token-string" style="color: #10b981">"shared_preload_libraries = 'timescaledb,pg_cron'"</span> \
    &gt;&gt; /usr/share/postgresql/postgresql.conf.sample</code></pre>

<p>
  Build and run:
</p>

<pre><code><span class="token-command" style="color: #f59e0b">docker</span> build <span class="token-option" style="color: #818cf8">-t</span> my-postgres .
<span class="token-command" style="color: #f59e0b">docker</span> run <span class="token-option" style="color: #818cf8">-d -p</span> <span class="token-number" style="color: #3b82f6">5432:5432</span> <span class="token-option" style="color: #818cf8">-e</span> POSTGRES_PASSWORD=<span class="token-string" style="color: #10b981">secret</span> my-postgres</code></pre>

<h2>Open source</h2>

<p>
  pglayers is MIT licensed and hosted on GitHub. The project welcomes
  contributions -- whether that's adding a new extension, improving tests, or
  reporting issues.
</p>

<p>
  <a href="https://github.com/pglayers/pglayers">github.com/pglayers/pglayers</a>
</p>

<blockquote>
  <p>
    pglayers stands on the shoulders of the PostgreSQL community: the
    PostgreSQL Global Development Group, the PGDG APT repository maintainers,
    the official Docker image maintainers, and every extension author who
    releases their work under permissive open-source licenses.
  </p>
</blockquote>
]]></content:encoded>
    </item>
  </channel>
</rss>
