fix: align PLpgSQL formatting clauses
CI / Test (pull_request) Successful in 43s
CI / Build (pull_request) Successful in 1m2s

This commit is contained in:
Hein
2026-07-15 21:11:58 +02:00
parent a0838e4bdc
commit 5cba6beeb1
3 changed files with 206 additions and 25 deletions
+18 -18
View File
@@ -632,7 +632,7 @@ BEGIN
end if;*/
if G_BENCHMARK = 1
then
then
perform log_event(m_funcname,format('Perf Merge Replace SinceStart: %s Duration: %s', clock_timestamp() - m_start, clock_timestamp() - m_ltime),bt_enum('eventlog','local notice'));
m_ltime = clock_timestamp();
end if;
@@ -735,7 +735,7 @@ BEGIN
, '\[(.*?)\]', 'ig') r(v) into m_errmsg,m_retval;
if m_retval > 0
then
then
raise exception E'The following data fields could not be found for prefix % \r\n%', ifblnk(m_data_prefix, 'Null'), m_errmsg using hint = 'in ID replace process';
end if;
@@ -1136,16 +1136,16 @@ BEGIN
-- );
if r_lp_t.table_name = any(a_inner_selected) and nv(r_lp_t.table_name ) <> ''
then
then
raise notice 'Table used as inner table: %', r_lp_t.table_name;
continue;
end if;
--raise notice 'Field:% Table:% Tag: % Type: %', r_lp_t.field_name, r_lp_t.table_name, r_lp_t.mergetag, r_lp_t.merge_type;
if nv(r_lp_t.field_name) = '' and r_lp_t.merge_type not in (G_MTYPE_TBLROOT,G_MTYPE_SPECIAL)
then
then
if G_DEBUG
then
then
perform log_event(m_funcname,format('Blank field name on Complex merge for p_doctype=%s, p_commtype=%s, p_data_prefix=%s, p_data_rid=%s
field_name=%s, merge_type=%s, table_name=%s
' ,p_doctype, p_commtype,p_data_prefix,p_data_rid
@@ -1159,7 +1159,7 @@ BEGIN
end if;
if nv(m_exec_orderstr) = '' and nv(r_lp_t.parent_order_string) <> ''
then
then
m_exec_orderstr = r_lp_t.parent_order_string;
--raise notice 'Applying order % by for % %.', r_lp_t.parent_order_string, r_lp_t.parent_table_name,r_lp_t.field_name;
/*
@@ -1176,7 +1176,7 @@ BEGIN
end if;
if nv(r_lp_t.ops_string) = ''
then
then
r_lp_t.ops_string = r_lp_t.field_name;
end if;
@@ -1192,19 +1192,19 @@ BEGIN
end loop;
if r_lp_t.merge_type in (G_MTYPE_TBLFIELD, G_MTYPE_CONDFIELD)
then
then
m_execstr = format($S$%s|| '%s"%s":' || json_build_object('value',json_agg(%s::text %s), 'type', '%s')::text %s$S$
,m_execstr,m_comma,r_lp_t.mergetag
,r_lp_t.ops_string
, m_exec_orderstr, r_lp_t.merge_type, E'\r\n');
elseif r_lp_t.merge_type = G_MTYPE_SPECIAL--special fields
then
then
m_execstr = format($S$%s|| '%s"%s":' || json_build_object('value',%s, 'type', '%s')::text %s$S$
,m_execstr,m_comma,r_lp_t.mergetag,quote_literal(r_lp_t.tagvalue), r_lp_t.merge_type, E'\r\n');
--raise notice 'Special Field: %s',r_lp_t;
elseif r_lp.merge_type = G_MTYPE_PICTURE
then
then
m_execstr = format($S$%s|| '%s"%s":'
|| json_build_object('value',%s::text, 'type', '%s'
, 'w', mailmerge_specialfield('width', '%s', %s) ,'h', mailmerge_specialfield('height', '%s', %s))::text %s$S$
@@ -1212,7 +1212,7 @@ BEGIN
,r_lp.mergetag,quote_nullable(m_data_rid),r_lp.mergetag,quote_nullable(m_data_rid), E'\r\n');
elseif nv(r_lp_t.field_name) <> ''
then
then
m_execstr = format($S$%s|| '%s"%s":' || json_build_object('value',%s::text, 'type', '%s')::text %s$S$
,m_execstr,m_comma,r_lp_t.mergetag
, r_lp_t.ops_string
@@ -1225,7 +1225,7 @@ BEGIN
m_blankexec = format($S$%s|| '%s"%s":' || json_build_object('value','', 'type', '%s')::text %s$S$,m_blankexec,m_comma,r_lp_t.mergetag, r_lp_t.merge_type, E'\r\n');
if r_lp_t.rn = 1
then
then
--Inner level tables (2)
--raise notice 'Begin: parent: %', r_lp_t;
for r_lp_c in (
@@ -1345,7 +1345,7 @@ BEGIN
end loop;
if ifblnk(r_lp_t.parent_table_name,'') = ''
then
then
m_execstr = format(E'select (''{'' %s \r\n || ''}'')::json ;',m_execstr );
else
select string_agg(s.filter_string, ' ')
@@ -1364,7 +1364,7 @@ BEGIN
from exec_json(m_execstr, 'str json') r into m_retval,m_errmsg, m_json;
if m_json is null
then
then
select r.p_retval, r.p_errmsg, r.p_json - > 'str'
from exec_json(m_execstr, 'str json') r into m_retval,m_errmsg, m_json;
@@ -1373,12 +1373,12 @@ BEGIN
m_debug_exestr = nv(m_debug_exestr) || E'\r\n/*'|| nv(r_lp_t.parent_table_name) || ' len:' || nv(length(m_json::text)) ||E'*/ \r\n' || nv(m_execstr) || E'\r\n ';
if m_json_full_complex is null
then
then
m_json_full_complex = jsonb_build_object(r_lp_t.tblid::text,m_json);
end if;
if (m_json_full_complex->r_lp_t.tblid::text) is null
then
then
m_json_full_complex = jsonb_set(m_json_full_complex, format('{%s}',r_lp_t.tblid)::text[], m_json::jsonb,true);
else
m_json_full_complex = jsonb_set(m_json_full_complex, format('{%s}',r_lp_t.tblid)::text[], _jsonb_object_cat(m_json_full_complex->r_lp_t.tblid,m_json::jsonb),true);
@@ -1399,13 +1399,13 @@ BEGIN
end if;
if nv(m_comma) = '' and length(m_execstr) > 2
then
then
m_comma = ',';
end if;
end loop;
if G_DEBUG
then
then
perform pl_writefile(r_template.debugsql_filename, convert_to(m_debug_exestr,'utf8'));
end if;