mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +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:
@ -195,7 +195,7 @@ main(int argc, char *argv[])
|
||||
if (lc_ctype)
|
||||
appendPQExpBuffer(&sql, " LC_CTYPE '%s'", lc_ctype);
|
||||
|
||||
appendPQExpBufferStr(&sql, ";\n");
|
||||
appendPQExpBufferStr(&sql, ";");
|
||||
|
||||
/* No point in trying to use postgres db when creating postgres db. */
|
||||
if (maintenance_db == NULL && strcmp(dbname, "postgres") == 0)
|
||||
@ -205,7 +205,7 @@ main(int argc, char *argv[])
|
||||
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)
|
||||
@ -222,10 +222,10 @@ main(int argc, char *argv[])
|
||||
{
|
||||
printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname));
|
||||
appendStringLiteralConn(&sql, comment, conn);
|
||||
appendPQExpBufferStr(&sql, ";\n");
|
||||
appendPQExpBufferStr(&sql, ";");
|
||||
|
||||
if (echo)
|
||||
printf("%s", sql.data);
|
||||
printf("%s\n", sql.data);
|
||||
result = PQexec(conn, sql.data);
|
||||
|
||||
if (PQresultStatus(result) != PGRES_COMMAND_OK)
|
||||
|
Reference in New Issue
Block a user