Re: [PATCH] Implement motd for PostgreSQL

Joel Jacobson <joel@compiler.org>

From: "Joel Jacobson" <joel@compiler.org>
To: "Fabien COELHO" <coelho@cri.ensmp.fr>
Cc: "PostgreSQL Developers" <pgsql-hackers@lists.postgresql.org>, "Michael Paquier" <michael@paquier.xyz>
Date: 2021-04-03T09:54:56Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Disallow newlines in parameter values to be set in ALTER SYSTEM.

On Sat, Apr 3, 2021, at 10:14, Fabien COELHO wrote:
> 
> Hello Joel,
> 
> > This patch is one day late, my apologies for missing the deadline this year.
> >
> > PostgreSQL has since long been suffering from the lack of a proper UNIX style motd (message of the day).
> 
> My 0.02€: apart from the Fool's day joke dimension, I'd admit that I would 
> not mind actually having such a fun feature in pg, possibly disabled by 
> default.

Fun to hear you find it useful.
I'm actually using it myself in production for something, to display instructions to users when they login.

When implementing this I stumbled upon newlines can't be used in ALTER SYSTEM parameter values.

I see they were disallowed in commit 99f3b5613bd1f145b5dbbe86000337bbe37fb094

However, reading escaped newlines seems to be working just fine.
The commit message from 2016 seems to imply otherwise:

"the configuration-file parser doesn't support embedded newlines in string literals"

The first patch, 0001-quote-newlines.patch, fixes the part of escaping newlines
before they are written to the configuration file.

Perhaps the configuration-file parser has been fixed since to support embedded newlines?
If so, then maybe it would actually be an idea to support newlines by escaping them?
Especially since newlines are supported by set_config().

/Joel