<table><tr><td style="">knauss added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D21154">View Revision</a></tr></table><br /><div><div><p>overall I like this patch - that is great an brings postgresql more to a usable db interface.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21154#inline-118932">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dbconfigpostgresql.cpp:98</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #74777d">// Don't break once PostgreSQL 10 is released, but something more future-proof will be needed</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">path</span><span class="p">.</span><span class="n">fileName</span><span class="p">().</span><span class="n">startsWith</span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"10."</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">postgresVersionedSearchPaths</span><span class="p">.</span><span class="n">prepend</span><span class="p">(</span><span class="n">path</span><span class="p">.</span><span class="n">absoluteFilePath</span><span class="p">()</span> <span style="color: #aa2211">+</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"/bin"</span><span class="p">));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">We do another if clause for version 11?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21154#inline-118934">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dbconfigpostgresql.cpp:209</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #74777d">// Looks like "pg_ctl (PostgreSQL) 11.2"</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span style="color: #aa4000">auto</span> <span class="n">output</span> <span style="color: #aa2211">=</span> <span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">fromUtf8</span><span class="p">(</span><span class="n">pgctl</span><span class="p">.</span><span class="n">readAll</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">For Debian it looks like:</p>
<p style="padding: 0; margin: 8px;">pg_ctl (PostgreSQL) 11.3 (Debian 11.3-1)</p>
<p style="padding: 0; margin: 8px;">I would make the regex more explicit, to match to the correct version:</p>
<p style="padding: 0; margin: 8px;">re(QStringLiteral("\(PostgreSQL\) ([0-9]+).[0-9]+"))</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21154#inline-118935">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dbconfigpostgresql.cpp:254</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #74777d">// TODO: Check Debian-based distros, they might install previous PSQL versions into a</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #74777d">// different directory.</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">};</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">for Debian it is just:</p>
<p style="padding: 0; margin: 8px;">/usr/lib/postgresql/%1/bin/</p>
<p style="padding: 0; margin: 8px;">You should use the same logic like in postgresSearchPath from DbConfigPostgresql::init to find the old bin dir. I can't see why the old version should be located differently.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21154#inline-118939">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dbconfigpostgresql.cpp:260</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">baseDir</span><span class="p">.</span><span class="n">exists</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"old_db_data"</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">qCInfo</span><span class="p">(</span><span class="n">AKONADISERVER_LOG</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"Postgres cluster update: old_db_data cluster already exists, trying to remove it first"</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">please change order to:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">search for oldBinPath (line 268)</li>
<li class="remarkup-list-item">test if oldBinPath.isEmpty(line 275)</li>
<li class="remarkup-list-item">remove old_db_data (l260)</li>
</ol>
<p style="padding: 0; margin: 8px;">This is more in the sense, that we do not touch anything, if the old Postgres is not installed, as we can't migrate at all.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21154#inline-118943">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dbconfigpostgresql.cpp:282</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #74777d">// Next, initialize a new cluster</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span class="n">QString</span> <span class="n">newDbData</span> <span style="color: #aa2211">=</span> <span class="n">baseDir</span><span class="p">.</span><span class="n">path</span><span class="p">()</span> <span style="color: #aa2211">+</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"/new_db_data"</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">shouldn't we check if newDbData alread exists before runInitDb? because this is properly an error sate, as newDbData should not exist at this state.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R165 Akonadi </div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21154">https://phabricator.kde.org/D21154</a></div></div><br /><div><strong>To: </strong>dvratil, KDE PIM<br /><strong>Cc: </strong>knauss, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, dvratil<br /></div>