Re: Where to save data used by extension ?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Hao Wu <hawu(at)pivotal(dot)io>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Where to save data used by extension ?
Date: 2018-12-14 08:25:07
Message-ID: bb0a8d89d2e32494ef3a5184fc918abd950b9cbe.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hao Wu wrote:
> I have an extension for postgresql. The extension works across some databases, and needs to save some data.
> The data might be modified dynamically by the extension, and all the changed result must be saved. I have considered some methods.
> 1. Use GUC
> I find no easy way to write the GUC values back to postgres.conf. And the data might be a bit complex
> 2. Create a table under a special database, like postgres
> The weak is the strong assumption that the database postgres does exist and will not be dropped.
> 3. Create a table under a database created by the extension
> A little heavy, but without dependencies.
> 4. Write to a native file.
> The file can not sync to a standby
>
> Currently, I use #2. Is there any better way to do this?

Only 2 and 3 are feasible.

Since extensions have a schema, and the database is the best place to persist
data for a database extension, I'd use a table in the extension schema, so I'd
go for 3.

Why is that heavier than 2?

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-12-14 08:53:54 Re: alternative to PG_CATCH
Previous Message Peter Eisentraut 2018-12-14 08:24:50 Re: Upgrading pg_statistic to handle collation honestly