<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.ioguix.net/index.php?feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>ioguix' README</title>
  <link>http://blog.ioguix.net/index.php?</link>
  <atom:link href="http://blog.ioguix.net/index.php?feed/rss2" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Thu, 23 May 2013 19:41:27 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Normalizing queries with pg_stat_statements &lt; 9.2</title>
    <link>http://blog.ioguix.net/index.php?post/2012/08/06/Normalizing-queries-with-pg_stat_statements-9.2</link>
    <guid isPermaLink="false">urn:md5:3d8133b05167a2318a5103df602308f0</guid>
    <pubDate>Mon, 06 Aug 2012 19:53:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>function</category><category>pg_stat_statements</category><category>postgresql</category><category>SQL</category>    
    <description>    &lt;p&gt;Hey,&lt;/p&gt;


&lt;p&gt;If you follow PostgreSQL's development or &lt;a href=&quot;http://www.depesz.com/2012/03/30/waiting-for-9-2-pg_stat_statements-improvements/&quot; hreflang=&quot;en&quot; title=&quot;Depesz&amp;#039; blog&quot;&gt;Depesz' blog&lt;/a&gt;, you might know that &quot;&lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/pgstatstatements.html&quot; hreflang=&quot;en&quot; title=&quot;pg_stat_statement&quot;&gt;pg_stat_statement&lt;/a&gt;&quot; extension is getting a lot of improvement in 9.2 and especially is able to «lump &quot;similar&quot; queries together». I will not re-phrase here what Despsz already explain on his blog.&lt;/p&gt;


&lt;p&gt;So, we have this great feature in 9.2, but what about previous release ? Until 9.1, &quot;pg_stat_statement&quot; is keeping track of most frequent queries individually. No normalization, nothing. It's been a while I've been thinking about importing pgFouine/pgBadger normalization code in SQL. Next pieces of code are tested under PostgreSQL 9.1 but should be easy to port to previous versions. So here is the function to create (I tried my best to keep it readable :-)):&lt;/p&gt;

&lt;pre&gt;
CREATE OR REPLACE FUNCTION normalize_query(IN TEXT, OUT TEXT) AS $body$
  SELECT
    regexp_replace(regexp_replace(regexp_replace(regexp_replace(
    regexp_replace(regexp_replace(regexp_replace(regexp_replace(

    lower($1),
    
    -- Remove extra space, new line and tab caracters by a single space
    '\s+',                          ' ',           'g'   ),

    -- Remove string content                       
    $$\\'$$,                        '',            'g'   ),
    $$'[^']*'$$,                    $$''$$,        'g'   ),
    $$''('')+$$,                    $$''$$,        'g'   ),

    -- Remove NULL parameters                      
    '=\s*NULL',                     '=0',          'g'   ),

    -- Remove numbers                              
    '([^a-z_$-])-?([0-9]+)',        '\1'||'0',     'g'   ),

    -- Remove hexadecimal numbers                  
    '([^a-z_$-])0x[0-9a-f]{1,10}',  '\1'||'0x',    'g'   ),

    -- Remove IN values                            
    'in\s*\([''0x,\s]*\)',          'in (...)',    'g'   )
  ;
$body$
LANGUAGE SQL;
&lt;/pre&gt;


&lt;p&gt;Keep in mind that I extracted these regular expressions straight from pgfouine/pgbadger. Any comment about how to make it quicker/better/simpler/whatever is appreciated !&lt;/p&gt;


&lt;p&gt;Here the associated view to group everything according to the normalized queries :&lt;/p&gt;
&lt;pre class=&quot;sql sql&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REPLACE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;VIEW&lt;/span&gt; pg_stat_statements_normalized &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; userid&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; dbid&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; normalize_query&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;query&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; query&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;calls&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; calls&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;total_time&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; total_time&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;rows&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; rows&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;shared_blks_hit&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; shared_blks_hit&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;shared_blks_read&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; shared_blks_read&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;shared_blks_written&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; shared_blks_written&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;local_blks_hit&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; local_blks_hit&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;local_blks_read&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; local_blks_read&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;local_blks_written&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; local_blks_written&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; 
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;temp_blks_read&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; temp_blks_read&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;
  sum&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;temp_blks_written&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; temp_blks_written
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; pg_stat_statements
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;GROUP&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BY&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;;&lt;/pre&gt;


&lt;p&gt;Using this function and the view, a small pgbench test (-t 30 -c 10), gives:&lt;/p&gt;
&lt;pre class=&quot;sql sql&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; round&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;total_time::numeric&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;calls&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; avg_time&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; calls&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; 
  round&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;total_time::numeric&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; total_time&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; rows&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; query 
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; pg_stat_statements_normalized 
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BY&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DESC&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;
 avg_time | calls | total_time | rows |                                               query                                               
----------+-------+------------+------+---------------------------------------------------------------------------------------------------
     0.05 |   187 |       9.86 |  187 | update pgbench_accounts set abalance = abalance + 0 where aid = 0;
     0.01 |   195 |       2.30 |  195 | update pgbench_branches set bbalance = bbalance + 0 where bid = 0;
     0.00 |   300 |       0.00 |    0 | begin;
     0.00 |   300 |       0.00 |    0 | end;
     0.00 |   196 |       0.00 |  196 | insert into pgbench_history (tid, bid, aid, delta, mtime) values (0, 0, 0, 0, current_timestamp);
     0.00 |   193 |       0.00 |  193 | select abalance from pgbench_accounts where aid = 0;
     0.00 |   183 |       0.26 |  183 | update pgbench_tellers set tbalance = tbalance + 0 where tid = 0;
     0.00 |     1 |       0.00 |    0 | truncate pgbench_history


&lt;/pre&gt;


&lt;p&gt;For information, the real non-normalized &quot;pg_stat_statement&quot; view is 959 lines:&lt;/p&gt;

&lt;pre class=&quot;sql sql&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; count&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; pg_stat_statements;&lt;/pre&gt;
&lt;pre&gt;
 count 
-------
   959
(1 ligne)
&lt;/pre&gt;


&lt;p&gt;Obvisouly, regular expression are not magic and this will never be as strict as the engine itself. But at least it helps while waiting for 9.2 in production !&lt;/p&gt;


&lt;p&gt;Do not hesitate to report me bugs and comment to improve it !&lt;/p&gt;


&lt;p&gt;Cheers,&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2012/08/06/Normalizing-queries-with-pg_stat_statements-9.2#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2012/08/06/Normalizing-queries-with-pg_stat_statements-9.2#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/19</wfw:commentRss>
      </item>
    
  <item>
    <title>Using pgBagder and logsaw for scheduled reports</title>
    <link>http://blog.ioguix.net/index.php?post/2012/08/06/Using-pgBagder-and-logsaw-for-scheduled-reports</link>
    <guid isPermaLink="false">urn:md5:a6ad93c857b2343e9ce0702ef48372ac</guid>
    <pubDate>Mon, 06 Aug 2012 15:37:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>logsaw</category><category>perl</category><category>pgbadger</category><category>postgresql</category><category>tail_n_mail</category>    
    <description>    &lt;p&gt;Hey,&lt;/p&gt;


&lt;p&gt;While waiting for next version of pgBadger, here is a tip to create scheduled pgBadger report. For this demo, I'll suppose :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;we have PostgreSQL's log files in &quot;/var/log/pgsql&quot;&lt;/li&gt;
&lt;li&gt;we want to produce a weekly report using pgBadger with the &quot;postgres&quot; system user...&lt;/li&gt;
&lt;li&gt;...so we keep at least 8 days of log&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You will need &lt;a href=&quot;https://github.com/dalibo/pgbadger/downloads&quot; hreflang=&quot;en&quot; title=&quot;pgbadger&quot;&gt;pgbadger&lt;/a&gt; and &lt;a href=&quot;https://github.com/dalibo/logsaw/downloads&quot; hreflang=&quot;en&quot; title=&quot;logsaw&quot;&gt;logsaw&lt;/a&gt;. Both tools are under BSD license and pure perl script with no dependencies.&lt;/p&gt;


&lt;p&gt;&quot;logsaw&quot; is a tool aimed to parse log files, looking for some regexp-matching lines, printing them to standard output and remembering where it stop last time. At start, it searches for the last line it parsed on the previous call, and starts working from there. Yes, for those familiar with &quot;tail_n_mail&quot;, it does the same thing, but without the mail and report processing part. Moreover (not sure about &quot;tail_n_mail&quot;), it supports rotation and compression of log files. Thanks to this tool, we'll be able to create new reports from where the last one finished !&lt;/p&gt;


&lt;p&gt;We need to create a simple configuration file for logsaw:&lt;/p&gt;
&lt;pre class=&quot;bash bash&quot;&gt;$ &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cat&lt;/span&gt; &lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;EOF &lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; ~postgres&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;.logsaw
&lt;span style=&quot;color: #007800;&quot;&gt;LOGDIR&lt;/span&gt;=&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;log&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;pgsql&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;
EOF&lt;/pre&gt;


&lt;p&gt;There's three more optional parameters in this configuration file you might want to know:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;if you want to process some particular files, you can use the &quot;LOGFILES&quot; parameter, a regular expression to filter files in the &quot;LOGDIR&quot; folder. When not defined, the default empty string means: «take all files in the folder».&lt;/li&gt;
&lt;li&gt;if your log files are compressed, you can use the &quot;PAGER&quot; parameter which should be a command that uncompress your log files to standard output, eg. &quot;PAGER=zcat -f&quot;. Note that if available, &quot;logsaw&quot; will use silently &quot;IO::Zlib&quot; to read your compressed files.&lt;/li&gt;
&lt;li&gt;you can filter extracted lines from log files using the &quot;REGEX&quot; parameters. You can add as many &quot;REGEX&quot; parameter than needed, each of them must be a regular expression. When not defined, the default empty &quot;REGEX&quot; array means: «match all the lines».&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each time you call &quot;logsaw&quot;, it saves its states to your configuration file, adding parameters &quot;FILEID&quot; and &quot;OFFSET&quot;.&lt;/p&gt;


&lt;p&gt;That's it for &quot;logsaw&quot;. See its README files for more details, options and sample configuration file.&lt;/p&gt;


&lt;p&gt;Now, the command line to create the report:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot;&gt;$ logsaw &lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;|&lt;/span&gt; pgbadger &lt;span style=&quot;color: #660033;&quot;&gt;-g&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-o&lt;/span&gt; &lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;path&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;to&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;/&lt;/span&gt;report-$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;date&lt;/span&gt; +&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;%&lt;/span&gt;Y&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;%&lt;/span&gt;m&lt;span style=&quot;color: #66CC66; font-weight: bold;&quot;&gt;%&lt;/span&gt;d&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;.html -&lt;/pre&gt;


&lt;p&gt;You might want to add the &quot;-f&quot; option to pgbadger if it doesn't guess the log format itself (stderr or syslog or csv).&lt;/p&gt;


&lt;p&gt;About creating reports on a weekly basis, let's say every sunday at 2:10am, using crontab:&lt;/p&gt;

&lt;pre&gt;
  10 2 1-7 * 7  logsaw | pgbadger -g -o /path/to/report-$(date +%Y%m%d).html -
&lt;/pre&gt;


&lt;p&gt;Here you go, enjoy :)&lt;/p&gt;


&lt;p&gt;That's why I like UNIX style and spirit commands: simple single-task but powerful and complementary tools.&lt;/p&gt;


&lt;p&gt;Wait or help for more nice features in pgBadger !&lt;/p&gt;


&lt;p&gt;Cheers !&lt;/p&gt;


&lt;p&gt;PS: There's another tool to deal with log files and reports you might be interested in: &quot;logwatch&quot;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2012/08/06/Using-pgBagder-and-logsaw-for-scheduled-reports#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2012/08/06/Using-pgBagder-and-logsaw-for-scheduled-reports#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/18</wfw:commentRss>
      </item>
    
  <item>
    <title>phpPgAdmin 5.0.2 in Debian unstable !</title>
    <link>http://blog.ioguix.net/index.php?post/2011/06/16/phpPgAdmin-5.0.2-in-Debian-unstable-%21</link>
    <guid isPermaLink="false">urn:md5:56cf9124d05b013a4bb3efcefe3fcef1</guid>
    <pubDate>Thu, 16 Jun 2011 01:19:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
            
    <description>    &lt;p&gt;Today, &lt;a href=&quot;http://www.df7cb.de/&quot; hreflang=&quot;en&quot; title=&quot;Christoph Berg&quot;&gt;Christoph Berg&lt;/a&gt; has uploaded a new version of the phpPgAdmin package to the Debian unstable branch. This package is based on the latest version of phpPgAdmin: 5.0.2.&lt;/p&gt;


&lt;p&gt;This story starts around another beer during the &lt;a href=&quot;http://www.pgcon.org/2011/&quot; hreflang=&quot;en&quot; title=&quot;PGCon2011&quot;&gt;PGCon2011&lt;/a&gt;. I was talking with &lt;a href=&quot;http://blog.tapoueh.org/&quot; hreflang=&quot;en&quot; title=&quot;Dimitri Fontaine&quot;&gt;Dimitri Fontaine&lt;/a&gt; about the status of the PostgreSQL's Debian repository driven by our community. I explained him how bad was the situation about phpPgAdmin's package that was stuck at the 4.2.3 version for all debian like distributions. Because of that, we received a bunch of bug reports, comments and mails about things we already fixed in new versions.&lt;/p&gt;


&lt;p&gt;As Dimitri is working with Christoph on the PostgreSQL Debian repo, he gave me his email address telling me that, as an official Debian developer, he could probably help me. After some discussion about me becoming the official package maintainer, it seems Christophe finally did the package pretty quickly and added himself as co-maintainer of the project.&lt;/p&gt;


&lt;p&gt;In conclusion, I'm glad to see a new package maintainer for our PPA package and I'll do my best to help him on this purpose. Thank you to Christoph and Dimitri&amp;nbsp;!&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2011/06/16/phpPgAdmin-5.0.2-in-Debian-unstable-%21#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2011/06/16/phpPgAdmin-5.0.2-in-Debian-unstable-%21#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/16</wfw:commentRss>
      </item>
    
  <item>
    <title>2nd chance for my PGCon 2011 Lightning Talk</title>
    <link>http://blog.ioguix.net/index.php?post/2011/05/20/2nd-chance-for-my-PGCon-2011-Lightning-Talk</link>
    <guid isPermaLink="false">urn:md5:18aa241733ba6facf79c8bd5bc892224</guid>
    <pubDate>Fri, 20 May 2011 01:15:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>perl</category><category>pgcon</category><category>pgshark</category><category>postgresql</category>    
    <description>    &lt;p&gt;I'm proud to announce I'm the only one that couldn't finish his Lightning talk on time this year.&lt;/p&gt;


&lt;p&gt;Someone had to do it to justify Magnus work as a speaker cutter after 5min, so I picked the job :)&lt;/p&gt;


&lt;p&gt;Here is your second chance to watch my &lt;a href=&quot;http://ioguix.net/lightning_talk-pgshark.html&quot; hreflang=&quot;en&quot;&gt;lightning talk slides&lt;/a&gt; online.&lt;/p&gt;


&lt;p&gt;Too bad I hadn't time to explain how I wanted to kill pgfouine and how a &quot;Replay&quot; script on top of pgShark might be awesome for benchmarking and testing purpose...&lt;/p&gt;


&lt;p&gt;Hopefully I'll be able to make a longer talk at &lt;a href=&quot;http://2011.pgconf.eu/&quot; hreflang=&quot;en&quot;&gt;pgconf.eu&lt;/a&gt;&amp;nbsp;!&lt;/p&gt;


&lt;p&gt;Gleu: yeah I know, you warned me :-)&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2011/05/20/2nd-chance-for-my-PGCon-2011-Lightning-Talk#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2011/05/20/2nd-chance-for-my-PGCon-2011-Lightning-Talk#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/15</wfw:commentRss>
      </item>
    
  <item>
    <title>GSoC project &quot;New phpPgAdmin Plugin Architecture&quot; accepted</title>
    <link>http://blog.ioguix.net/index.php?post/2011/04/26/GSoC-project-New-phpPgAdmin-Plugin-Architecture-accepted</link>
    <guid isPermaLink="false">urn:md5:4c76bdb17853a2d8e35c615f39726cdd</guid>
    <pubDate>Tue, 26 Apr 2011 21:28:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>gsoc</category><category>php</category><category>phppgadmin</category><category>postgresql</category>    
    <description>    &lt;p&gt;Leonardo's project has been accepted for the GSoC 2011 today !&lt;/p&gt;


&lt;p&gt;Knowing a bit Leonardo, I'm sure he will make everything possible to finish this project, or going as far as he can. One thing to keep in mind about leonardo and that I learned a bit late last year: as a Brazilian student, he was actually still studying at school while working for the GSoC 2010 !&lt;/p&gt;


&lt;p&gt;Moreover, Leonardo kept sending some small comments and contributions &lt;strong&gt;out of the GSoC&lt;/strong&gt; during the year. This is in my opinion the best thing about the GSoC: making students meet some FOSS communities, get used to it, team working and turning them into real new contributors.&lt;/p&gt;


&lt;p&gt;...but this year, he will have two mentors to convince ! Both &lt;a href=&quot;http://andreas.scherbaum.la/blog/&quot; title=&quot;Andreas Scherbaum&quot;&gt;Andreas Scherbaum&lt;/a&gt; and me will tutor Leonardo on this project, helping him and discussing the code on ppa-dev and irc://irc.freenode.net/#phppgadmin.&lt;/p&gt;


&lt;p&gt;It will be the first contributions of Andreas Scherbaum to PPA and I'm really looking forward having some fresh eyes and manpower on the project !&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2011/04/26/GSoC-project-New-phpPgAdmin-Plugin-Architecture-accepted#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2011/04/26/GSoC-project-New-phpPgAdmin-Plugin-Architecture-accepted#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/14</wfw:commentRss>
      </item>
    
  <item>
    <title>let's play with PostgreSQL network dumps !</title>
    <link>http://blog.ioguix.net/index.php?post/2011/03/28/let-s-play-with-network-dump-%21</link>
    <guid isPermaLink="false">urn:md5:2e54ecc343202db51a7c99b14c2df241</guid>
    <pubDate>Tue, 29 Mar 2011 11:30:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>perl</category><category>pgshark</category><category>postgresql</category>    
    <description>    &lt;p&gt;A bit more than a year ago, I start messing with tshark &lt;a href=&quot;http://www.nbee.org/doku.php?id=netpdl:pdml_specification&quot; hreflang=&quot;en&quot;&gt;pdml output&lt;/a&gt; to be able to extract queries from a network dump. As I was writing a PoC, I did it in PHP.&lt;/p&gt;


&lt;p&gt;As it was relying on tshark, I called it « pgShark ». pgShark worked and was useful a couple of time, but had some drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;really, really slow&lt;/li&gt;
&lt;li&gt;PHP is not the best language to parse and mess with data&lt;/li&gt;
&lt;li&gt;one useless step: pcap -&amp;gt; XML/PDML -&amp;gt; parsing&lt;/li&gt;
&lt;li&gt;I have no fun coding in PHP&lt;/li&gt;
&lt;li&gt;support only a limited part of the PostgreSQL protocol&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I decided to rewrite it from scratch using Perl and the Net::Pcap module.&lt;/p&gt;


&lt;p&gt;Why Perl? First, probably the most frequent reasons people are using Perl are : portable and fast about parsing data. Then, I discovered the useful Net::Pcap module, directly binded to the libpcap. And finally, I wanted to learn a bit more about Perl than just quick scripting and I needed a challenging project :)&lt;/p&gt;


&lt;p&gt;At first I wanted a very simple program, dealing with frontend messages only and using a plugin architecture to process them and output useful and various informations. But then, I realized it could go way further, crazy ideas about plugins pop up in my mind and quickly I faced the fact that I will have to support the whole PostgreSQL's protocol, not just a small specific part.&lt;/p&gt;


&lt;p&gt;The project started in early February 2011 and eat all my open source related personal and professional time until now. I finally managed to add the last missing PostgreSQL messages on Monday 28th march.&lt;/p&gt;


&lt;p&gt;So I guess the pgShark::Core module is now stable enough to focus on plugins. I'll have to split this project in two pieces at some point and release this core on its own.&lt;/p&gt;


&lt;p&gt;One of the most exciting plugin is &quot;Fouine&quot;. Yeah, if you know pgFouine, you understand this plugin's purpose (and if you don't, &lt;a href=&quot;http://pgfouine.projects.postgresql.org/&quot; hreflang=&quot;en&quot;&gt;here is the pgfouine project&lt;/a&gt;). Having Fouine as a plugin of pgShark has many advantages. One of the most important one is the ability to extract way much more statistics from network. Think about errors, notices, session time, busy ratio, amount of data per sessions, connections statistics, you name it...
Another really important point is that you don't need to tweak your PostgreSQL log behaviour. No need to log every query, no need to change the &lt;em&gt;log_line_header&lt;/em&gt; parameter or using syslog if you don't want to. You just leave your PostgreSQL configuration the way you love it. Even better: working on network dumps means you can snif anywhere in between the frontend and the backend, having 0% performance penalty on your PostgreSQL box.&lt;/p&gt;


&lt;p&gt;Check the output example page from pgshark's wiki:  &lt;a href=&quot;https://github.com/dalibo/pgshark/wiki&quot; hreflang=&quot;en&quot;&gt;https://github.com/dalibo/pgshark/wiki&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;The plugins are all in alpha development stage and need some more work for accuracy or bug fix, but they already spit some useful datas!&lt;/p&gt;


&lt;p&gt;Here is my TODO list for plugins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fix SQL plugin in regards with named portals (prepared statements with binded datas)&lt;/li&gt;
&lt;li&gt;work on the &lt;a href=&quot;https://github.com/dalibo/pgshark/raw/34ae7706611778f8f012c9980f7d714def78b6e7/pgShark/Fouine.pm&quot; hreflang=&quot;en&quot;&gt;TODO&lt;/a&gt; list for the Fouine plugin (includes accuracy of statistics)&lt;/li&gt;
&lt;li&gt;make graphical reports (HTML) from the Fouine plugin&lt;/li&gt;
&lt;li&gt;graph various stats from the Fouine plugin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have another really useful plugin idea, but really challenging. Hopefully I'll be able to start it and blog about it soon ! However, I suspect I'll have to take some of my time on phpPgAdmin very soon, as I was pretty much idle on it for a while now and stuff are staking on this TODO list as well.&lt;/p&gt;


&lt;p&gt;So here is the project's home: &lt;a href=&quot;https://github.com/dalibo/pgshark&quot; hreflang=&quot;en&quot;&gt;https://github.com/dalibo/pgshark&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2011/03/28/let-s-play-with-network-dump-%21#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2011/03/28/let-s-play-with-network-dump-%21#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/13</wfw:commentRss>
      </item>
    
  <item>
    <title>New phpPgAdmin website</title>
    <link>http://blog.ioguix.net/index.php?post/2010/12/10/new-phpPgAdmin-website</link>
    <guid isPermaLink="false">urn:md5:d4f627d1bf4767a488b870c9e3bf5376</guid>
    <pubDate>Tue, 29 Mar 2011 00:02:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>php</category><category>phppgadmin</category><category>postgresql</category>    
    <description>    &lt;p&gt;Some days or week ago now, I released a new website for phpPgAdmin.&lt;/p&gt;


&lt;p&gt;Goals were to refresh a bit its old fashion style, but most importantly to move it to a wiki. And &lt;a href=&quot;http://phppgadmin.sourceforge.net/doku.php&quot; hreflang=&quot;en&quot;&gt;here it is&lt;/a&gt; !&lt;/p&gt;


&lt;p&gt;I hope this will help us to keep the FAQ up-to-date, ease the website update and help us to centralize all project informations and data in one place (and outside of CVS !).&lt;/p&gt;


&lt;p&gt;Thanks to the &lt;a href=&quot;http://postgresql.fr&quot; hreflang=&quot;fr&quot;&gt;postgresql.fr&lt;/a&gt; team for their work on hosting the beta version until sf.net finally update their hosting services.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2010/12/10/new-phpPgAdmin-website#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2010/12/10/new-phpPgAdmin-website#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/3</wfw:commentRss>
      </item>
    
  <item>
    <title>GSoC project ideas for phpPgAdmin</title>
    <link>http://blog.ioguix.net/index.php?post/2011/03/28/GSoC-project-ideas-for-phpPgAdmin</link>
    <guid isPermaLink="false">urn:md5:de55db0f371a50b8d6f14df001ee8f89</guid>
    <pubDate>Mon, 28 Mar 2011 21:25:00 +0200</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>gsoc</category><category>php</category><category>phppgadmin</category><category>postgresql</category>    
    <description>    &lt;p&gt;GSoC season started !&lt;/p&gt;


&lt;p&gt;PostgreSQL has been accepted this year  again as project organization. Big thanks to Selena and others to handle this for the community ! You can find the PostgreSQL GSoC 2011 page &lt;a href=&quot;http://wiki.postgresql.org/wiki/GSoC_2011&quot; hreflang=&quot;en&quot;&gt;here&lt;/a&gt;.  As far as I know, student projects submissions starts today.&lt;/p&gt;


&lt;p&gt;phpPgAdmin is a sub-project of the PostgreSQL organization and already had 3 or 4 projects accepted in past GSoC programs.&lt;/p&gt;


&lt;p&gt;I was mentoring last year's (only) project for phpPgAdmin and enjoy it. Leonardo Augusto Sápiras was the student that worked on this project and did a good job. He was working hard, learning how to use community's tools, how to communicate with us, discussing issues, code and managed to finish his project in time. All his work was committed during or soon after the end of the GSoC...everything while still being at school as a Brazilian student !&lt;/p&gt;


&lt;p&gt;Good news is that he's motivated this year again and is currently writing a proposal to add a long time wanted feature: a proper plugin architecture. It might be a good subject for another blog post later. Hopefully his proposal will be accepted.&lt;/p&gt;


&lt;p&gt;So, here are some more ideas for PPA :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;support PostgreSQL 9.1&lt;/li&gt;
&lt;li&gt;switch PPA to UTF-8 only&lt;/li&gt;
&lt;li&gt;graphical explain: kind of a merge between pgAdmin one and the excellent http://explain.depesz.com/. But to be honest, as I told to Leonardo, I would like to keep it for me&lt;/li&gt;
&lt;li&gt;add support for multi-edit/delete/add data from tables&lt;/li&gt;
&lt;li&gt;drop adodb keeping the compatibility. A lots of advantages here: remove dependency, ability to use some postgresql-only php function, lighter low-level db access layer, last but not least: ability to keep a full history of PPA queries,downloading it etc&lt;/li&gt;
&lt;li&gt;support for showing/editing database/user/database+user/function specific configuration parameters&lt;/li&gt;
&lt;li&gt;cleanup / improve xhtml code for better themes, accessibility and add some more theme&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Plus, check our TODO file for a bunch of pending &lt;a href=&quot;https://github.com/phppgadmin/phppgadmin/raw/master/TODO&quot; hreflang=&quot;en&quot;&gt;TODOs&lt;/a&gt; or our  &lt;a href=&quot;https://sourceforge.net/tracker/?group_id=37132&amp;amp;atid=418983&quot; hreflang=&quot;en&quot;&gt;feature request&lt;/a&gt; list on sf.net for more ideas !&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2011/03/28/GSoC-project-ideas-for-phpPgAdmin#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2011/03/28/GSoC-project-ideas-for-phpPgAdmin#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/12</wfw:commentRss>
      </item>
    
  <item>
    <title>Problems and workaround about recreating implicit casts when upgrading to 8.3+</title>
    <link>http://blog.ioguix.net/index.php?post/2010/12/10/Problems-and-workaround-about-recreating-implicit-casts-when-upgrading-to-8.3</link>
    <guid isPermaLink="false">urn:md5:4a0cfb247926157bbfeba8852664a2de</guid>
    <pubDate>Sat, 11 Dec 2010 16:00:00 +0100</pubDate>
    <dc:creator>ioguix</dc:creator>
        <category>postgresql</category>
        <category>postgresql</category>    
    <description>    &lt;p&gt;I start reading Gregory Smith book «&amp;nbsp;PostgreSQL 9.0 High performance&amp;nbsp;» some days ago. Quickly, he's talking about this very popular issue when upgrading to version 8.3 and bellow&amp;nbsp;: the removal of some implicit casts from text types to time or numerical ones in 8.3. Obviously, the only clean solution here is to fix the application itself.&lt;/p&gt;


&lt;p&gt;However, for those that cannot afford quickly such a work, it also points to a popular quick workaround that and suffer from a side effect. Then, it remind me I found another quick-n-dirty fix about a year ago I spoke a bit on our favorite chan. Again, keep in mind that the only clean way to go is fix your application if you hit this problem&amp;nbsp;!&lt;/p&gt;


&lt;p&gt;So here is the problem:&lt;/p&gt;
&lt;pre class=&quot;sql sql&quot;&gt;casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; generate_series&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; id;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt;
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
ERROR:  operator does &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; exist: integer &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; text
LINE &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; : &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
                                                         ^
TIPS : No operator matches the given name &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AND&lt;/span&gt; argument type&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;s&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt; You might need &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TO&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ADD&lt;/span&gt; explicit type casts&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;The very well known solution is to recreate some of these implicit casts that were removed in 8.3. Peter Eisentraut blogged about that, you'll find his SQL script &lt;a href=&quot;http://petereisentraut.blogspot.com/2008/03/readding-implicit-casts-in-postgresql.html&quot; hreflang=&quot;en&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;However, as some users noticed in the comments, there is a side effect bug with this solution: it can breaks the concatenation operator:&lt;/p&gt;

&lt;pre class=&quot;sql sql&quot;&gt;casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# BEGIN ;
BEGIN
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# \i &lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;tmp&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;implicit_casts&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;sql 
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; CAST
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;-- [...]&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; CAST
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
ERROR:  operator &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;UNIQUE&lt;/span&gt;: unknown &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; integer
LINE &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; : &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
                                ^
TIPS : Could &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; choose a best candidate operator&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt; You might need &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TO&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ADD&lt;/span&gt; explicit type casts&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# ROLLBACK ;
ROLLBACK&lt;/pre&gt;


&lt;p&gt;Oops.&lt;/p&gt;


&lt;p&gt;From here, the solution could be to cast one of the operand&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;sql sql&quot;&gt;casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id::text &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
  &lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;|&lt;/span&gt; value &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;But then, we are back to the application fix where it might worth spending more time fixing things in the good way.&lt;/p&gt;


&lt;p&gt;There is another solution: creating missing operators instead of implicit casts. Here is a sql file with a lot of those operators:
&lt;a href=&quot;http://blog.ioguix.net/public/operators_workaround.sql&quot;&gt;operators_workaround.sql&lt;/a&gt; and a sample with text to integer:&lt;/p&gt;
&lt;pre class=&quot;sql sql&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt; pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;texteqint&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;text&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; integer&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; RETURNS &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BOOLEAN&lt;/span&gt; STRICT IMMUTABLE &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LANGUAGE&lt;/span&gt; SQL &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; $$SELECT textin&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;int4out&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; $&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;;$$;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt; pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;inteqtext&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;integer&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; text&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; RETURNS &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BOOLEAN&lt;/span&gt; STRICT IMMUTABLE &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LANGUAGE&lt;/span&gt; SQL &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; $$SELECT textin&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;int4out&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; $&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;;$$;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; OPERATOR pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; PROCEDURE &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;texteqint&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; LEFTARG&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;text&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; RIGHTARG&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;integer&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; COMMUTATOR&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;OPERATOR&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.=&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; OPERATOR pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; PROCEDURE &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;inteqtext&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; LEFTARG&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;integer&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; RIGHTARG&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;text&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; COMMUTATOR&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;OPERATOR&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;pg_catalog&lt;span style=&quot;color: #66cc66;&quot;&gt;.=&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/pre&gt;


&lt;p&gt;And here is the same previous test:&lt;/p&gt;
&lt;pre class=&quot;sql sql&quot;&gt;casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# BEGIN ;
BEGIN
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# \i &lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;tmp&lt;span style=&quot;color: #66cc66;&quot;&gt;/&lt;/span&gt;create_operators&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;sql 
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;-- [...]&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; OPERATOR
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;-- [...]&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; OPERATOR
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
  &lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;|&lt;/span&gt; value &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt;
&amp;nbsp;
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;-- what, you don't trust me ?&lt;/span&gt;
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# ROLLBACK ;
ROLLBACK
casts&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;# &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
ERROR:  operator does &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; exist: integer &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; text
LINE &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; : &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; id&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'value = '&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; test &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'5'&lt;/span&gt;::text;
                                                         ^
TIPS : No operator matches the given name &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AND&lt;/span&gt; argument type&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;s&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt; You might need &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TO&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ADD&lt;/span&gt; explicit type casts&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Same advice from Peter here: if possible, only create the operators you need to fix your application&amp;nbsp;!&lt;/p&gt;


&lt;p&gt;So far, I only had &lt;strong&gt;one&lt;/strong&gt; positive feedback about this workaround about a year ago, and I don't consider this is enough to actually claim it is a safe solution. So please, comments, tests and reports are welcome&amp;nbsp;!&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2010/12/10/Problems-and-workaround-about-recreating-implicit-casts-when-upgrading-to-8.3#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2010/12/10/Problems-and-workaround-about-recreating-implicit-casts-when-upgrading-to-8.3#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/2</wfw:commentRss>
      </item>
    
  <item>
    <title>« install done. »</title>
    <link>http://blog.ioguix.net/index.php?post/2010/12/06/Bienvenue-sur-Dotclear%C2%A0%21</link>
    <guid isPermaLink="false">urn:md5:3a25fd0091fd59dc99eecf305757a95f</guid>
    <pubDate>Mon, 06 Dec 2010 18:33:00 +0100</pubDate>
    <dc:creator>ioguix</dc:creator>
            
    <description>    &lt;pre&gt;$ ./configure --prefix=blog.ioguix.net&lt;br /&gt;$ make&lt;br /&gt;# make install&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.ioguix.net/index.php?post/2010/12/06/Bienvenue-sur-Dotclear%C2%A0%21#comment-form</comments>
      <wfw:comment>http://blog.ioguix.net/index.php?post/2010/12/06/Bienvenue-sur-Dotclear%C2%A0%21#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.ioguix.net/index.php?feed/atom/comments/1</wfw:commentRss>
      </item>
    
</channel>
</rss>