mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -241,10 +241,10 @@ connect_pg_server(ForeignServer *server, UserMapping *user)
|
||||
conn = PQconnectdbParams(keywords, values, false);
|
||||
if (!conn || PQstatus(conn) != CONNECTION_OK)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
|
||||
errmsg("could not connect to server \"%s\"",
|
||||
server->servername),
|
||||
errdetail_internal("%s", pchomp(PQerrorMessage(conn)))));
|
||||
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
|
||||
errmsg("could not connect to server \"%s\"",
|
||||
server->servername),
|
||||
errdetail_internal("%s", pchomp(PQerrorMessage(conn)))));
|
||||
|
||||
/*
|
||||
* Check that non-superuser has used password to establish connection;
|
||||
@ -253,10 +253,10 @@ connect_pg_server(ForeignServer *server, UserMapping *user)
|
||||
*/
|
||||
if (!superuser() && !PQconnectionUsedPassword(conn))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
|
||||
errmsg("password is required"),
|
||||
errdetail("Non-superuser cannot connect if the server does not request a password."),
|
||||
errhint("Target server's authentication method must be changed.")));
|
||||
(errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
|
||||
errmsg("password is required"),
|
||||
errdetail("Non-superuser cannot connect if the server does not request a password."),
|
||||
errhint("Target server's authentication method must be changed.")));
|
||||
|
||||
/* Prepare new session for use */
|
||||
configure_remote_session(conn);
|
||||
@ -589,7 +589,7 @@ pgfdw_report_error(int elevel, PGresult *res, PGconn *conn,
|
||||
(errcode(sqlstate),
|
||||
message_primary ? errmsg_internal("%s", message_primary) :
|
||||
errmsg("could not obtain message string for remote error"),
|
||||
message_detail ? errdetail_internal("%s", message_detail) : 0,
|
||||
message_detail ? errdetail_internal("%s", message_detail) : 0,
|
||||
message_hint ? errhint("%s", message_hint) : 0,
|
||||
message_context ? errcontext("%s", message_context) : 0,
|
||||
sql ? errcontext("Remote SQL command: %s", sql) : 0));
|
||||
@ -1070,7 +1070,7 @@ pgfdw_get_cleanup_result(PGconn *conn, TimestampTz endtime, PGresult **result)
|
||||
|
||||
/* Sleep until there's something to do */
|
||||
wc = WaitLatchOrSocket(MyLatch,
|
||||
WL_LATCH_SET | WL_SOCKET_READABLE | WL_TIMEOUT,
|
||||
WL_LATCH_SET | WL_SOCKET_READABLE | WL_TIMEOUT,
|
||||
PQsocket(conn),
|
||||
cur_timeout, PG_WAIT_EXTENSION);
|
||||
ResetLatch(MyLatch);
|
||||
|
@ -168,7 +168,7 @@ static void deparseLockingClause(deparse_expr_cxt *context);
|
||||
static void appendOrderByClause(List *pathkeys, deparse_expr_cxt *context);
|
||||
static void appendConditions(List *exprs, deparse_expr_cxt *context);
|
||||
static void deparseFromExprForRel(StringInfo buf, PlannerInfo *root,
|
||||
RelOptInfo *joinrel, bool use_alias, List **params_list);
|
||||
RelOptInfo *joinrel, bool use_alias, List **params_list);
|
||||
static void deparseFromExpr(List *quals, deparse_expr_cxt *context);
|
||||
static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root,
|
||||
RelOptInfo *foreignrel, bool make_subquery,
|
||||
@ -728,7 +728,7 @@ foreign_expr_walker(Node *node,
|
||||
agg->args);
|
||||
sortcoltype = exprType((Node *) tle->expr);
|
||||
typentry = lookup_type_cache(sortcoltype,
|
||||
TYPECACHE_LT_OPR | TYPECACHE_GT_OPR);
|
||||
TYPECACHE_LT_OPR | TYPECACHE_GT_OPR);
|
||||
/* Check shippability of non-default sort operator. */
|
||||
if (srt->sortop != typentry->lt_opr &&
|
||||
srt->sortop != typentry->gt_opr &&
|
||||
@ -883,8 +883,8 @@ build_tlist_to_deparse(RelOptInfo *foreignrel)
|
||||
* required for evaluating the local conditions.
|
||||
*/
|
||||
tlist = add_to_flat_tlist(tlist,
|
||||
pull_var_clause((Node *) foreignrel->reltarget->exprs,
|
||||
PVC_RECURSE_PLACEHOLDERS));
|
||||
pull_var_clause((Node *) foreignrel->reltarget->exprs,
|
||||
PVC_RECURSE_PLACEHOLDERS));
|
||||
foreach(lc, fpinfo->local_conds)
|
||||
{
|
||||
RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc);
|
||||
@ -1434,7 +1434,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
|
||||
* ((outer relation) <join type> (inner relation) ON (joinclauses))
|
||||
*/
|
||||
appendStringInfo(buf, "(%s %s JOIN %s ON ", join_sql_o.data,
|
||||
get_jointype_name(fpinfo->jointype), join_sql_i.data);
|
||||
get_jointype_name(fpinfo->jointype), join_sql_i.data);
|
||||
|
||||
/* Append join clause; (TRUE) if no join clause */
|
||||
if (fpinfo->joinclauses)
|
||||
@ -1596,7 +1596,7 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root,
|
||||
appendStringInfoString(buf, " ON CONFLICT DO NOTHING");
|
||||
|
||||
deparseReturningList(buf, root, rtindex, rel,
|
||||
rel->trigdesc && rel->trigdesc->trig_insert_after_row,
|
||||
rel->trigdesc && rel->trigdesc->trig_insert_after_row,
|
||||
returningList, retrieved_attrs);
|
||||
}
|
||||
|
||||
@ -1638,7 +1638,7 @@ deparseUpdateSql(StringInfo buf, PlannerInfo *root,
|
||||
appendStringInfoString(buf, " WHERE ctid = $1");
|
||||
|
||||
deparseReturningList(buf, root, rtindex, rel,
|
||||
rel->trigdesc && rel->trigdesc->trig_update_after_row,
|
||||
rel->trigdesc && rel->trigdesc->trig_update_after_row,
|
||||
returningList, retrieved_attrs);
|
||||
}
|
||||
|
||||
@ -1728,7 +1728,7 @@ deparseDeleteSql(StringInfo buf, PlannerInfo *root,
|
||||
appendStringInfoString(buf, " WHERE ctid = $1");
|
||||
|
||||
deparseReturningList(buf, root, rtindex, rel,
|
||||
rel->trigdesc && rel->trigdesc->trig_delete_after_row,
|
||||
rel->trigdesc && rel->trigdesc->trig_delete_after_row,
|
||||
returningList, retrieved_attrs);
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ InitPgFdwOptions(void)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FDW_OUT_OF_MEMORY),
|
||||
errmsg("out of memory"),
|
||||
errdetail("could not get libpq's default connection options")));
|
||||
errdetail("could not get libpq's default connection options")));
|
||||
|
||||
/* Count how many libpq options are available. */
|
||||
num_libpq_opts = 0;
|
||||
|
@ -756,10 +756,10 @@ get_useful_ecs_for_relation(PlannerInfo *root, RelOptInfo *rel)
|
||||
*/
|
||||
if (bms_overlap(relids, restrictinfo->right_ec->ec_relids))
|
||||
useful_eclass_list = list_append_unique_ptr(useful_eclass_list,
|
||||
restrictinfo->right_ec);
|
||||
restrictinfo->right_ec);
|
||||
else if (bms_overlap(relids, restrictinfo->left_ec->ec_relids))
|
||||
useful_eclass_list = list_append_unique_ptr(useful_eclass_list,
|
||||
restrictinfo->left_ec);
|
||||
restrictinfo->left_ec);
|
||||
}
|
||||
|
||||
return useful_eclass_list;
|
||||
@ -999,9 +999,9 @@ postgresGetForeignPaths(PlannerInfo *root,
|
||||
arg.current = NULL;
|
||||
clauses = generate_implied_equalities_for_column(root,
|
||||
baserel,
|
||||
ec_member_matches_foreign,
|
||||
ec_member_matches_foreign,
|
||||
(void *) &arg,
|
||||
baserel->lateral_referencers);
|
||||
baserel->lateral_referencers);
|
||||
|
||||
/* Done if there are no more expressions in the foreign rel */
|
||||
if (arg.current == NULL)
|
||||
@ -1332,7 +1332,7 @@ postgresBeginForeignScan(ForeignScanState *node, int eflags)
|
||||
fsstate->query = strVal(list_nth(fsplan->fdw_private,
|
||||
FdwScanPrivateSelectSql));
|
||||
fsstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private,
|
||||
FdwScanPrivateRetrievedAttrs);
|
||||
FdwScanPrivateRetrievedAttrs);
|
||||
fsstate->fetch_size = intVal(list_nth(fsplan->fdw_private,
|
||||
FdwScanPrivateFetchSize));
|
||||
|
||||
@ -1710,7 +1710,7 @@ postgresBeginForeignModify(ModifyTableState *mtstate,
|
||||
fmstate->has_returning = intVal(list_nth(fdw_private,
|
||||
FdwModifyPrivateHasReturning));
|
||||
fmstate->retrieved_attrs = (List *) list_nth(fdw_private,
|
||||
FdwModifyPrivateRetrievedAttrs);
|
||||
FdwModifyPrivateRetrievedAttrs);
|
||||
|
||||
/* Create context for per-tuple temp workspace. */
|
||||
fmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
||||
@ -2311,11 +2311,11 @@ postgresBeginDirectModify(ForeignScanState *node, int eflags)
|
||||
dmstate->query = strVal(list_nth(fsplan->fdw_private,
|
||||
FdwDirectModifyPrivateUpdateSql));
|
||||
dmstate->has_returning = intVal(list_nth(fsplan->fdw_private,
|
||||
FdwDirectModifyPrivateHasReturning));
|
||||
FdwDirectModifyPrivateHasReturning));
|
||||
dmstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private,
|
||||
FdwDirectModifyPrivateRetrievedAttrs);
|
||||
FdwDirectModifyPrivateRetrievedAttrs);
|
||||
dmstate->set_processed = intVal(list_nth(fsplan->fdw_private,
|
||||
FdwDirectModifyPrivateSetProcessed));
|
||||
FdwDirectModifyPrivateSetProcessed));
|
||||
|
||||
/* Create context for per-tuple temp workspace. */
|
||||
dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
|
||||
@ -2725,8 +2725,8 @@ estimate_path_cost_size(PlannerInfo *root,
|
||||
/* Get number of grouping columns and possible number of groups */
|
||||
numGroupCols = list_length(root->parse->groupClause);
|
||||
numGroups = estimate_num_groups(root,
|
||||
get_sortgrouplist_exprs(root->parse->groupClause,
|
||||
fpinfo->grouped_tlist),
|
||||
get_sortgrouplist_exprs(root->parse->groupClause,
|
||||
fpinfo->grouped_tlist),
|
||||
input_rows, NULL);
|
||||
|
||||
/*
|
||||
@ -3763,7 +3763,7 @@ analyze_row_processor(PGresult *res, int row, PgFdwAnalyzeState *astate)
|
||||
astate->rows[pos] = make_tuple_from_result_row(res, row,
|
||||
astate->rel,
|
||||
astate->attinmeta,
|
||||
astate->retrieved_attrs,
|
||||
astate->retrieved_attrs,
|
||||
NULL,
|
||||
astate->temp_cxt);
|
||||
|
||||
@ -3836,8 +3836,8 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
|
||||
if (PQntuples(res) != 1)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FDW_SCHEMA_NOT_FOUND),
|
||||
errmsg("schema \"%s\" is not present on foreign server \"%s\"",
|
||||
stmt->remote_schema, server->servername)));
|
||||
errmsg("schema \"%s\" is not present on foreign server \"%s\"",
|
||||
stmt->remote_schema, server->servername)));
|
||||
|
||||
PQclear(res);
|
||||
res = NULL;
|
||||
@ -4205,23 +4205,23 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
|
||||
{
|
||||
case JOIN_INNER:
|
||||
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
|
||||
list_copy(fpinfo_i->remote_conds));
|
||||
list_copy(fpinfo_i->remote_conds));
|
||||
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
|
||||
list_copy(fpinfo_o->remote_conds));
|
||||
list_copy(fpinfo_o->remote_conds));
|
||||
break;
|
||||
|
||||
case JOIN_LEFT:
|
||||
fpinfo->joinclauses = list_concat(fpinfo->joinclauses,
|
||||
list_copy(fpinfo_i->remote_conds));
|
||||
list_copy(fpinfo_i->remote_conds));
|
||||
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
|
||||
list_copy(fpinfo_o->remote_conds));
|
||||
list_copy(fpinfo_o->remote_conds));
|
||||
break;
|
||||
|
||||
case JOIN_RIGHT:
|
||||
fpinfo->joinclauses = list_concat(fpinfo->joinclauses,
|
||||
list_copy(fpinfo_o->remote_conds));
|
||||
list_copy(fpinfo_o->remote_conds));
|
||||
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
|
||||
list_copy(fpinfo_i->remote_conds));
|
||||
list_copy(fpinfo_i->remote_conds));
|
||||
break;
|
||||
|
||||
case JOIN_FULL:
|
||||
|
Reference in New Issue
Block a user