Skip to content

Commit f08413b

Browse files
committed
after apply pgindent
1 parent 0f6f2e0 commit f08413b

18 files changed

+1941
-1835
lines changed

src/assign.c

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ plpgsql_check_record_variable_usage(PLpgSQL_checkstate *cstate, int dno, bool wr
5151

5252
appendStringInfo(&message, "auto varible \"%s\" should not be modified by user", var->refname);
5353
plpgsql_check_put_error(cstate,
54-
0, var->lineno,
55-
message.data,
56-
NULL,
57-
NULL,
58-
PLPGSQL_CHECK_WARNING_EXTRA,
59-
0, NULL, NULL);
54+
0, var->lineno,
55+
message.data,
56+
NULL,
57+
NULL,
58+
PLPGSQL_CHECK_WARNING_EXTRA,
59+
0, NULL, NULL);
6060
pfree(message.data);
6161
}
6262
}
@@ -116,7 +116,7 @@ plpgsql_check_is_assignable(PLpgSQL_execstate *estate, int dno)
116116
case PLPGSQL_DTYPE_RECFIELD:
117117
/* assignable if parent record is */
118118
plpgsql_check_is_assignable(estate,
119-
((PLpgSQL_recfield *) datum)->recparentno);
119+
((PLpgSQL_recfield *) datum)->recparentno);
120120
break;
121121

122122
default:
@@ -204,9 +204,9 @@ plpgsql_check_target(PLpgSQL_checkstate *cstate, int varno, Oid *expected_typoid
204204
*/
205205
if (!HeapTupleIsValid(recvar_tuple(rec)))
206206
ereport(ERROR,
207-
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
208-
errmsg("record \"%s\" is not assigned to tuple structure",
209-
rec->refname)));
207+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
208+
errmsg("record \"%s\" is not assigned to tuple structure",
209+
rec->refname)));
210210

211211
/*
212212
* Get the number of the records field to change and the
@@ -229,7 +229,7 @@ plpgsql_check_target(PLpgSQL_checkstate *cstate, int varno, Oid *expected_typoid
229229
break;
230230

231231
default:
232-
; /* nope */
232+
; /* nope */
233233
}
234234
}
235235

@@ -254,57 +254,57 @@ plpgsql_check_assign_to_target_type(PLpgSQL_checkstate *cstate,
254254

255255
if (type_is_rowtype(value_typoid) && !type_is_rowtype(target_typoid))
256256
{
257-
StringInfoData str;
257+
StringInfoData str;
258258

259259
initStringInfo(&str);
260260
appendStringInfo(&str, "cannot cast composite value of \"%s\" type to a scalar value of \"%s\" type",
261-
format_type_be(value_typoid),
262-
format_type_be(target_typoid));
261+
format_type_be(value_typoid),
262+
format_type_be(target_typoid));
263263

264264
plpgsql_check_put_error(cstate,
265-
ERRCODE_DATATYPE_MISMATCH, 0,
266-
str.data,
267-
NULL,
268-
NULL,
269-
PLPGSQL_CHECK_ERROR,
270-
0, NULL, NULL);
265+
ERRCODE_DATATYPE_MISMATCH, 0,
266+
str.data,
267+
NULL,
268+
NULL,
269+
PLPGSQL_CHECK_ERROR,
270+
0, NULL, NULL);
271271
}
272272
else if (!isnull)
273273
{
274-
StringInfoData str;
274+
StringInfoData str;
275275

276276
initStringInfo(&str);
277277
appendStringInfo(&str, "cast \"%s\" value to \"%s\" type",
278-
format_type_be(value_typoid),
279-
format_type_be(target_typoid));
278+
format_type_be(value_typoid),
279+
format_type_be(target_typoid));
280280

281281
/* accent warning when cast is without supported explicit casting */
282282
if (!can_coerce_type(1, &value_typoid, &target_typoid, COERCION_EXPLICIT))
283283
plpgsql_check_put_error(cstate,
284-
ERRCODE_DATATYPE_MISMATCH, 0,
285-
"target type is different type than source type",
286-
str.data,
287-
"There are no possible explicit coercion between those types, possibly bug!",
288-
PLPGSQL_CHECK_WARNING_OTHERS,
289-
0, NULL, NULL);
284+
ERRCODE_DATATYPE_MISMATCH, 0,
285+
"target type is different type than source type",
286+
str.data,
287+
"There are no possible explicit coercion between those types, possibly bug!",
288+
PLPGSQL_CHECK_WARNING_OTHERS,
289+
0, NULL, NULL);
290290
else if (!can_coerce_type(1, &value_typoid, &target_typoid, COERCION_ASSIGNMENT))
291291
plpgsql_check_put_error(cstate,
292-
ERRCODE_DATATYPE_MISMATCH, 0,
293-
"target type is different type than source type",
294-
str.data,
295-
"The input expression type does not have an assignment cast to the target type.",
296-
PLPGSQL_CHECK_WARNING_OTHERS,
297-
0, NULL, NULL);
292+
ERRCODE_DATATYPE_MISMATCH, 0,
293+
"target type is different type than source type",
294+
str.data,
295+
"The input expression type does not have an assignment cast to the target type.",
296+
PLPGSQL_CHECK_WARNING_OTHERS,
297+
0, NULL, NULL);
298298
else
299299
{
300300
/* highly probably only performance issue */
301301
plpgsql_check_put_error(cstate,
302-
ERRCODE_DATATYPE_MISMATCH, 0,
303-
"target type is different type than source type",
304-
str.data,
305-
"Hidden casting can be a performance issue.",
306-
PLPGSQL_CHECK_WARNING_PERFORMANCE,
307-
0, NULL, NULL);
302+
ERRCODE_DATATYPE_MISMATCH, 0,
303+
"target type is different type than source type",
304+
str.data,
305+
"Hidden casting can be a performance issue.",
306+
PLPGSQL_CHECK_WARNING_PERFORMANCE,
307+
0, NULL, NULL);
308308
}
309309

310310
pfree(str.data);
@@ -326,9 +326,9 @@ plpgsql_check_assign_tupdesc_dno(PLpgSQL_checkstate *cstate, int varno, TupleDes
326326
PLpgSQL_var *var = (PLpgSQL_var *) target;
327327

328328
plpgsql_check_assign_to_target_type(cstate,
329-
var->datatype->typoid, var->datatype->atttypmod,
330-
TupleDescAttr(tupdesc, 0)->atttypid,
331-
isnull);
329+
var->datatype->typoid, var->datatype->atttypmod,
330+
TupleDescAttr(tupdesc, 0)->atttypid,
331+
isnull);
332332
}
333333
break;
334334

@@ -342,20 +342,20 @@ plpgsql_check_assign_tupdesc_dno(PLpgSQL_checkstate *cstate, int varno, TupleDes
342342

343343
case PLPGSQL_DTYPE_RECFIELD:
344344
{
345-
Oid typoid;
346-
int typmod;
345+
Oid typoid;
346+
int typmod;
347347

348348
plpgsql_check_target(cstate, varno, &typoid, &typmod);
349349

350350
plpgsql_check_assign_to_target_type(cstate,
351-
typoid, typmod,
352-
TupleDescAttr(tupdesc, 0)->atttypid,
353-
isnull);
351+
typoid, typmod,
352+
TupleDescAttr(tupdesc, 0)->atttypid,
353+
isnull);
354354
}
355355
break;
356356

357357
default:
358-
; /* nope */
358+
; /* nope */
359359
}
360360
}
361361

@@ -366,18 +366,18 @@ plpgsql_check_assign_tupdesc_dno(PLpgSQL_checkstate *cstate, int varno, TupleDes
366366
*/
367367
void
368368
plpgsql_check_assign_tupdesc_row_or_rec(PLpgSQL_checkstate *cstate,
369-
PLpgSQL_row *row,
370-
PLpgSQL_rec *rec,
371-
TupleDesc tupdesc,
372-
bool isnull)
369+
PLpgSQL_row *row,
370+
PLpgSQL_rec *rec,
371+
TupleDesc tupdesc,
372+
bool isnull)
373373
{
374374
if (tupdesc == NULL)
375375
{
376376
plpgsql_check_put_error(cstate,
377-
0, 0,
378-
"tuple descriptor is empty", NULL, NULL,
379-
PLPGSQL_CHECK_WARNING_OTHERS,
380-
0, NULL, NULL);
377+
0, 0,
378+
"tuple descriptor is empty", NULL, NULL,
379+
PLPGSQL_CHECK_WARNING_OTHERS,
380+
0, NULL, NULL);
381381
return;
382382
}
383383

@@ -408,7 +408,7 @@ plpgsql_check_assign_tupdesc_row_or_rec(PLpgSQL_checkstate *cstate,
408408

409409
if (anum < td_natts)
410410
{
411-
Oid valtype = SPI_gettypeid(tupdesc, anum + 1);
411+
Oid valtype = SPI_gettypeid(tupdesc, anum + 1);
412412
PLpgSQL_datum *target = cstate->estate->datums[row->varnos[fnum]];
413413

414414
switch (target->dtype)
@@ -418,24 +418,24 @@ plpgsql_check_assign_tupdesc_row_or_rec(PLpgSQL_checkstate *cstate,
418418
PLpgSQL_var *var = (PLpgSQL_var *) target;
419419

420420
plpgsql_check_assign_to_target_type(cstate,
421-
var->datatype->typoid,
422-
var->datatype->atttypmod,
423-
valtype,
424-
isnull);
421+
var->datatype->typoid,
422+
var->datatype->atttypmod,
423+
valtype,
424+
isnull);
425425
}
426426
break;
427427

428428
case PLPGSQL_DTYPE_RECFIELD:
429429
{
430-
Oid expected_typoid;
431-
int expected_typmod;
430+
Oid expected_typoid;
431+
int expected_typmod;
432432

433433
plpgsql_check_target(cstate, target->dno, &expected_typoid, &expected_typmod);
434434
plpgsql_check_assign_to_target_type(cstate,
435-
expected_typoid,
436-
expected_typmod,
437-
valtype,
438-
isnull);
435+
expected_typoid,
436+
expected_typmod,
437+
valtype,
438+
isnull);
439439
}
440440
break;
441441
default:
@@ -478,9 +478,9 @@ plpgsql_check_recval_release(PLpgSQL_rec *rec)
478478
void
479479
plpgsql_check_recval_assign_tupdesc(PLpgSQL_checkstate *cstate, PLpgSQL_rec *rec, TupleDesc tupdesc, bool is_null)
480480
{
481-
PLpgSQL_execstate *estate = cstate->estate;
482-
ExpandedRecordHeader *newerh;
483-
MemoryContext mcontext;
481+
PLpgSQL_execstate *estate = cstate->estate;
482+
ExpandedRecordHeader *newerh;
483+
MemoryContext mcontext;
484484
TupleDesc var_tupdesc;
485485
Datum *newvalues;
486486
bool *newnulls;
@@ -497,15 +497,15 @@ plpgsql_check_recval_assign_tupdesc(PLpgSQL_checkstate *cstate, PLpgSQL_rec *rec
497497
if (rec->rectypeid != RECORDOID)
498498
{
499499
newerh = make_expanded_record_from_typeid(rec->rectypeid, -1,
500-
mcontext);
500+
mcontext);
501501
}
502502
else
503503
{
504504
if (!tupdesc)
505505
return;
506506

507507
newerh = make_expanded_record_from_tupdesc(tupdesc,
508-
mcontext);
508+
mcontext);
509509
}
510510

511511
/*
@@ -516,12 +516,12 @@ plpgsql_check_recval_assign_tupdesc(PLpgSQL_checkstate *cstate, PLpgSQL_rec *rec
516516

517517
if (!is_null && tupdesc != NULL && !compatible_tupdescs(var_tupdesc, tupdesc))
518518
{
519-
int attn1 = 0;
520-
int attn2 = 0;
521-
int target_nfields = 0;
522-
int src_nfields = 0;
523-
bool src_field_is_valid = false;
524-
bool target_field_is_valid = false;
519+
int attn1 = 0;
520+
int attn2 = 0;
521+
int target_nfields = 0;
522+
int src_nfields = 0;
523+
bool src_field_is_valid = false;
524+
bool target_field_is_valid = false;
525525
Form_pg_attribute sattr = NULL;
526526
Form_pg_attribute tattr = NULL;
527527

@@ -554,12 +554,12 @@ plpgsql_check_recval_assign_tupdesc(PLpgSQL_checkstate *cstate, PLpgSQL_rec *rec
554554
if (src_field_is_valid && target_field_is_valid)
555555
{
556556
plpgsql_check_assign_to_target_type(cstate,
557-
tattr->atttypid, tattr->atttypmod,
558-
sattr->atttypid,
559-
false);
557+
tattr->atttypid, tattr->atttypmod,
558+
sattr->atttypid,
559+
false);
560560

561561
/* try to search next tuple of fields */
562-
src_field_is_valid = false;
562+
src_field_is_valid = false;
563563
target_field_is_valid = false;
564564
attn1 += 1;
565565
attn2 += 1;
@@ -570,20 +570,20 @@ plpgsql_check_recval_assign_tupdesc(PLpgSQL_checkstate *cstate, PLpgSQL_rec *rec
570570

571571
if (src_nfields < target_nfields)
572572
plpgsql_check_put_error(cstate,
573-
0, 0,
574-
"too few attributes for composite variable",
575-
NULL,
576-
NULL,
577-
PLPGSQL_CHECK_WARNING_OTHERS,
578-
0, NULL, NULL);
573+
0, 0,
574+
"too few attributes for composite variable",
575+
NULL,
576+
NULL,
577+
PLPGSQL_CHECK_WARNING_OTHERS,
578+
0, NULL, NULL);
579579
else if (src_nfields > target_nfields)
580580
plpgsql_check_put_error(cstate,
581-
0, 0,
582-
"too many attributes for composite variable",
583-
NULL,
584-
NULL,
585-
PLPGSQL_CHECK_WARNING_OTHERS,
586-
0, NULL, NULL);
581+
0, 0,
582+
"too many attributes for composite variable",
583+
NULL,
584+
NULL,
585+
PLPGSQL_CHECK_WARNING_OTHERS,
586+
0, NULL, NULL);
587587
}
588588

589589
chunk = eval_mcontext_alloc(estate,

src/catalog.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
#endif
4545

46-
static Oid plpgsql_check_PLpgSQLlanguageId = InvalidOid;
46+
static Oid plpgsql_check_PLpgSQLlanguageId = InvalidOid;
4747

4848
/*
4949
* Prepare metadata necessary for plpgsql_check
@@ -89,8 +89,8 @@ plpgsql_check_get_function_info(plpgsql_check_info *cinfo)
8989
char *
9090
plpgsql_check_get_src(HeapTuple procTuple)
9191
{
92-
Datum prosrcdatum;
93-
bool isnull;
92+
Datum prosrcdatum;
93+
bool isnull;
9494

9595
prosrcdatum = SysCacheGetAttr(PROCOID, procTuple,
9696
Anum_pg_proc_prosrc, &isnull);
@@ -257,8 +257,8 @@ get_extension_version(Oid ext_oid)
257257
char *
258258
get_extension_version2(Oid ext_oid)
259259
{
260-
HeapTuple extTuple;
261-
Datum extversiondatum;
260+
HeapTuple extTuple;
261+
Datum extversiondatum;
262262
char *result;
263263
bool isnull;
264264

@@ -288,8 +288,8 @@ get_extension_version2(Oid ext_oid)
288288
Oid
289289
plpgsql_check_pragma_func_oid(void)
290290
{
291-
Oid result = InvalidOid;
292-
Oid extoid;
291+
Oid result = InvalidOid;
292+
Oid extoid;
293293

294294
extoid = get_extension_oid("plpgsql_check", true);
295295

@@ -367,6 +367,7 @@ plpgsql_check_get_op_namespace(Oid opno)
367367
if (HeapTupleIsValid(tp))
368368
{
369369
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
370+
370371
ReleaseSysCache(tp);
371372
return optup->oprnamespace;
372373
}

0 commit comments

Comments
 (0)