MCPcopy Create free account
hub / github.com/apache/cloudberry / formatPGVersionNumber

Function formatPGVersionNumber

src/fe_utils/string_utils.c:323–348  ·  view source on GitHub ↗

* Format a Postgres version number (in the PG_VERSION_NUM integer format * returned by PQserverVersion()) as a string. This exists mainly to * encapsulate knowledge about two-part vs. three-part version numbers. * * For reentrancy, caller must supply the buffer the string is put in. * Recommended size of the buffer is 32 bytes. * * Returns address of 'buf', as a notational convenience. */

Source from the content-addressed store, hash-verified

321 * Returns address of 'buf', as a notational convenience.
322 */
323char *
324formatPGVersionNumber(int version_number, bool include_minor,
325 char *buf, size_t buflen)
326{
327 if (version_number >= 100000)
328 {
329 /* New two-part style */
330 if (include_minor)
331 snprintf(buf, buflen, "%d.%d", version_number / 10000,
332 version_number % 10000);
333 else
334 snprintf(buf, buflen, "%d", version_number / 10000);
335 }
336 else
337 {
338 /* Old three-part style */
339 if (include_minor)
340 snprintf(buf, buflen, "%d.%d.%d", version_number / 10000,
341 (version_number / 100) % 100,
342 version_number % 100);
343 else
344 snprintf(buf, buflen, "%d.%d", version_number / 10000,
345 (version_number / 100) % 100);
346 }
347 return buf;
348}
349
350
351/*

Callers 15

describeAccessMethodsFunction · 0.85
describeTablespacesFunction · 0.85
describeFunctionsFunction · 0.85
listDefaultACLsFunction · 0.85
listDbRoleSettingsFunction · 0.85
listPartitionedTablesFunction · 0.85
listExtendedStatsFunction · 0.85
listCollationsFunction · 0.85
listTSParsersFunction · 0.85
listTSDictionariesFunction · 0.85
listTSTemplatesFunction · 0.85
listTSConfigsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected