<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=RepairSearches</id>
	<title>RepairSearches - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=RepairSearches"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;action=history"/>
	<updated>2026-08-22T06:56:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;diff=3128&amp;oldid=prev</id>
		<title>Admin: 4 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;diff=3128&amp;oldid=prev"/>
		<updated>2016-04-06T20:36:15Z</updated>

		<summary type="html">&lt;p&gt;4 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:36, 6 April 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-3127:rev-3128 --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;diff=3127&amp;oldid=prev</id>
		<title>89.18.225.71: /* You screwed youR own search preferences */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;diff=3127&amp;oldid=prev"/>
		<updated>2011-04-16T10:02:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;You screwed youR own search preferences&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:02, 16 April 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l115&quot;&gt;Line 115:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 115:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It runs again!&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It runs again!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== You screwed &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;you &lt;/del&gt;own search preferences ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== You screwed &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;your &lt;/ins&gt;own search preferences ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Get rid of them very easy:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Get rid of them very easy:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-3126:rev-3127:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>89.18.225.71</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;diff=3126&amp;oldid=prev</id>
		<title>89.18.225.71: /* You screwed your Saved Search */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=RepairSearches&amp;diff=3126&amp;oldid=prev"/>
		<updated>2011-04-16T10:01:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;You screwed your Saved Search&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== Reasons and impacts of broken searches ===&lt;br /&gt;
&lt;br /&gt;
* You played around with the searches and now the links disappeared&lt;br /&gt;
* RT links the own tickets to the wrong location:&lt;br /&gt;
** rt lives below /rt, but clicking on my own tickets gives a link to /Ticket/Display.html?...&lt;br /&gt;
** search works, selecting unowned tickets also works&lt;br /&gt;
** This is a known bug in 3.6.1 (at least)&lt;br /&gt;
** The Webpath variable is set correct:&lt;br /&gt;
*** 09:32 &amp;amp;lt; telmich&amp;amp;gt; rt23# grep [[WebPath]] /usr/local/rt3/etc/[[RT SiteConfig|RT_SiteConfig]].pm&lt;br /&gt;
*** 09:32 &amp;amp;lt; telmich&amp;amp;gt; Set($[[WebPath]] , &amp;quot;/rt&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
== How to fix ==&lt;br /&gt;
&lt;br /&gt;
=== Missing Take and view links in 3.6.3 ===&lt;br /&gt;
&lt;br /&gt;
Editing a saved search can remove the Take or View links from the &amp;quot;top N issues&amp;quot; searches. These can be put back as follows&lt;br /&gt;
&lt;br /&gt;
* remove the field that you wish to have as a link from the field list (usually ID and subject)&lt;br /&gt;
* re-select the field in the left hand list&lt;br /&gt;
* in the links section choose Take or View from the drop-down, set the title (to view or take), the size to large and the format to bold&lt;br /&gt;
* click the right arrow button to add the link to your field list&lt;br /&gt;
* move the field back up the list to where it used to be&lt;br /&gt;
* save the search&lt;br /&gt;
&lt;br /&gt;
=== Pre 3.6 ===&lt;br /&gt;
&lt;br /&gt;
The problem is in the database, so we have to fix it there.&lt;br /&gt;
&lt;br /&gt;
Backup your database BEFORE CONTINUING!&lt;br /&gt;
&lt;br /&gt;
Like: pg_dump -U rt rt3 &amp;amp;gt; rt3-before-delete-repair.psql&lt;br /&gt;
&lt;br /&gt;
Normally nothing goes wrong, but having a backup is much better than having none and breaking it.&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;My Tickets&amp;quot;-Problem (3.6.1-problem) ===&lt;br /&gt;
&lt;br /&gt;
Use your database tool (I use psql, because I use postgresql) and find out the id of the search:&lt;br /&gt;
&lt;br /&gt;
 select id, Name from Attributes WHERE Name = &amp;#039;Search - My Tickets&amp;#039;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Write down that id. Do not mess it up.&lt;br /&gt;
&lt;br /&gt;
Then delete that entry:&lt;br /&gt;
&lt;br /&gt;
 DELETE FROM Attributes WHERE id = &amp;amp;lt;YOUR-ID&amp;amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; In my case, this was &amp;quot;DELETE FROM Attributes WHERE id = 1;&amp;quot;. Be sure to use &amp;#039;&amp;#039;&amp;#039;YOUR&amp;#039;&amp;#039;&amp;#039; id! &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now create a file named &amp;quot;repair-search&amp;quot;, that contains the data we want to import with the following content (that is also found in etc/initialdata):&lt;br /&gt;
&lt;br /&gt;
 @Attributes = (&lt;br /&gt;
    { Name =&amp;amp;gt; &amp;#039;Search - My Tickets&amp;#039;,&lt;br /&gt;
      Description =&amp;amp;gt; &amp;#039;[_1] highest priority tickets I own&amp;#039;, # loc&lt;br /&gt;
      Content     =&amp;amp;gt;&lt;br /&gt;
      { Format =&amp;amp;gt; &amp;quot;&amp;#039;&amp;amp;lt;a href=\&amp;quot;__WebPath__/Ticket/Display.html?id=__id__\&amp;quot;&amp;amp;gt;__id__&amp;amp;lt;/a&amp;amp;gt;/TITLE:#&amp;#039;, &amp;#039;&amp;amp;lt;a href=\&amp;quot;__WebPath__/Ticket/Display.html?id=__id__\&amp;quot;&amp;amp;gt;__Subject__&amp;amp;lt;/a&amp;amp;gt;/TITLE:Subject&amp;#039;, Priority, QueueName, ExtendedStatus&amp;quot;,&lt;br /&gt;
        Query   =&amp;amp;gt; &amp;quot; Owner = &amp;#039;__CurrentUser__&amp;#039; AND ( Status = &amp;#039;new&amp;#039; OR Status = &amp;#039;open&amp;#039;)&amp;quot;,&lt;br /&gt;
        OrderBy =&amp;amp;gt; &amp;#039;Priority&amp;#039;,&lt;br /&gt;
        Order   =&amp;amp;gt; &amp;#039;DESC&amp;#039; },&lt;br /&gt;
    },&lt;br /&gt;
 );&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Pay attention: Copy and paste may be broken, please extract that lines from etc/initialdata to be sure!&lt;br /&gt;
&lt;br /&gt;
Now import it into the rt:&lt;br /&gt;
&lt;br /&gt;
 sudo ./sbin/rt-setup-database --action insert --datafile repair-search --dba postgres&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
You should know, whether you have to use sudo and to to select the correct dba.&lt;br /&gt;
&lt;br /&gt;
And tada: Now it works!&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;Unowned Tickets&amp;quot; problem ===&lt;br /&gt;
&lt;br /&gt;
I just screwed it up when playing around with rt. The way is very similar to the one above:&lt;br /&gt;
&lt;br /&gt;
 select id, Name from Attributes WHERE Name = &amp;#039;Search - Unowned Tickets&amp;#039;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Remember the id, delete that attribute:&lt;br /&gt;
&lt;br /&gt;
 DELETE FROM Attributes WHERE id = &amp;amp;lt;YOUR-ID&amp;amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
In my case this was DELETE FROM Attributes WHERE id = 2;&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;#039;rt-patch-search&amp;#039; containg the original search:&lt;br /&gt;
&lt;br /&gt;
 @Attributes = (&lt;br /&gt;
    { Name =&amp;amp;gt; &amp;#039;Search - Unowned Tickets&amp;#039;,&lt;br /&gt;
      Description =&amp;amp;gt; &amp;#039;[_1] newest unowned tickets&amp;#039;, # loc&lt;br /&gt;
      Content     =&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;#039;Take&amp;#039; #loc&lt;br /&gt;
&lt;br /&gt;
      { Format =&amp;amp;gt; &amp;quot;&amp;#039;&amp;amp;lt;a href=\&amp;quot;__WebPath__/Ticket/Display.html?id=__id__\&amp;quot;&amp;amp;gt;__id__&amp;amp;lt;/a&amp;amp;gt;/TITLE:#&amp;#039;, &amp;#039;&amp;amp;lt;a href=\&amp;quot;__WebPath__/Ticket/Display.html?id=__id__\&amp;quot;&amp;amp;gt;__Subject__&amp;amp;lt;/a&amp;amp;gt;/TITLE:Subject&amp;#039;, QueueName, ExtendedStatus, CreatedRelative, &amp;#039;&amp;amp;lt;A HREF=\&amp;quot;__WebPath__/Ticket/Display.html?Action=Take&amp;amp;amp;id=__id__\&amp;quot;&amp;amp;gt;__loc(Take)__&amp;amp;lt;/a&amp;amp;gt;/TITLE: &amp;#039; &amp;quot;, Query   =&amp;amp;gt; &amp;quot; Owner = &amp;#039;Nobody&amp;#039; AND ( Status = &amp;#039;new&amp;#039; OR Status = &amp;#039;open&amp;#039;)&amp;quot;,&lt;br /&gt;
        OrderBy =&amp;amp;gt; &amp;#039;Created&amp;#039;,&lt;br /&gt;
        Order   =&amp;amp;gt; &amp;#039;DESC&amp;#039; },&lt;br /&gt;
    },&lt;br /&gt;
 );&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(again: please copy from your etc/initialdata, so now copy and paste error will make things worse)&lt;br /&gt;
&lt;br /&gt;
And then import it:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/rt3/sbin/rt-setup-database --action insert --datafile rt-patch-search --dba postgres&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It runs again!&lt;br /&gt;
&lt;br /&gt;
=== You screwed you own search preferences ===&lt;br /&gt;
&lt;br /&gt;
Get rid of them very easy:&lt;br /&gt;
&lt;br /&gt;
 SELECT id FROM Users WHERE EmailAddress = &amp;#039;Your@E-Mail&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
Write down that id and use it in the following query:&lt;br /&gt;
&lt;br /&gt;
 DELETE FROM Attributes WHERE ObjectType = &amp;#039;RT::User&amp;#039; AND ObjectId = &amp;amp;lt;YOUR-ID&amp;amp;gt; AND Name LIKE &amp;#039;Pref-RT::Attribute-%&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
In my case this was DELETE FROM Attributes WHERE [[ObjectType]] = &amp;#039;RT::User&amp;#039; AND [[ObjectId]] = 22 AND Name LIKE &amp;#039;Pref-RT::Attribute-%&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
=== You screwed your Saved Search ===&lt;br /&gt;
Error message &amp;quot;Error near -&amp;gt;days&amp;lt;- expecting a PAREN in &amp;lt;TicketSQL query clause&amp;gt; I&amp;#039;m lost&amp;quot; (RT 3.6.7) may come when loading previously messed up saved search query.&lt;br /&gt;
&lt;br /&gt;
Heres how to get rid of saved search:&lt;br /&gt;
&lt;br /&gt;
Fetch your numeric userid with username or email address:&lt;br /&gt;
&lt;br /&gt;
  SELECT id,Name,EmailAddress FROM Users WHERE Name=&amp;amp;lt;YOUR-USERID&amp;amp;gt; OR EmailAddress=&amp;#039;&amp;amp;lt;Your@E-Mail&amp;amp;gt;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Write down your user id and perform query to fetch all saved searches for that id:&lt;br /&gt;
&lt;br /&gt;
  SELECT id,Name,Description,ContentType,ObjectType,ObjectId,Creator,Created,LastUpdatedBy,LastUpdated&lt;br /&gt;
    FROM Attributes&lt;br /&gt;
    WHERE Name = &amp;#039;SavedSearch&amp;#039; AND Creator=&amp;amp;lt;YOUR-ID&amp;amp;gt; AND ObjectType=&amp;#039;RT::User&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
Identify the id of problematic search from Description column and delete it:&lt;br /&gt;
&lt;br /&gt;
  DELETE FROM Attributes WHERE id=&amp;amp;lt;SEARCH-ID&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  SELECT id,Name,EmailAddress FROM Users WHERE Name=&amp;#039;joe&amp;#039; OR EmailAddress=&amp;#039;joe@example.invalid&amp;#039;;&lt;br /&gt;
  +------+------+---------------------+&lt;br /&gt;
  | id   | Name | EmailAddress        |&lt;br /&gt;
  +------+------+---------------------+&lt;br /&gt;
  | 6596 | joe  | joe@example.invalid | &lt;br /&gt;
  +------+------+---------------------+&lt;br /&gt;
  1 row in set (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
  SELECT id,Name,Description,ObjectType,ObjectId,Creator FROM Attributes&lt;br /&gt;
  WHERE Name = &amp;#039;SavedSearch&amp;#039; AND Creator=6596 AND ObjectType=&amp;#039;RT::User&amp;#039;;&lt;br /&gt;
  +------+-------------+-------------------+------------+----------+---------+&lt;br /&gt;
  | id   | Name        | Description       | ObjectType | ObjectId | Creator |&lt;br /&gt;
  +------+-------------+-------------------+------------+----------+---------+&lt;br /&gt;
  | 1242 | SavedSearch | Some other search | RT::User   |     6596 |    6596 | &lt;br /&gt;
  | 2347 | SavedSearch | Screwed up search | RT::User   |     6596 |    6596 | &lt;br /&gt;
  +------+-------------+-------------------+------------+----------+---------+&lt;br /&gt;
  2 rows in set (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
  DELETE FROM Attributes WHERE id=2347;&lt;br /&gt;
  Query OK, 1 row affected (0.03 sec)&lt;/div&gt;</summary>
		<author><name>89.18.225.71</name></author>
	</entry>
</feed>