mirror of https://github.com/citusdata/citus.git
Fixes pg 14 compile warnings
parent
72874a8623
commit
569f4db60c
|
@ -451,8 +451,10 @@ typedef struct DatabaseCollationInfo
|
||||||
{
|
{
|
||||||
char *collation;
|
char *collation;
|
||||||
char *ctype;
|
char *ctype;
|
||||||
|
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||||
char *icu_locale;
|
char *icu_locale;
|
||||||
char *collversion;
|
char *collversion;
|
||||||
|
#endif
|
||||||
} DatabaseCollationInfo;
|
} DatabaseCollationInfo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -462,17 +464,15 @@ typedef struct DatabaseCollationInfo
|
||||||
static DatabaseCollationInfo
|
static DatabaseCollationInfo
|
||||||
GetDatabaseCollation(Oid db_oid)
|
GetDatabaseCollation(Oid db_oid)
|
||||||
{
|
{
|
||||||
HeapTuple tup;
|
|
||||||
DatabaseCollationInfo info;
|
DatabaseCollationInfo info;
|
||||||
Datum collationDatum, ctypeDatum, icuLocaleDatum, collverDatum;
|
Datum collationDatum, ctypeDatum, icuLocaleDatum, collverDatum;
|
||||||
bool isNull;
|
bool isNull;
|
||||||
Relation rel;
|
|
||||||
TupleDesc tupdesc;
|
TupleDesc tupdesc;
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
|
|
||||||
snapshot = RegisterSnapshot(GetLatestSnapshot());
|
snapshot = RegisterSnapshot(GetLatestSnapshot());
|
||||||
rel = table_open(DatabaseRelationId, AccessShareLock);
|
Relation rel = table_open(DatabaseRelationId, AccessShareLock);
|
||||||
tup = get_catalog_object_by_oid(rel, Anum_pg_database_oid, db_oid);
|
HeapTuple tup = get_catalog_object_by_oid(rel, Anum_pg_database_oid, db_oid);
|
||||||
if (!HeapTupleIsValid(tup))
|
if (!HeapTupleIsValid(tup))
|
||||||
{
|
{
|
||||||
elog(ERROR, "cache lookup failed for database %u", db_oid);
|
elog(ERROR, "cache lookup failed for database %u", db_oid);
|
||||||
|
@ -499,6 +499,8 @@ GetDatabaseCollation(Oid db_oid)
|
||||||
info.ctype = TextDatumGetCString(ctypeDatum);
|
info.ctype = TextDatumGetCString(ctypeDatum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||||
|
|
||||||
icuLocaleDatum = heap_getattr(tup, Anum_pg_database_daticulocale, tupdesc, &isNull);
|
icuLocaleDatum = heap_getattr(tup, Anum_pg_database_daticulocale, tupdesc, &isNull);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
|
@ -518,6 +520,7 @@ GetDatabaseCollation(Oid db_oid)
|
||||||
{
|
{
|
||||||
info.collversion = TextDatumGetCString(collverDatum);
|
info.collversion = TextDatumGetCString(collverDatum);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
table_close(rel, AccessShareLock);
|
table_close(rel, AccessShareLock);
|
||||||
UnregisterSnapshot(snapshot);
|
UnregisterSnapshot(snapshot);
|
||||||
|
@ -607,6 +610,7 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
||||||
appendStringInfo(&str, " LC_CTYPE = '%s'", collInfo.ctype);
|
appendStringInfo(&str, " LC_CTYPE = '%s'", collInfo.ctype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||||
if (collInfo.icu_locale != NULL)
|
if (collInfo.icu_locale != NULL)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " ICU_LOCALE = '%s'", collInfo.icu_locale);
|
appendStringInfo(&str, " ICU_LOCALE = '%s'", collInfo.icu_locale);
|
||||||
|
@ -622,6 +626,7 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " COLLATION_VERSION = '%s'", collInfo.collversion);
|
appendStringInfo(&str, " COLLATION_VERSION = '%s'", collInfo.collversion);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (databaseForm->dattablespace != InvalidOid)
|
if (databaseForm->dattablespace != InvalidOid)
|
||||||
{
|
{
|
||||||
|
@ -658,11 +663,9 @@ GenerateCreateDatabaseCommandList(void)
|
||||||
{
|
{
|
||||||
List *commands = NIL;
|
List *commands = NIL;
|
||||||
HeapTuple tuple;
|
HeapTuple tuple;
|
||||||
Relation pgDatabaseRel;
|
|
||||||
TableScanDesc scan;
|
|
||||||
|
|
||||||
pgDatabaseRel = table_open(DatabaseRelationId, AccessShareLock);
|
Relation pgDatabaseRel = table_open(DatabaseRelationId, AccessShareLock);
|
||||||
scan = table_beginscan_catalog(pgDatabaseRel, 0, NULL);
|
TableScanDesc scan = table_beginscan_catalog(pgDatabaseRel, 0, NULL);
|
||||||
|
|
||||||
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||||
{
|
{
|
||||||
|
@ -671,8 +674,7 @@ GenerateCreateDatabaseCommandList(void)
|
||||||
char *createStmt = GenerateCreateDatabaseStatementFromPgDatabase(databaseForm);
|
char *createStmt = GenerateCreateDatabaseStatementFromPgDatabase(databaseForm);
|
||||||
|
|
||||||
|
|
||||||
StringInfo outerDbStmt;
|
StringInfo outerDbStmt = makeStringInfo();
|
||||||
outerDbStmt = makeStringInfo();
|
|
||||||
|
|
||||||
/* Generate the CREATE DATABASE statement */
|
/* Generate the CREATE DATABASE statement */
|
||||||
appendStringInfo(outerDbStmt,
|
appendStringInfo(outerDbStmt,
|
||||||
|
|
Loading…
Reference in New Issue