Hello everyone
what settings can I use to format SQL code so that this code:
SELECT sha2 ( concat_ws ( '|' , COALESCE ( column_a , '?' ) , COALESCE ( column_b , '?' ) , COALESCE ( column_c , '9000-12-31'::date ) , COALESCE ( column_d , '9000-12-31'::date ) , COALESCE ( column_e , '?' ) , COALESCE ( column_f , '9000-12-31'::date ) , COALESCE ( column_g , '?' ) , COALESCE ( column_h , '?' ) , COALESCE ( column_i , '?' ) , COALESCE ( column_j , '?' ) , COALESCE ( column_k , '?' ) , COALESCE ( column_l , '?' ) , COALESCE ( column_m , '?' ) , COALESCE ( column_n , '?' ) , COALESCE ( column_o , '?' ) , COALESCE ( column_p , '?' ) , COALESCE ( column_q , '?' ) , COALESCE ( column_r , '?' ) , COALESCE ( column_s , '?' ) , COALESCE ( column_t , '?' ) , COALESCE ( column_u , '?' ) , COALESCE ( column_v , '?' ) , COALESCE ( column_w , '?' ) , COALESCE ( column_x , '?' ) , COALESCE ( column_y , -1 ) , COALESCE ( column_z , -1 ) , COALESCE ( column_aa , '?' ) , COALESCE ( column_ab , '?' ) , COALESCE ( column_ac , '?' ) , COALESCE ( column_ad , '?' ) , COALESCE ( column_ae , '?' ) , COALESCE ( column_af , '?' ) ) , 256 ) AS bki_remit_checksum , second_column , third_column FROM test;
becomes this formatting:
SELECT sha2( concat_ws( '|' , COALESCE(column_a, '?') , COALESCE(column_b, '?') , COALESCE(column_c, '9000-12-31'::date) , COALESCE(column_d, '9000-12-31'::date) , COALESCE(column_e, '?') , COALESCE(column_f, '9000-12-31'::date) , COALESCE(column_g, '?') , COALESCE(column_h, '?') , COALESCE(column_i, '?') , COALESCE(column_j, '?') , COALESCE(column_k, '?') , COALESCE(column_l, '?') , COALESCE(column_m, '?') , COALESCE(column_n, '?') , COALESCE(column_o, '?') , COALESCE(column_p, '?') , COALESCE(column_q, '?') , COALESCE(column_r, '?') , COALESCE(column_s, '?') , COALESCE(column_t, '?') , COALESCE(column_u, '?') , COALESCE(column_v, '?') , COALESCE(column_w, '?') , COALESCE(column_x, '?') , COALESCE(column_y, -1) , COALESCE(column_z, -1) , COALESCE(column_aa, '?') , COALESCE(column_ab, '?') , COALESCE(column_ac, '?') , COALESCE(column_ad, '?') , COALESCE(column_ae, '?') , COALESCE(column_af, '?') ) , 256 ) AS bki_remit_checksum , second_column , third_column FROM test;
Thanks
Ben
Hello Benjamin,
the only way I can see is to set the max line length around 50 chars (see screenshot). It is not 100% what you want. I could add a new feature so that you can specify the name of functions where you want linebreaks before/after a comma.
Regards
Guido
That would of course be the best of all solutions.
If we had a mask in which we could determine the function and its formatting (breaks, indentations) ourselves.
That would be next level! 😍