summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorTom Lane2013-10-22 23:40:26 +0000
committerTom Lane2013-10-22 23:40:26 +0000
commit2c66f9924c1162bfba27c77004ccf42fb6ea188d (patch)
tree920c20776ef6d13d7a5d3a836202d897abcaf428 /contrib
parent09a89cb5fc29b47c26d151e82293fd3bef592b7b (diff)
Replace pg_asprintf() with psprintf().
This eliminates an awkward coding pattern that's also unnecessarily inconsistent with backend coding. psprintf() is now the thing to use everywhere.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/oid2name/oid2name.c2
-rw-r--r--contrib/pg_upgrade/check.c8
-rw-r--r--contrib/pg_upgrade/tablespace.c5
-rw-r--r--contrib/pg_upgrade/util.c2
4 files changed, 8 insertions, 9 deletions
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index ab92c637e5..67d79346b2 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -508,7 +508,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
free(comma_filenodes);
/* now build the query */
- pg_asprintf(&todo,
+ todo = psprintf(
"SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
"FROM pg_catalog.pg_class c \n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace \n"
diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c
index 464bbe2604..936306ce61 100644
--- a/contrib/pg_upgrade/check.c
+++ b/contrib/pg_upgrade/check.c
@@ -458,10 +458,9 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
prep_status("Creating script to analyze new cluster");
if (os_info.user_specified)
- pg_asprintf(&user_specification, "-U \"%s\" ", os_info.user);
+ user_specification = psprintf("-U \"%s\" ", os_info.user);
- pg_asprintf(analyze_script_file_name, "analyze_new_cluster.%s",
- SCRIPT_EXT);
+ *analyze_script_file_name = psprintf("analyze_new_cluster.%s", SCRIPT_EXT);
if ((script = fopen_priv(*analyze_script_file_name, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
@@ -592,8 +591,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
int tblnum;
char old_cluster_pgdata[MAXPGPATH];
- pg_asprintf(deletion_script_file_name, "delete_old_cluster.%s",
- SCRIPT_EXT);
+ *deletion_script_file_name = psprintf("delete_old_cluster.%s", SCRIPT_EXT);
/*
* Some users (oddly) create tablespaces inside the cluster data
diff --git a/contrib/pg_upgrade/tablespace.c b/contrib/pg_upgrade/tablespace.c
index f090f62b29..27273662dd 100644
--- a/contrib/pg_upgrade/tablespace.c
+++ b/contrib/pg_upgrade/tablespace.c
@@ -86,7 +86,8 @@ set_tablespace_directory_suffix(ClusterInfo *cluster)
/* This cluster has a version-specific subdirectory */
/* The leading slash is needed to start a new directory. */
- pg_asprintf(&cluster->tablespace_suffix, "/PG_%s_%d",
- cluster->major_version_str, cluster->controldata.cat_ver);
+ cluster->tablespace_suffix = psprintf("/PG_%s_%d",
+ cluster->major_version_str,
+ cluster->controldata.cat_ver);
}
}
diff --git a/contrib/pg_upgrade/util.c b/contrib/pg_upgrade/util.c
index 7bca19b84d..a67bd64043 100644
--- a/contrib/pg_upgrade/util.c
+++ b/contrib/pg_upgrade/util.c
@@ -278,7 +278,7 @@ pg_putenv(const char *var, const char *val)
#ifndef WIN32
char *envstr;
- pg_asprintf(&envstr, "%s=%s", var, val);
+ envstr = psprintf("%s=%s", var, val);
putenv(envstr);
/*