pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: michael@qedcode.com
Subject: 9.4. String Functions and Operators page does not document that encode adds line breaks
Date: Sat, 08 Feb 2020 16:17:05 +0000
Message-ID: <158117862544.1089.17282036641192025921@wrigleys.postgresql.org> (raw)

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.


view thread (6+ messages)  latest in thread

Message-ID: <158117862544.1089.17282036641192025921@wrigleys.postgresql.org>
Permalink:  ../158117862544.1089.17282036641192025921@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/158117862544.1089.17282036641192025921@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, michael@qedcode.com
  Subject: Re: 9.4. String Functions and Operators page does not document that encode adds line breaks
  In-Reply-To: <158117862544.1089.17282036641192025921@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox