1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Phase 3 of pgindent updates.

Don't move parenthesized lines to the left, even if that means they
flow past the right margin.

By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis.  However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent.  That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.

This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@ -552,7 +552,7 @@ exec_command_cd(PsqlScanState scan_state, bool active_branch, const char *cmd)
{
psql_error("could not get home directory for user ID %ld: %s\n",
(long) user_id,
errno ? strerror(errno) : _("user does not exist"));
errno ? strerror(errno) : _("user does not exist"));
exit(EXIT_FAILURE);
}
dir = pw->pw_dir;
@ -804,7 +804,7 @@ exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd)
if (pattern)
pattern2 = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, true);
OT_NORMAL, NULL, true);
success = listDbRoleSettings(pattern, pattern2);
}
else
@ -3291,7 +3291,7 @@ printSSLInfo(void)
protocol ? protocol : _("unknown"),
cipher ? cipher : _("unknown"),
bits ? bits : _("unknown"),
(compression && strcmp(compression, "off") != 0) ? _("on") : _("off"));
(compression && strcmp(compression, "off") != 0) ? _("on") : _("off"));
}
@ -3481,7 +3481,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf,
"/", (int) getpid());
#else
snprintf(fnametmp, sizeof(fnametmp), "%s%spsql.edit.%d.sql", tmpdir,
"" /* trailing separator already present */ , (int) getpid());
"" /* trailing separator already present */ , (int) getpid());
#endif
fname = (const char *) fnametmp;
@ -4156,19 +4156,19 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
else if (strcmp(param, "unicode_border_linestyle") == 0)
{
printf(_("Unicode border line style is \"%s\".\n"),
_unicode_linestyle2string(popt->topt.unicode_border_linestyle));
_unicode_linestyle2string(popt->topt.unicode_border_linestyle));
}
else if (strcmp(param, "unicode_column_linestyle") == 0)
{
printf(_("Unicode column line style is \"%s\".\n"),
_unicode_linestyle2string(popt->topt.unicode_column_linestyle));
_unicode_linestyle2string(popt->topt.unicode_column_linestyle));
}
else if (strcmp(param, "unicode_header_linestyle") == 0)
{
printf(_("Unicode header line style is \"%s\".\n"),
_unicode_linestyle2string(popt->topt.unicode_header_linestyle));
_unicode_linestyle2string(popt->topt.unicode_header_linestyle));
}
else
@ -4578,7 +4578,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption "
"FROM pg_catalog.pg_class c "
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
}
else if (pset.sversion >= 90200)
@ -4590,7 +4590,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"NULL AS checkoption "
"FROM pg_catalog.pg_class c "
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
}
else
@ -4602,7 +4602,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"NULL AS checkoption "
"FROM pg_catalog.pg_class c "
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
}
break;