new ticket Depends On field

Орлянский Владимир <[email protected]>
Newsgroups gmane.comp.bug-tracking.request-tracker.devel
Message-ID <[email protected]>
I have RT 4.2.3 and PostgreSQL database.

When user creates new ticket in field "Depends on"  there is such attribute:

exclude="new"

as result such request for autocomplete generates:

http://localhost:9090/ticket/Helpers/Autocomplete/Tickets?exclude=new
<http://localhost:9090/ticket/Helpers/Autocomplete/Tickets?exclude=new&term=
825467> &term=825467

In share/html/Helpers/Autocomplete/Tickets there are such lines:

98 if ( @excludes ) { # exclude ids already these

99     $sql = join ' AND ', "($sql)", map { qq{id != '$_'} } @excludes;

100 }

As result I have such SQL

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'

And then I have database error:

ERROR:  invalid input syntax for integer: "new"

LINE 10:    AND main.id != 'new'

                           ^

********** Ошибка **********

 

ERROR: invalid input syntax for integer: "new"

As I see problem in comparison integer and string with operator !=. But few
symbols upper above RT adds 'cast(: as text)'.

I think problem that RT add cast as text only if see
MATCHES|ENDSWITH|STARTSWITH|LIKE

For modification existing tickets autocomplete works fine.

May be in file share/html/Helpers/Autocomplete/Tickets change line

$sql = join ' AND ', "($sql)", map { qq{id != '$_'} } @excludes;

to 

$sql = join ' AND ', "($sql)", map { qq{id not like '$_'} } @excludes;

?

-- 
RT Training - Dallas May 20-21
http://bestpractical.com/training
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.