pg_collation_actual_version() -> pg_collation_current_version().

The new name seems a bit more natural.

Discussion: https://postgr.es/m/20210117215940.GE8560%40telsasoft.com
This commit is contained in:
Thomas Munro 2021-02-22 23:02:52 +13:00
parent 0fb0a0503b
commit 9cf184cc05
7 changed files with 21 additions and 21 deletions

View File

@ -26227,14 +26227,14 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup());
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_collation_actual_version</primary>
<primary>pg_collation_current_version</primary>
</indexterm>
<function>pg_collation_actual_version</function> ( <type>oid</type> )
<function>pg_collation_current_version</function> ( <type>oid</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Returns the actual version of the collation object as it is currently
installed in the operating system. <literal>null</literal> is returned
Returns the version of the collation object as reported by the ICU
library or operating system. <literal>null</literal> is returned
on operating systems where <productname>PostgreSQL</productname>
doesn't have support for versions.
</para></entry>

View File

@ -268,7 +268,7 @@ IsThereCollationInNamespace(const char *collname, Oid nspOid)
}
Datum
pg_collation_actual_version(PG_FUNCTION_ARGS)
pg_collation_current_version(PG_FUNCTION_ARGS)
{
Oid collid = PG_GETARG_OID(0);
char *version;

View File

@ -127,8 +127,8 @@ static char *IsoLocaleName(const char *); /* MSVC specific */
static void icu_set_collation_attributes(UCollator *collator, const char *loc);
#endif
static char *get_collation_actual_version(char collprovider,
const char *collcollate);
static char *get_collation_current_version(char collprovider,
const char *collcollate);
/*
* pg_perm_setlocale
@ -1610,7 +1610,7 @@ pg_newlocale_from_collation(Oid collid)
* the operating system/library.
*/
static char *
get_collation_actual_version(char collprovider, const char *collcollate)
get_collation_current_version(char collprovider, const char *collcollate)
{
char *collversion = NULL;
@ -1743,8 +1743,8 @@ get_collation_version_for_oid(Oid oid, bool missing_ok)
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dbform = (Form_pg_database) GETSTRUCT(tp);
version = get_collation_actual_version(COLLPROVIDER_LIBC,
NameStr(dbform->datcollate));
version = get_collation_current_version(COLLPROVIDER_LIBC,
NameStr(dbform->datcollate));
}
else
{
@ -1758,8 +1758,8 @@ get_collation_version_for_oid(Oid oid, bool missing_ok)
elog(ERROR, "cache lookup failed for collation %u", oid);
}
collform = (Form_pg_collation) GETSTRUCT(tp);
version = get_collation_actual_version(collform->collprovider,
NameStr(collform->collcollate));
version = get_collation_current_version(collform->collprovider,
NameStr(collform->collcollate));
}
ReleaseSysCache(tp);

View File

@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202102191
#define CATALOG_VERSION_NO 202102221
#endif

View File

@ -11321,9 +11321,9 @@
{ oid => '3448',
descr => 'get actual version of collation from operating system',
proname => 'pg_collation_actual_version', procost => '100',
proname => 'pg_collation_current_version', procost => '100',
provolatile => 'v', prorettype => 'text', proargtypes => 'oid',
prosrc => 'pg_collation_actual_version' },
prosrc => 'pg_collation_current_version' },
# system management/monitoring related functions
{ oid => '3353', descr => 'list files in the log directory',

View File

@ -2018,7 +2018,7 @@ SELECT objid::regclass::text collate "C", refobjid::regcollation::text collate "
CASE
WHEN refobjid = 'default'::regcollation THEN 'XXX' -- depends on libc version support
WHEN refobjversion IS NULL THEN 'version not tracked'
WHEN refobjversion = pg_collation_actual_version(refobjid) THEN 'up to date'
WHEN refobjversion = pg_collation_current_version(refobjid) THEN 'up to date'
ELSE 'out of date'
END AS version
FROM pg_depend d
@ -2156,14 +2156,14 @@ RESET client_min_messages;
-- leave a collation for pg_upgrade test
CREATE COLLATION coll_icu_upgrade FROM "und-x-icu";
-- Test user-visible function for inspecting versions
SELECT pg_collation_actual_version('"en-x-icu"'::regcollation) is not null;
SELECT pg_collation_current_version('"en-x-icu"'::regcollation) is not null;
?column?
----------
t
(1 row)
-- Invalid OIDs are silently ignored
SELECT pg_collation_actual_version(0) is null;
SELECT pg_collation_current_version(0) is null;
?column?
----------
t

View File

@ -820,7 +820,7 @@ SELECT objid::regclass::text collate "C", refobjid::regcollation::text collate "
CASE
WHEN refobjid = 'default'::regcollation THEN 'XXX' -- depends on libc version support
WHEN refobjversion IS NULL THEN 'version not tracked'
WHEN refobjversion = pg_collation_actual_version(refobjid) THEN 'up to date'
WHEN refobjversion = pg_collation_current_version(refobjid) THEN 'up to date'
ELSE 'out of date'
END AS version
FROM pg_depend d
@ -885,6 +885,6 @@ RESET client_min_messages;
CREATE COLLATION coll_icu_upgrade FROM "und-x-icu";
-- Test user-visible function for inspecting versions
SELECT pg_collation_actual_version('"en-x-icu"'::regcollation) is not null;
SELECT pg_collation_current_version('"en-x-icu"'::regcollation) is not null;
-- Invalid OIDs are silently ignored
SELECT pg_collation_actual_version(0) is null;
SELECT pg_collation_current_version(0) is null;