Skip to content

Commit

Permalink
PG-934 Fix build for PG12
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgavrilov committed Jul 31, 2024
1 parent 4665be7 commit 4e7df71
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions percona_pg_telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ static long server_uptime(void);
static void load_telemery_files(void);
static char *generate_filename(char *filename);
static bool validate_dir(char *folder_path);

#if PG_VERSION_NUM >= 130000
static int compareFileNames(const ListCell *a, const ListCell *b);
#else
static int compareFileNames(const void *a, const void *b);
#endif

/* Database information collection and writing to file */
static void write_pg_settings(void);
Expand Down Expand Up @@ -266,7 +271,11 @@ load_telemery_files(void)
}
}

#if PG_VERSION_NUM >= 130000
list_sort(files_list, compareFileNames);
#else
files_list = list_qsort(files_list, compareFileNames);
#endif

foreach(lc, files_list)
{
Expand All @@ -279,6 +288,7 @@ load_telemery_files(void)
}


#if PG_VERSION_NUM >= 130000
static int
compareFileNames(const ListCell *a, const ListCell *b)
{
Expand All @@ -287,6 +297,16 @@ compareFileNames(const ListCell *a, const ListCell *b)
return strcmp(fna, fnb);
}

#else
static int
compareFileNames(const void *a, const void *b)
{
char *fna = (char *) lfirst(*(ListCell **) a);
char *fnb = (char *) lfirst(*(ListCell **) b);
return strcmp(fna, fnb);
}
#endif

/*
* telemetry_path
*/
Expand Down

0 comments on commit 4e7df71

Please sign in to comment.