Re: 9.4. String Functions and Operators page does not document that encode adds line breaks

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: michael(at)qedcode(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: 9.4. String Functions and Operators page does not document that encode adds line breaks
Date: 2020-02-08 20:07:30
Message-ID: CAKFQuwZg+_ewLpnjKDXRqJJWaGJ1Hf8k1Mxx9k4EBRXOjw2p4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sat, Feb 8, 2020 at 12:10 PM PG Doc comments form <noreply(at)postgresql(dot)org>
wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/12/functions-string.html
> Description:
>
> It took me a long time to discover why a base 64 encoded SHA-512 hash was
> 89
> characters long instead of the expected 88. The documentation does not
> mention that the encode function inserts newlines after 76 characters.
> Please make a note of this behavior.
>

Patch submissions are welcomed. Though there is an argument for this being
an implementation detail one shouldn't rely upon and therefore should not
be described in user-facing documentation.

> By the way, this is a very poor design decision.

It seems to be something we inherited some 20 years ago and are not likely
to change even though I suspect you will find general agreement with your
position. Though since its isn't documented maybe changing it would be ok.

The workaround of trimming whitespace characters from the encoded string is
> ugly
> and unacceptable.
>

It may be a bit ugly but when dealing with base64, specifically when
decoding, whitespace of this nature is expressly allowed. Its historical
presence here, based upon MIME requirements prevalent at the time the code
was written, doesn't alter its meaning and so it somewhat rightfully
considered an implementation detail that is not necessary to document.

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2020-02-08 20:32:12 Re: Lack of detailed documentation
Previous Message PG Doc comments form 2020-02-08 16:17:05 9.4. String Functions and Operators page does not document that encode adds line breaks