Summary | Postgresql12 dropped adsrc |
Queue | Components |
Type | Bug |
State | Unconfirmed |
Priority | 1. Low |
Owners | |
Requester | christian.ehrhardt (at) canonical (dot) com |
Created | 11/14/2019 (2008 days ago) |
Due | |
Updated | 07/29/2024 (289 days ago) |
Assigned | |
Resolved | |
Milestone | |
Patch | No |
See GitHub issue: https://github.com/horde/Db/pull/4
Cheers,
Thorsten
while groupware-install following happens:
Creating and updating database tables...
Fatal Error:
SQLSTATE[42703]: Undefined column: 7 ERROR: column def.adsrc does not exist
LINE 4: WHEN split_part(def.adsrc, '''', 2) ~ '.' TH...
^
In /usr/share/php/Horde/Db/Adapter/Pdo/Base.php on line 233
1. Horde_Core_Bundle->migrateDb() /usr/bin/groupware-install:32
2. Horde_Core_Db_Migration->getMigrator()
/usr/share/php/Horde/Core/Bundle.php:102
3. Horde_Db_Migration_Migrator->__construct()
/usr/share/php/Horde/Core/Db/Migration.php:123
4. Horde_Db_Migration_Migrator->_initializeSchemaInformation()
/usr/share/php/Horde/Db/Migration/Migrator.php:77
5. Horde_Db_Adapter_Pdo_Pgsql->insert()
/usr/share/php/Horde/Db/Migration/Migrator.php:282
6. Horde_Db_Adapter_Base->__call()
/usr/share/php/Horde/Db/Adapter/Pdo/Pgsql.php:131
7. Horde_Db_Adapter_Postgresql_Schema->pkAndSequenceFor()
/usr/share/php/Horde/Db/Adapter/Base.php:274
8. Horde_Db_Adapter_Base_Schema->__call()
/usr/share/php/Horde/Db/Adapter/Postgresql/Schema.php:1125
9. Horde_Db_Adapter_Pdo_Base->selectOne()
/usr/share/php/Horde/Db/Adapter/Base/Schema.php:166
10. Horde_Db_Adapter_Pdo_Base->execute()
/usr/share/php/Horde/Db/Adapter/Pdo/Base.php:131
11. Horde_Core_Bundle->migrateDb() /usr/bin/groupware-install:32
12. Horde_Core_Db_Migration->getMigrator()
/usr/share/php/Horde/Core/Bundle.php:102
13. Horde_Db_Migration_Migrator->__construct()
/usr/share/php/Horde/Core/Db/Migration.php:123
14. Horde_Db_Migration_Migrator->_initializeSchemaInformation()
/usr/share/php/Horde/Db/Migration/Migrator.php:77
15. Horde_Db_Adapter_Pdo_Pgsql->insert()
/usr/share/php/Horde/Db/Migration/Migrator.php:282
16. Horde_Db_Adapter_Base->__call()
/usr/share/php/Horde/Db/Adapter/Pdo/Pgsql.php:131
17. Horde_Db_Adapter_Postgresql_Schema->pkAndSequenceFor()
/usr/share/php/Horde/Db/Adapter/Base.php:274
18. Horde_Db_Adapter_Base_Schema->__call()
/usr/share/php/Horde/Db/Adapter/Postgresql/Schema.php:1125
19. Horde_Db_Adapter_Pdo_Base->selectOne()
/usr/share/php/Horde/Db/Adapter/Base/Schema.php:166
20. Horde_Db_Adapter_Pdo_Base->execute()
/usr/share/php/Horde/Db/Adapter/Pdo/Base.php:131
21. PDO->query() /usr/share/php/Horde/Db/Adapter/Pdo/Base.php:233
problem, it's there waiting for some love.
I'm trying to fix it and I'll submit a patch ASAP on github.
I've talked with the postgresql guys and it seems that that column has
been deprecated for a long time and it even risked to contain stale
data.
They have suggested me to use pg_get_expr(adbin,adrelid), but on
overall the current queries that use adsrc are a bit fragile and could
use information_schema rather than interrogating pg specific columns
and massaging strings.
Currently I've some tentative code but I'm not able to replicate
EXACTLY the return of one of the queries.
namely original query return eg.
nextval('public.horde_alarms_id_seq'::regclass)
while mine returns
nextval('horde_alarms_id_seq'::regclass)
I'm going to subscribe to horde dev mailing list and propose some
patch on github ASAP
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Components
Summary ⇒ Postgresql12 dropped adsrc
Type ⇒ Bug
State ⇒ Unconfirmed
the DB component still makes use of "adsrc".
This is a postgresql feature [1] that was deprecated for years and is
now gone. [1] also contains a hint how it should be used.
This is still in some Horde code:
$ grep -Hrn adsrc *
lib/Horde/Db/Adapter/Postgresql/Schema.php:361:
$row['attname'], $row['adsrc'], $row['format_type'],
!(boolean)$row['attnotnull']);
lib/Horde/Db/Adapter/Postgresql/Schema.php:391: SELECT
a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
lib/Horde/Db/Adapter/Postgresql/Schema.php:1136: WHEN
split_part(def.adsrc, '''', 2) ~ '.' THEN
lib/Horde/Db/Adapter/Postgresql/Schema.php:1137:
substr(split_part(def.adsrc, '''', 2),
lib/Horde/Db/Adapter/Postgresql/Schema.php:1138:
strpos(split_part(def.adsrc, '''', 2), '.')+1)
lib/Horde/Db/Adapter/Postgresql/Schema.php:1139: ELSE
split_part(def.adsrc, '''', 2)
lib/Horde/Db/Adapter/Postgresql/Schema.php:1147: AND
def.adsrc ~* 'nextval'";
Which leads to errors like the following (on test):
There were 12 errors:
1) Horde_Db_Adapter_Pdo_PgsqlTest::testColumns
Horde_Db_Exception: SQLSTATE[42703]: Undefined column: 7 ERROR:
column d.adsrc does not exist
LINE 2: ... a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a...
^
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/lib/Horde/Db/Adapter/Pdo/Base.php:237
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/lib/Horde/Db/Adapter/Pdo/Base.php:109
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/lib/Horde/Db/Adapter/Base/Schema.php:166
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/lib/Horde/Db/Adapter/Postgresql/Schema.php:385
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/lib/Horde/Db/Adapter/Postgresql/Schema.php:347
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/lib/Horde/Db/Adapter/Base.php:274
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/test/Horde/Db/Adapter/TestBase.php:519
/tmp/autopkgtest.uUKdVj/build.XmB/src/Horde_Db-2.4.0/test/Horde/Db/Adapter/Pdo/PgsqlTest.php:159
Caused by
PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column
d.adsrc does not exist
LINE 2: ... a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a...
...
[1]: https://www.postgresql.org/docs/8.3/catalog-pg-attrdef.html