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

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: michael(at)qedcode(dot)com
Subject: 9.4. String Functions and Operators page does not document that encode adds line breaks
Date: 2020-02-08 16:17:05
Message-ID: 158117862544.1089.17282036641192025921@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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.

By the way, this is a very poor design decision. The function has no
knowledge of how the string is going to be used. If it is going to be
displayed on an 80-character terminal, then the newline makes sense. If it
is going to be written to a PEM-encoded file, then the newline is to be
expected. But I'm inserting the result into a VARCHAR(88) column and
comparing with base-64 encoded strings from Node.js. There is no reason for
the results to be terminal or file friendly. Instead, they should be machine
friendly. The decision to add newlines should have been made on display or
on creation of the PEM file, where that information becomes available. The
workaround of trimming whitespace characters from the encoded string is ugly
and unacceptable.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2020-02-08 20:07:30 Re: 9.4. String Functions and Operators page does not document that encode adds line breaks
Previous Message PG Doc comments form 2020-02-07 21:26:17 create extension requires superuser?