Re: string_to_array, array_to_string function without separator

From: David Fetter <david(at)fetter(dot)org>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: string_to_array, array_to_string function without separator
Date: 2019-03-16 01:18:23
Message-ID: 20190316011823.GN10435@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 15, 2019 at 12:31:21PM -0400, Chapman Flack wrote:
> On 3/15/19 12:15 PM, Tom Lane wrote:
> > Chapman Flack <chap(at)anastigmatix(dot)net> writes:
> >> So the proposal seems roughly equivalent to making string_to_array's
> >> second parameter optional default null, and array_to_string's second
> >> parameter optional default ''.
> >
> > In that case why bother? It'll just create a cross-version compatibility
> > hazard for next-to-no keystroke savings. If the cases were so common
> > that they could be argued to be sane "default" behavior, I might feel
> > differently --- but if you were asked in a vacuum what the default
> > delimiters ought to be, I don't think you'd say "no delimiter".
>
> One could go further and argue that the non-optional arguments improve
> clarity: a reader seeing the explicit NULL or '' argument gets a strong
> clue what's intended, who in the optional-argument case might end up
> thinking "must go look up what this function's default delimiter is".

Going to look up the function's behavior would be much more fun if
there were comments on these functions explaining things. I'll draft
up a patch for some of that.

In a similar vein, I haven't been able to come up with hazards of
naming function parameters in some document-ish way. What did I miss?

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-03-16 01:20:03 Re: Lifespan of a BeginInternalSubTransaction subxact ?
Previous Message Chapman Flack 2019-03-16 01:06:22 Lifespan of a BeginInternalSubTransaction subxact ?