Re: Pluggable Storage - Andres's take

From: Andres Freund <andres(at)anarazel(dot)de>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Peter Geoghegan <pg(at)bowt(dot)ie>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pluggable Storage - Andres's take
Date: 2019-01-12 00:44:40
Message-ID: 20190112004440.u6xbdpesetwjohxh@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hi,

On 2019-01-12 01:35:06 +0100, Dmitry Dolgov wrote:
> > On Sat, Dec 15, 2018 at 8:37 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> >
> > We need to dump the table access method at dump time, otherwise we loose
> > that information.
>
> As a result of the discussion in [1] (btw, thanks for starting it), here is
> proposed solution with tracking current default_table_access_method. Next I'll
> tackle similar issue for psql and probably add some tests for both patches.

Thanks!

> +/*
> + * Set the proper default_table_access_method value for the table.
> + */
> +static void
> +_selectTableAccessMethod(ArchiveHandle *AH, const char *tableam)
> +{
> + PQExpBuffer cmd = createPQExpBuffer();
> + const char *want, *have;
> +
> + have = AH->currTableAm;
> + want = tableam;
> +
> + if (!want)
> + return;
> +
> + if (have && strcmp(want, have) == 0)
> + return;
> +
> +
> + appendPQExpBuffer(cmd, "SET default_table_access_method = %s;", tableam);

This needs escaping, at the very least with "", but better with proper
routines for dealing with identifiers.

> @@ -5914,7 +5922,7 @@ getTables(Archive *fout, int *numTables)
> "tc.relfrozenxid AS tfrozenxid, "
> "tc.relminmxid AS tminmxid, "
> "c.relpersistence, c.relispopulated, "
> - "c.relreplident, c.relpages, "
> + "c.relreplident, c.relpages, am.amname AS amname, "

That AS doesn't do anything, does it?

> /* other fields were zeroed above */
>
> @@ -9355,7 +9370,7 @@ dumpComment(Archive *fout, const char *type, const char *name,
> * post-data.
> */
> ArchiveEntry(fout, nilCatalogId, createDumpId(),
> - tag->data, namespace, NULL, owner,
> + tag->data, namespace, NULL, owner, NULL,
> "COMMENT", SECTION_NONE,
> query->data, "", NULL,
> &(dumpId), 1,

We really ought to move the arguments to a struct, so we don't generate
quite as much useless diffs whenever we do a change around one of
these...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-01-12 01:12:13 Re: Remove all "INTERFACE ROUTINES" style comments
Previous Message Donald Dong 2019-01-12 00:39:04 Re: Unified logging system for command-line programs