File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
tests/integration/targets/postgresql_alter_system/tasks Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ bugfixes :
2+ - postgresql_alter_system - fix failure when max_val contains a huge number written in scientific notation (https://github.com/ansible-collections/community.postgresql/issues/853).
Original file line number Diff line number Diff line change @@ -572,7 +572,16 @@ def convert_ret_vals(attrs):
572572 if str_contains_float (attrs [elem ]):
573573 attrs [elem ] = float (attrs [elem ])
574574 else :
575- attrs [elem ] = int (attrs [elem ])
575+ try :
576+ attrs [elem ] = int (attrs [elem ])
577+ except ValueError :
578+ # Leave the attrs[elem] as-is, i.e. a string
579+ # This can happen when max_value of type real
580+ # is huge and written in scientific notation
581+ # e.g., 1.79769e+308 (as of 2025-05-14, this is the only one)
582+ # and it doesn't make sense to convert it as it'll be really huge
583+ # https://github.com/ansible-collections/community.postgresql/issues/853
584+ pass
576585
577586 return attrs
578587
Original file line number Diff line number Diff line change 108108 - result["diff"]["before"]["setting"] == 1
109109 - result["diff"]["after"]["pending_restart"] == False
110110 - result["diff"]["after"]["setting"] == 1
111+
112+ # http://github.com/ansible-collections/community.postgresql/issues/853
113+ # it should just pass w/o any error
114+ - name : Set value of type real with a max val in scientific notation
115+ << : *task_parameters
116+ postgresql_alter_system :
117+ << : *pg_parameters
118+ param : random_page_cost
119+ value : 4
120+
121+ - name : Check max_val
122+ assert :
123+ that :
124+ - result["attrs"]["max_val"] == "1.79769e+308"
You can’t perform that action at this time.
0 commit comments