Re: [PATCH] Store Extension Options

From: Jim Nasby <jim(at)nasby(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Fabrizio Mello <fabriziomello(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Store Extension Options
Date: 2014-01-07 00:40:44
Message-ID: 52CB4D0C.7030006@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/4/14, 12:00 PM, Tom Lane wrote:
> If you have some settings that need to be table-specific, then
> I agree that the reloptions infrastructure is a nice place to track them.
> What's actually missing here is some compelling examples of such settings
> for plausible extensions.

I've got a real world example.

At work we use limited dumps of production to support development. We do a schema dump and then grab data out of certain "seed" tables. To mark tables as being seed, we have to store that info in a table, but that gets us into another problem: what if a table gets renamed?

In order to solve that problem, we created a tables table:

CREATE TABLE tools.tables( id SERIAL PRIMARY KEY, table_schema text, table_name text );

That way if we need to rename a table we update one record in one place instead of a bunch of places (we have other code that makes use of tools.tables). (And no, we can't use OIDs because they're not immutable between dumps).

This is obviously ugly and fragile. It'd be much better if we could just define a custom setting on the table itself that says "hey, dump the data from here!". (FWIW, same applies to sequnces).

Actually, I just checked and our seed object stuff doesn't use tools.tables, but our inheritance framework and a change notification system we wrote does. Those are other examples of where we need to store additional information about a table and had to create a system of our own to handle it.
--
Jim C. Nasby, Data Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-01-07 00:50:42 Re: truncating pg_multixact/members
Previous Message Alvaro Herrera 2014-01-07 00:35:22 Re: dynamic shared memory and locks