fix: rewrite query for postgres (#20557)
This commit is contained in:
parent
a1aaed0a5f
commit
fa32b610d6
2 changed files with 6 additions and 2 deletions
|
|
@ -264,7 +264,11 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):
|
|||
({search_condition})
|
||||
{mcond} {condition}
|
||||
order by
|
||||
if(locate(%(_txt)s, `tabAddress`.name), locate(%(_txt)s, `tabAddress`.name), 99999),
|
||||
case
|
||||
when locate(%(_txt)s, `tabAddress`.name) != 0
|
||||
then locate(%(_txt)s, `tabAddress`.name)
|
||||
else 99999
|
||||
end,
|
||||
`tabAddress`.idx desc, `tabAddress`.name
|
||||
limit %(page_len)s offset %(start)s""".format(
|
||||
mcond=get_match_cond(doctype),
|
||||
|
|
|
|||
|
|
@ -54,5 +54,5 @@ class TestAddress(FrappeTestCase):
|
|||
}
|
||||
).insert()
|
||||
|
||||
self.assertGreaterEqual(len(query(txt="admin")), 1)
|
||||
self.assertGreaterEqual(len(query(txt="Admin")), 1)
|
||||
self.assertEqual(len(query(txt="what_zyx")), 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue