Re: Schema version management - Mailing list pgsql-hackers

From Christopher Browne
Subject Re: Schema version management
Date
Msg-id CAFNqd5UU=KbK5Bqd737b=FihJ2oV50tg1x3p+Lpasq1UsCuhiA@mail.gmail.com
Whole thread Raw
In response to Re: Schema version management  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Schema version management
List pgsql-hackers
On Thu, Jul 5, 2012 at 11:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alvaro Herrera <alvherre@commandprompt.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?"


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Schema version management
Next
From: Robert Haas
Date:
Subject: Re: Event Triggers reduced, v1