Re: [PATCH] Rename "getdatabaseencoding()" to "pg_database_encoding()", and document - Mailing list pgsql-hackers

From Thom Brown
Subject Re: [PATCH] Rename "getdatabaseencoding()" to "pg_database_encoding()", and document
Date
Msg-id CAA-aLv4EaKygRp5pRFgNK6wRJ+u=zx5BrTQhrVa_QZoO_nr2-A@mail.gmail.com
Whole thread
In response to Re: [PATCH] Rename "getdatabaseencoding()" to "pg_database_encoding()", and document  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Fri, 17 Jul 2026, 08:24 Daniel Gustafsson, <daniel@yesql.se> wrote:
> On 17 Jul 2026, at 08:44, Ian Lawrence Barwick <barwick@gmail.com> wrote:

> It was noted here [1] that we have the undocumented SQL function
> "getdatabaseencoding()", used mainly in regression tests and a couple
> of psql queries. While considering a documentation patch, it occurred
> to me that it's a horrible function name which doesn't look like other
> public functions, and we already have "pg_client_encoding()", so why not
> rename it to match that while we're at it?

This function seems to be referred to in extensions, how about adding keeping
the existin name and adding the new name as an alias?  It would keep existing
code from breaking and cause less churn in the code.

Why don't extensions use current_setting('server_encoding')?

Thom

pgsql-hackers by date:

Previous
From: wenhui qiu
Date:
Subject: Re: PGLZ Compression Optimization
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: PG20 Minimum Dependency Thread