﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34500	use annotate return feild, Error capture does not work	ajin	ajin	"when I use this sql
return data 

testcase
{{{
#!div style=""font-size: 80%""
  {{{#!python
data = table.objects.annotate(
    array_length=Func(F('feild'), function='jsonb_array_length')
).filter(array_length__gt=1).only(""feild"")[:5]
print(data.query)
for i in data:
    print(model_to_dict(i))
  }}}
}}}

sqldata
{{{
#!div style=""font-size: 80%""
  {{{#!python
  data = [[1, '[{""key"": ""value""}]', 1]]
  }}}
}}}

but when feild use from_db_value function, Error capture has no effect，because json load int data, and can not return value

{{{
#!div style=""font-size: 80%""
  {{{#!python
        try:
            return json.loads(value, cls=self.decoder)
        except json.JSONDecodeError:
            return value
  }}}
}}}

"	Bug	closed	Database layer (models, ORM)	4.2	Normal	duplicate	json decode		Unreviewed	0	0	0	0	1	0
