I dug through the logs a bit, and discovered that the following query was being executed to retrieve the table schema:
SELECT c.column_name AS field,
c.data_type AS type,
c.column_default AS defval,
c.is_nullable AS nullable,
t.constraint_type AS pkey
FROM information_schema.columns AS c
LEFT OUTER JOIN information_schema.key_column_usage AS k
ON c.table_name = k.table_name
AND c.column_name = k.column_name
AND c.table_schema = k.table_schema
LEFT OUTER JOIN information_schema.table_constraints AS t
ON k.table_name = t.table_name
AND k.constraint_name = t.constraint_name
AND k.table_schema = t.table_schema
WHERE c.table_name = 'builds'
AND c.table_schema = 'test****';
The query was trying to enforce that the table_schema
field contain the database name! No wonder it wasn't finding any columns. Going to lib/db/sql/sql.php
and changing line 249 from this:
($this->engine=='pgsql'?
'c.table_catalog':'c.table_schema').
to this:
($this->engine=='pgsql'||$this->engine== 'sqlsrv'?
'c.table_catalog':'c.table_schema').
fixes the problem. I am not aware of how other DBs store the field indicating the database name, so I suppose it is best to be conservative and only make this change for SQL server databases, where I am sure it is needed.