You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Trino SHOW COLUMNS only returns the first row #28630
Since upgrading from Trino v477 to Trino v479, the behavior of SHOW COLUMNS FROM table has changed:
In v477, the command show all columns of all tables. Querying the information_schema.columns table shows all columns from all tables.
In v479, the command only shows the first column of the table. Querying the information_schema.columns table shows only the first column of each table.
Expected behaviour
Aligned on v477, the command SHOW COLUMNS FROM table show all columns of the table. Querying the information_schema.columns table shows all columns from the table.
@findepi, @ebyhr we are checking for a reproducible example. What is complex is that we observe this behaviour in several cases but not all. We are trying to isolate the configuration that causes this.
Additionally, we are using OPA integration with custom policies. We observe the behaviour even with admin users having full access (as part of the policy).
We will update the ticket once we isolate the problem.
Where it happens: JDBC connectors when bulk column listing is used (JdbcClient.getAllTableColumns / DatabaseMetaData.getColumns without a table filter).
Steps to reproduce
Use any JDBC catalog/connector that supports bulk column listing.
Enable bulk listing for the session:
SET SESSION .bulk_list_columns = true;
Create at least two tables in the same schema, each with multiple columns (e.g. t1(a,b,c) and t2(x,y,z)).
Run:
SELECT table_name, column_name FROM .information_schema.columns WHERE table_schema = '' AND table_name IN ('t1','t2') ORDER BY table_name, ordinal_position;
and/or SHOW COLUMNS FROM ..t1; / SHOW COLUMNS FROM ..t2;
Observed on v479 (bug)
The first column of each table after the first one is skipped in the bulk listing result set, so information_schema.columns can end up missing the first column for subsequent tables (and depending on how results are consumed, appear to show only one column per table).
Expected
All columns for all tables are returned (as in v477).
Root cause (code)
In BaseJdbcClient.IterateTableColumns, when switching from one table group to the next, the iterator returns the previous table metadata without processing the current ResultSet row (which is the first column of the new table). On the next computeNext() call, resultSet.next() advances past that unprocessed row, so it is lost.
@sachinsharma3191 i tried to follow the steps but failed to reproduce the problem
I was using Trino with MySQL connector as started by io.trino.plugin.mysql.MySqlQueryRunner#main on current Trino master.
then
use mysql.tpch;
set session mysql.bulk_list_columns= true; -- it's the default for MySQL connector anywaydroptable if exists t1;
createtablet1(a int, b int, c int);
droptable if exists t2;
createtablet2(a int, b int, c int);
desc t1;
desc t2;
select*frominformation_schema.columnswhere table_name in ('t1', 't2');
output is correct
trino:tpch> use mysql.tpch;
->
-> set session mysql.bulk_list_columns = true;
->
-> drop table if exists t1;
-> create table t1(a int, b int, c int);
->
-> drop table if exists t2;
-> create table t2(a int, b int, c int);
->
-> desc t1;
-> desc t2;
->
-> select * from information_schema.columns where table_name in ('t1', 't2');
USE
SET SESSION
DROP TABLE
CREATE TABLE
DROP TABLE
CREATE TABLE
Column | Type | Extra | Comment
--------+---------+-------+---------
a | integer | |
b | integer | |
c | integer | |
(3 rows)
Query 20260319_133058_00088_ukyqe, FINISHED, 3 nodes
Splits: 17 total, 17 done (100.00%)
0.15 [3 rows, 637B] [19 rows/s, 4.12KiB/s]
Column | Type | Extra | Comment
--------+---------+-------+---------
a | integer | |
b | integer | |
c | integer | |
(3 rows)
Query 20260319_133058_00089_ukyqe, FINISHED, 3 nodes
Splits: 17 total, 17 done (100.00%)
0.15 [3 rows, 637B] [19 rows/s, 4.12KiB/s]
table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type
---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------
mysql | tpch | t2 | a | 1 | NULL | YES | integer
mysql | tpch | t2 | b | 2 | NULL | YES | integer
mysql | tpch | t2 | c | 3 | NULL | YES | integer
mysql | tpch | t1 | a | 1 | NULL | YES | integer
mysql | tpch | t1 | b | 2 | NULL | YES | integer
mysql | tpch | t1 | c | 3 | NULL | YES | integer
(6 rows)
Query 20260319_133058_00090_ukyqe, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.17 [6 rows, 396B] [35 rows/s, 2.32KiB/s]
Note that bulk_list_columns is a hidden property acting as a kill switch for bulk column listing for connectors that do support bulk column listing.
It is hidden and not supposed to be set by users.
I used MySQL connector because it does support bulk column listing.
Some questions to you
Are you using one of the connectors that support bulk column listing?
Or, maybe, are you forcing bulk listing on a connector which does not support it?
Which connector are you using?
Can you provide exact steps to reproduce the problem? See my previous comment for how this should look like.
We encountered the same symptom on Trino 478 + OPA batched FilterColumns with the Iceberg connector (REST catalog via Gravitino).
Our Environment
Trino version: 478
Connector: Iceberg (non-JDBC) with REST catalog (Gravitino)
Access Control: OPA with opa.policy.batched-uri configured
Symptom
information_schema.columns, DESCRIBE, SHOW COLUMNS, and SELECT * all return only the first column for every Iceberg table. SHOW CREATE TABLE returns all columns correctly (reads Iceberg metadata directly, bypasses information_schema).
Root Cause (in our case)
Our OPA batch policy was missing a dedicated FilterColumns handler. When Trino sends a FilterColumns batch request, the payload structure differs from other filter operations:
Unlike FilterTables/FilterSchemas (where each resource is a separate item in filterResources[]), FilterColumns sends one resource with a columns array inside. The batch response must return indices into the columns array, not the filterResources array.
Our generic batch rules only matched on resource.table.catalogName, which matched index 0 (the single table resource) — Trino interpreted this as "allow only the first column."
Fix (OPA Policy — no Trino code change needed)
We added this Rego rule to our batch policy:
# FilterColumns: return all column indices (no column-level ACL)
batch contains i if {
some i, _ in input.action.filterResources[0]["table"]["columns"]
input.action.operation == "FilterColumns"
any_role # your allow-all predicate
}
After applying this + OPA pod restart, information_schema.columns correctly returns all columns.
Note
This is a different code path from the JDBC bulk-listing bug described in this issue (BaseJdbcClient.IterateTableColumns), but produces the identical symptom. Users with OPA batch mode enabled should check whether their policy correctly handles the FilterColumns operation's unique payload structure.
The Trino OPA documentation does mention this corner case at the bottom of the batch mode section, but it's easy to miss.
Thanks, we figured that out as well thanks to Trino documentation. I thought I had posted a comment on this issue, but this is not the case... Sorry to the community for that.
Indeed, the corner case fix mentioned in the doc and in your comment solves the problem.
Activity
ebyhr commentedon Mar 12, 2026
@maxsbs Could you share the entire steps to reproduce? The config properties (please redact credentials), CREATE TABLE, and etc.
Fix SHOW COLUMNS and information_schema.columns returning only first …
Fix SHOW COLUMNS and information_schema.columns returning only first …
Fix SHOW COLUMNS and information_schema.columns returning only first …
Fix SHOW COLUMNS and information_schema.columns returning only first …
Fix SHOW COLUMNS and information_schema.columns returning only first …
findepi commentedon Mar 16, 2026
the #28653 further adds
that code was added in 450 though.
as @ebyhr already pointed out, it would be great to have steps to reproduce the problem.
maxsbs commentedon Mar 16, 2026
@findepi, @ebyhr we are checking for a reproducible example. What is complex is that we observe this behaviour in several cases but not all. We are trying to isolate the configuration that causes this.
Additionally, we are using OPA integration with custom policies. We observe the behaviour even with admin users having full access (as part of the policy).
We will update the ticket once we isolate the problem.
sachinsharma3191 commentedon Mar 19, 2026
Repro details (for validating PR #28653):
Trino versions: regression in v479 vs v477
Where it happens: JDBC connectors when bulk column listing is used (JdbcClient.getAllTableColumns / DatabaseMetaData.getColumns without a table filter).
Steps to reproduce
SET SESSION .bulk_list_columns = true;
Observed on v479 (bug)
Expected
Root cause (code)
PR: #28653
findepi commentedon Mar 19, 2026
@sachinsharma3191 i tried to follow the steps but failed to reproduce the problem
I was using Trino with MySQL connector as started by
io.trino.plugin.mysql.MySqlQueryRunner#mainon current Trino master.then
output is correct
findepi commentedon Mar 19, 2026
Note that
bulk_list_columnsis a hidden property acting as a kill switch for bulk column listing for connectors that do support bulk column listing.It is hidden and not supposed to be set by users.
I used MySQL connector because it does support bulk column listing.
Some questions to you
Or, maybe, are you forcing bulk listing on a connector which does not support it?
sachinsharma3191 commentedon Mar 24, 2026
sure let me do the testing as suggested by you
Fix SHOW COLUMNS and information_schema.columns returning only first …
Fix SHOW COLUMNS and information_schema.columns returning only first …
Fix SHOW COLUMNS and information_schema.columns returning only first …
kjh0623 commentedon Jun 21, 2026
We encountered the same symptom on Trino 478 + OPA batched FilterColumns with the Iceberg connector (REST catalog via Gravitino).
Our Environment
Trino version: 478
Connector: Iceberg (non-JDBC) with REST catalog (Gravitino)
Access Control: OPA with opa.policy.batched-uri configured
Symptom
information_schema.columns, DESCRIBE, SHOW COLUMNS, and SELECT * all return only the first column for every Iceberg table. SHOW CREATE TABLE returns all columns correctly (reads Iceberg metadata directly, bypasses information_schema).
Root Cause (in our case)
Our OPA batch policy was missing a dedicated FilterColumns handler. When Trino sends a FilterColumns batch request, the payload structure differs from other filter operations:
Unlike FilterTables/FilterSchemas (where each resource is a separate item in filterResources[]), FilterColumns sends one resource with a columns array inside. The batch response must return indices into the columns array, not the filterResources array.
Our generic batch rules only matched on resource.table.catalogName, which matched index 0 (the single table resource) — Trino interpreted this as "allow only the first column."
Fix (OPA Policy — no Trino code change needed)
We added this Rego rule to our batch policy:
After applying this + OPA pod restart, information_schema.columns correctly returns all columns.
Note
This is a different code path from the JDBC bulk-listing bug described in this issue (BaseJdbcClient.IterateTableColumns), but produces the identical symptom. Users with OPA batch mode enabled should check whether their policy correctly handles the FilterColumns operation's unique payload structure.
The Trino OPA documentation does mention this corner case at the bottom of the batch mode section, but it's easy to miss.
maxsbs commentedon Jun 22, 2026
Hello @kjh0623,
Thanks, we figured that out as well thanks to Trino documentation. I thought I had posted a comment on this issue, but this is not the case... Sorry to the community for that.
Indeed, the corner case fix mentioned in the doc and in your comment solves the problem.
Closing this issue.