1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

scripts: Remove newlines from end of generated SQL

This results in spurious empty lines in the server log.  Instead, add
the newlines only when printing out the --echo output.  In some cases,
this was already done, leading to two newlines being printed.  Clean
that up as well.

From: Fabrízio de Royes Mello <fabriziomello@gmail.com>
This commit is contained in:
Peter Eisentraut
2014-02-10 21:47:19 -05:00
parent 2895415205
commit d3c4c47155
9 changed files with 19 additions and 19 deletions

View File

@ -121,7 +121,7 @@ main(int argc, char *argv[])
initPQExpBuffer(&sql);
appendPQExpBuffer(&sql, "DROP DATABASE %s%s;\n",
appendPQExpBuffer(&sql, "DROP DATABASE %s%s;",
(if_exists ? "IF EXISTS " : ""), fmtId(dbname));
/* Avoid trying to drop postgres db while we are connected to it. */
@ -132,7 +132,7 @@ main(int argc, char *argv[])
host, port, username, prompt_password, progname);
if (echo)
printf("%s", sql.data);
printf("%s\n", sql.data);
result = PQexec(conn, sql.data);
if (PQresultStatus(result) != PGRES_COMMAND_OK)
{