[rt-devel] new ticket Depends On field

Орлянский Владимир enroi at mail.ru
Mon Apr 7 17:31:47 EDT 2014


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;

?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20140408/416bd768/attachment.html>


More information about the rt-devel mailing list