<div dir="ltr"><div>Thanks, Done. <br></div><div><br></div><div>bug 412818</div><div><a href="https://bugs.kde.org/show_bug.cgi?id=412818">https://bugs.kde.org/show_bug.cgi?id=412818</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 10, 2019 at 11:53 AM Harald Sitter <<a href="mailto:sitter@kde.org">sitter@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey,<br>
<br>
Please file bug reports about issues:<br>
<a href="https://bugs.kde.org/enter_bug.cgi?product=Akonadi" rel="noreferrer" target="_blank">https://bugs.kde.org/enter_bug.cgi?product=Akonadi</a><br>
<br>
On Thu, Oct 10, 2019 at 12:29 AM Stuart <<a href="mailto:sfbarbee@gmail.com" target="_blank">sfbarbee@gmail.com</a>> wrote:<br>
><br>
> Dear development team,<br>
><br>
> As per the PostgreSQL release documents:<br>
> E.1. Release 12<br>
> <a href="https://www.postgresql.org/docs/12/release-12.html#id-1.11.6.5.5" rel="noreferrer" target="_blank">https://www.postgresql.org/docs/12/release-12.html#id-1.11.6.5.5</a><br>
><br>
> PostgreSQL Version 12 removes:<br>
><br>
> obsolete pg_constraint.consrc column<br>
> obsolete pg_attrdef.adsrc column<br>
><br>
><br>
> Akonadi executes this query that fails due to changes in the PostgreSQL schema<br>
><br>
> DB=akonadi USER=akonadi SELECT pg_attribute.attname, pg_attribute.atttypid::int, pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, pg_attrdef.adsrc FROM pg_class, pg_attribute LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) WHERE pg_table_is_visible(pg_class.oid) AND pg_class.relname = 'schemaversiontable' AND pg_attribute.attnum > 0 AND pg_attribute.attrelid = pg_class.oid AND pg_attribute.attisdropped = false ORDER BY pg_attribute.attnum<br>
> DB=akonadi USER=akonadi SELECT ERROR: 42703: column pg_attrdef.adsrc does not exist at character 128<br>
> DB=akonadi USER=akonadi SELECT pg_attribute.attname, pg_attribute.atttypid::int, pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, pg_attrdef.adsrc FROM pg_class, pg_attribute LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) WHERE pg_table_is_visible(pg_class.oid) AND pg_class.relname = 'schemaversiontable' AND pg_attribute.attnum > 0 AND pg_attribute.attrelid = pg_class.oid AND pg_attribute.attisdropped = false ORDER BY pg_attribute.attnum<br>
> DB=akonadi USER=akonadi ALTER TABLE SchemaVersionTable ADD COLUMN version INTEGER NOT NULL DEFAULT 0<br>
> DB=akonadi USER=akonadi ALTER TABLE ERROR: 42701: column "version" of relation "schemaversiontable" already exists<br>
><br>
><br>
> This causes akonadi to repeatedly try to update the SchemaVersionTable and quits with error.<br>
><br>
> org.kde.pim.akonadiserver: Starting up the Akonadi Server...<br>
> org.kde.pim.akonadiserver: Running DB initializer<br>
> org.kde.pim.akonadiserver: "\nSql error: ERROR: column \"version\" of relation \"schemaversiontable\" already exists\n(42701) QPSQL: Unable to create query\nQuery: ALTER TABLE SchemaVersionTable ADD COLUMN version INTEGER NOT NULL DEFAULT 0"<br>
> org.kde.pim.akonadiserver: Unable to initialize database.<br>
> org.kde.pim.akonadiserver: Shutting down AkonadiServer...<br>
><br>
><br>
> The schema information for these dropped columes can be obtained using the functions<br>
><br>
> pg_constraint.consrc pg_get_constraintdef(pg_constraint.oid)<br>
> pg_attrdef.adsrc pg_get_expr(pg_attrdef.adbin, pg_class.oid)<br>
><br>
> So the Akonadi query:<br>
><br>
> SELECT pg_attribute.attname, pg_attribute.atttypid::int, pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, pg_attrdef.adsrc<br>
> FROM pg_class, pg_attribute<br>
> LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum)<br>
> WHERE pg_table_is_visible(pg_class.oid)<br>
> AND pg_class.relname = 'schemaversiontable'<br>
> AND pg_attribute.attnum > 0<br>
> AND pg_attribute.attrelid = pg_class.oid<br>
> AND pg_attribute.attisdropped = false ORDER BY pg_attribute.attnum ;<br>
><br>
> should probably be changed to something like:<br>
><br>
> SELECT pg_attribute.attname, pg_attribute.atttypid::int, pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, pg_get_expr(pg_attrdef.adbin, pg_class.oid) AS adsrc<br>
> FROM pg_class<br>
> LEFT JOIN pg_attribute ON ( pg_attribute.attrelid = pg_class.oid )<br>
> LEFT JOIN pg_attrdef ON ( pg_attrdef.adrelid = pg_attribute.attrelid<br>
> AND pg_attrdef.adnum = pg_attribute.attnum )<br>
> WHERE pg_table_is_visible(pg_class.oid)<br>
> AND pg_class.relname = 'schemaversiontable'<br>
> AND pg_attribute.attnum > 0<br>
> AND pg_attribute.attisdropped = false<br>
> ORDER BY pg_attribute.attnum;<br>
><br>
> This will produce something like the following table:<br>
><br>
> attname | atttypid | attnotnull | attlen | atttypmod | adsrc<br>
> ------------+----------+------------+--------+-----------+-------<br>
> version | 23 | t | 4 | -1 | 0<br>
> generation | 23 | t | 4 | -1 | 0<br>
> (2 rows)<br>
><br>
</blockquote></div>