Re: [PATCH] Rename "getdatabaseencoding()" to "pg_database_encoding()", and document

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Rename "getdatabaseencoding()" to "pg_database_encoding()", and document
Date: 2026-07-18 05:04:52
Message-ID: CAB8KJ=ij+pznQGub=DkyJuKL=tC=Q=07qSahTyw7TLb0DdNJsg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2026年7月17日(金) 23:29 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> >> On 17 Jul 2026, at 08:44, Ian Lawrence Barwick <barwick(at)gmail(dot)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.
>
> Yeah, the odds that we would remove the old name (without a multi-year
> deprecation period) are zero, full stop.
>
> However, I can't really get excited about this proposal in the first
> place. There are plenty of ugly and inconsistent names in Postgres,
> and an enormous amount of more-valuable work to do.

Makes sense.

Here's a patch to at least document it, in the table "Other String
Functions and Operators"
(as "pg_client_encoding()" is already there).

Regards

Ian Barwick

Attachment Content-Type Size
v1-0001-Document-getdatabaseencoding.patch text/x-patch 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-07-18 06:40:10 Re: REASSIGN OWNED vs. relisshared dep on !relisshared
Previous Message Kenny Chen 2026-07-18 04:20:09 Fix LSN format in REPACK worker debug message