Re: Schema version management

From: Christopher Browne <cbbrowne(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Schema version management
Date: 2012-07-05 16:10:09
Message-ID: CAFNqd5UU=KbK5Bqd737b=FihJ2oV50tg1x3p+Lpasq1UsCuhiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 5, 2012 at 11:59 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>> Excerpts from Michael Glaesemann's message of jue jul 05 11:36:51 -0400 2012:
>>> If we're dumping objects (tables, views, functions, what-have-you) into separate files,
>>> each of these functions is a separate object and should be in its own file.
>
>> Clearly there is no consensus here.
>
> FWIW, I'm attracted to the all-similarly-named-functions-together
> method, mainly because it dodges the problem of how to encode a
> function's argument list into a filename. However, we're being
> short-sighted to only think of functions here. What about operators?
> Or casts? Those don't have simple names either.

If you stow them all together, that still leaves a question as to
whether or not they get stored in a deterministic order.

I was recently working on something of the same issue as part of a
schema differencing tool. It was pointedly *not* sufficient to use
the internal name (e.g. - information_schema.routines.specific_name),
as I wanted to compare things between databases, and it's pretty
certain that oids will differ.

I wound up expanding the function arguments and using function + args
as the name. That leads to a risk of rather long names for functions,
but there aren't many other ways possible.

Note that pg_autodoc <http://www.rbt.ca/autodoc/> takes a similar
approach; it attaches function labels based on function + args.

Here's an expanded example in the Slony docs:
<http://slony.info/documentation/2.1/function.ddlscript-prepare-int-p-only-on-node-integer-p-set-id-integer.html>

I wouldn't mind stowing functions together in one file, and I'd
actually not get too bent out of shape if the order was somewhat
nondeterministic. But something like the autodoc naming seems like
the unambiguous answer. Long, but unambiguous...
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-07-05 16:10:36 Re: Event Triggers reduced, v1
Previous Message Tom Lane 2012-07-05 16:09:10 Re: Schema version management