Affects Version/s: 3.15.2
Fix Version/s: None
QueryTableColumns contains an SQL syntax error accidentally included in c588174e78, whose fix is trivial (cfe-db-patch-1.patch).
Still QueryTableColumns doesn't work for Postgres, as, given a "db.table" promisee, the MariaDB connector creates a table identified by:
while the PostgreSQL one creates a table identified by:
TABLE_CATALOG = def, TABLE_SCHEMA = db, TABLE_NAME = table
TABLE_CATALOG = db, TABLE_SCHEMA = public, TABLE_NAME = table
Again, the fix is trivial (cfe-db-patch-2.patch).
Still this doesn't fix the promise, and things are getting more complicated. I haven't had the time to fully investigate, so I'm just scratching the surface. At least with MariaDB, the QueryTableColumns fails when an int column is involved, as in that case CHARACTER_MAXIMUM_LENGTH is always NULL and the field length is embedded in the COLUMN_TYPE column in the form int.
Tested on Debian sid (unstable) with CFEngine=3.15.2, MariaDB=10.3, PostgreSQL=12.4. Confirmed on CFEngine core git HEAD.