Read the part about how to define the table + the gist index. The whole custom_sql thing assumes a familiarity with sql. you can choose to not have a digits_prefix column and just change the datatype of prefix to prefix. You can do what I did which is to have prefix be text and digits_prefix be of type prefix and a trigger to keep the two in sync. the key is that you are searching against the prefix column for which there is a GIST index. <br>
<br><div class="gmail_quote">On Thu, Jun 10, 2010 at 2:53 AM, Madovsky <span dir="ltr"><<a href="mailto:infos@madovsky.org">infos@madovsky.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff">
<div><font size="2">ok thanks I will read again</font></div>
<div><font size="2"></font> </div>
<div><font size="2">F</font></div>
<blockquote style="border-left:#000000 2px solid;padding-left:5px;padding-right:0px;margin-left:5px;margin-right:0px"><div class="im">
<div style="font:10pt arial">----- Original Message ----- </div>
<div style="font:10pt arial;background:#e4e4e4"><b>From:</b>
<a title="gcd@i.ph" href="mailto:gcd@i.ph" target="_blank">Nandy Dagondon</a> </div>
<div style="font:10pt arial"><b>To:</b> <a title="freeswitch-users@lists.freeswitch.org" href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>
</div>
</div><div><div></div><div class="h5"><div style="font:10pt arial"><b>Sent:</b> Thursday, June 10, 2010 3:09
AM</div>
<div style="font:10pt arial"><b>Subject:</b> Re: [Freeswitch-users]
mod_lcr</div>
<div><br></div>it's the digits_prefix in the WHERE clause that's causing the
error. <br><br>ur question re prefix+digits, it's explained in the Custom SQL
portion in the wiki.<br><br>-nandy<br><br><br>
<div class="gmail_quote">On Thu, Jun 10, 2010 at 2:56 PM, Madovsky <span dir="ltr"><<a href="mailto:infos@madovsky.org" target="_blank">infos@madovsky.org</a>></span> wrote:<br>
<blockquote style="border-left:rgb(204,204,204) 1px solid;margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">
<div bgcolor="#ffffff">
<div><font size="2">ok so it needs also the alias l.digits in the condition I
think.</font></div>
<div><font size="2">I'm a little confused about digits and
prefix.</font></div>
<div><font size="2">if I check a number with the country code is it need to
join</font></div>
<div><font size="2">prefix+digits ? how with this kinkd of sql request
?</font></div>
<div><font size="2"></font> </div>
<div><font size="2">Thanks</font></div>
<div><font size="2"></font> </div>
<div><font size="2">F</font></div>
<blockquote style="border-left:rgb(0,0,0) 2px solid;padding-left:5px;padding-right:0px;margin-left:5px;margin-right:0px">
<div>
<div></div>
<div>
<div style="font:10pt arial">----- Original Message ----- </div>
<div style="font:10pt arial;background:rgb(228,228,228)"><b>From:</b>
<a title="gcd@i.ph" href="mailto:gcd@i.ph" target="_blank">Nandy Dagondon</a>
</div>
<div style="font:10pt arial"><b>To:</b> <a title="freeswitch-users@lists.freeswitch.org" href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a> </div>
<div style="font:10pt arial"><b>Sent:</b> Thursday, June 10, 2010 2:44
AM</div>
<div style="font:10pt arial"><b>Subject:</b> Re: [Freeswitch-users]
mod_lcr</div>
<div><br></div>i think it's a typo. i changed digits_prefix to digits. to
be sure, pls check the CREATE TABLE entries. <br>-nandy<br><br><br>
<div class="gmail_quote">On Thu, Jun 10, 2010 at 2:16 PM, Madovsky <span dir="ltr"><<a href="mailto:infos@madovsky.org" target="_blank">infos@madovsky.org</a>></span> wrote:<br>
<blockquote style="border-left:rgb(204,204,204) 1px solid;margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">
<div bgcolor="#ffffff">
<div><font size="2">I'm experimenting with mod_lcr with postgresql
(8.4.4)</font></div>
<div><font size="2">there s an example of custom sql on wiki below
:</font></div>
<div><font size="2"></font> </div>
<div><pre> <profile name="use_prefix">
<param name="custom_sql" value="
SELECT l.digits, c.carrier_name, l.${lcr_rate_field}, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix,
l.lead_strip, l.trail_strip, l.prefix, l.suffix, cg.codec, l.cid
FROM lcr l
JOIN carriers c ON l.carrier_id=<a href="http://c.id" target="_blank">c.id</a>
JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id
WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1'
AND digits_prefix @> '%q'
AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end
ORDER BY digits DESC, ${lcr_rate_field} asc, random();
"/>
</profile>
</pre><pre><font face="Arial">however the query failed cause of digits_prefix field doesn't exist in the table.</font></pre><pre><font face="Arial">is it a typo ? or does it need a field concatenation of prefix and digits ?</font></pre>
<pre><font face="Arial">Thanks</font></pre><pre><font face="Arial"></font> </pre><pre><font face="Arial">Franck</font></pre></div></div><br>_______________________________________________<br>FreeSWITCH-users
mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div>
<p></p>
<hr>
<div>
<p></p>_______________________________________________<br>FreeSWITCH-users
mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></blockquote></div><br>_______________________________________________<br>FreeSWITCH-users
mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
</div></div><p>
</p><hr><div class="im">
<p></p>_______________________________________________<br>FreeSWITCH-users
mailing
list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div><p></p></blockquote></div>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>