1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Add new system view, pg_config

Move and refactor the underlying code for the pg_config client
application to src/common in support of sharing it with a new
system information SRF called pg_config() which makes the same
information available via SQL. Additionally wrap the SRF with a
new system view, as called pg_config.

Patch by me with extensive input and review by Michael Paquier
and additional review by Alvaro Herrera.
This commit is contained in:
Joe Conway
2016-02-17 09:12:06 -08:00
parent f1f5ec1efa
commit a5c43b8869
16 changed files with 491 additions and 410 deletions

View File

@@ -171,6 +171,36 @@ make_native_path(char *filename)
}
/*
* This function cleans up the paths for use with either cmd.exe or Msys
* on Windows. We need them to use filenames without spaces, for which a
* short filename is the safest equivalent, eg:
* C:/Progra~1/
*/
void
cleanup_path(char *path)
{
#ifdef WIN32
char *ptr;
/*
* GetShortPathName() will fail if the path does not exist, or short names
* are disabled on this file system. In both cases, we just return the
* original path. This is particularly useful for --sysconfdir, which
* might not exist.
*/
GetShortPathName(path, path, MAXPGPATH - 1);
/* Replace '\' with '/' */
for (ptr = path; *ptr; ptr++)
{
if (*ptr == '\\')
*ptr = '/';
}
#endif
}
/*
* join_path_components - join two path components, inserting a slash
*