<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=koi8-r"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.nodeattr
{mso-style-name:nodeattr;}
span.nodename
{mso-style-name:nodename;}
span.nodevalue
{mso-style-name:nodevalue;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=RU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>I have RT 4.2.3 and PostgreSQL database.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>When user creates new ticket in field “Depends on” there is such attribute:<o:p></o:p></span></p><p class=MsoNormal><span class=nodename>exclude</span><span class=nodeattr>="</span><span class=nodevalue>new</span><span class=nodeattr>"</span><span class=nodeattr><span lang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal><span class=nodeattr><span lang=EN-US>as result such request for autocomplete generates:<o:p></o:p></span></span></p><p class=MsoNormal><span lang=EN-US><a href="http://localhost:9090/ticket/Helpers/Autocomplete/Tickets?exclude=new&term=825467">http://localhost:9090/ticket/Helpers/Autocomplete/Tickets?exclude=new&term=825467</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In share/html/Helpers/Autocomplete/Tickets there are such lines:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>98 if ( @excludes ) { # exclude ids already these<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> 99 $sql = join ' AND ', "($sql)", map { qq{id != '$_'} } @excludes;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>100 }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>As result I have such SQL<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>SELECT main.* FROM Tickets main WHERE (main.IsMerged IS NULL) AND (main.Status != 'deleted') AND (main.Type = 'ticket') AND ( ( main.Subject ILIKE '%825467%' OR CAST(main.id AS TEXT) LIKE '825467%' ) AND main.id != 'new') LIMIT 10'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>And then I have database error:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ERROR: invalid input syntax for integer: "new"<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>LINE 10: AND main.id != 'new'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> ^<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>********** οΫΙΒΛΑ **********<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>ERROR: invalid input syntax for integer: "new"<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>As I see problem in comparison integer and string with operator !=. But few symbols upper above RT adds ‘cast(… as text)’.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I think problem that RT add cast as text only if see MATCHES|ENDSWITH|STARTSWITH|LIKE<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>For modification existing tickets autocomplete works fine.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>May be in file share/html/Helpers/Autocomplete/Tickets change line<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>$sql = join ' AND ', "($sql)", map { qq{id != '$_'} } @excludes;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>to <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>$sql = join ' AND ', "($sql)", map { qq{id not like '$_'} } @excludes;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>?<o:p></o:p></span></p></div></body></html>