pgsql: Add support for base64url encoding and decoding

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add support for base64url encoding and decoding
Date: 2025-09-20 21:24:31
Message-ID: E1v054I-001heo-1e@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Add support for base64url encoding and decoding

This adds support for base64url encoding and decoding, a base64
variant which is safe to use in filenames and URLs. base64url
replaces '+' in the base64 alphabet with '-' and '/' with '_',
thus making it safe for URL addresses and file systems.

Support for base64url was originally suggested by Przemysław Sztoch.

Author: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
Reviewed-by: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Reviewed-by: David E. Wheeler <david(at)justatheory(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Reviewed-by: Chao Li (Evan) <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/70f2b6a8-486a-4fdb-a951-84cef35e22ab@sztoch.pl

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e1d917182c1953b16b32a39ed2fe38e3d0823047

Modified Files
--------------
doc/src/sgml/func/func-binarystring.sgml | 19 ++++
src/backend/utils/adt/encode.c | 157 ++++++++++++++++++++++++++-----
src/test/regress/expected/strings.out | 150 +++++++++++++++++++++++++++++
src/test/regress/sql/strings.sql | 54 +++++++++++
4 files changed, 359 insertions(+), 21 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-09-21 23:03:57 pgsql: Fix meson build with -Duuid=ossp when using version older than 0
Previous Message Tom Lane 2025-09-20 18:48:23 pgsql: Track the maximum possible frequency of non-MCE array elements.

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Wienhold 2025-09-20 21:58:54 Re: psql: Count all table footer lines in pager setup
Previous Message Tom Lane 2025-09-20 21:21:19 Re: allow benign typedef redefinitions (C11)