Skip to Main Content

SQL Developer for VS Code

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Wrong column order in table grid - missing sort

Robbie DatabeeMay 28 2024

SQL Developer for VS Code sometimes shows the columns of a table in the data grid in the wrong order:

file_version should be the last column (column_id = 6) but is displayed as first column.

I can't provide a testcase, that always reproduces, but I found the cause in the trace file:

The queries that populate the Columns-Grid are using “order by column_id”:

{
    "env": {
        "defaultTimeZone": "Z"
    },
    "items": [
        {
            "statementId": 1,
            "statementType": "query",
            "statementPos": {
                "startLine": 0,
                "endLine": 5
            },
            "statementText": "SELECT COLUMN_NAME\n      FROM SYS.ALL_TAB_COLUMNS\n      WHERE OWNER = :SCHEMA\n      AND TABLE_NAME = :PARENT_NAME\n      ORDER BY COLUMN_ID",
            "resultSet": {
                "metadata": [
                    {
                        "columnName": "COLUMN_NAME",
                        "columnTypeName": "VARCHAR2",
                        "precision": 128,
                        "scale": 0,
                        "isNullable": 0
                    }
                ],
                "items": [ {"COLUMN_NAME": "MODULE"},
                           {"COLUMN_NAME": "FILENAME"},
                           {"COLUMN_NAME": "CONTENT"},
                           {"COLUMN_NAME": "MIMETYPE"},
                           {"COLUMN_NAME": "MODIFIED"},
                           {"COLUMN_NAME": "FILE_VERSION"}],
                "count": 6
            },
            "response": []
        }
    ]
}

The queries that populate the data grid rely on the order returned by the view sys.all_tab_columns:

{
    "env": {
        "defaultTimeZone": "Z"
    },
    "items": [
        {
            "statementId": 1,
            "statementType": "query",
            "statementPos": {
                "startLine": 1,
                "endLine": 8
            },
            "statementText": "    SELECT\n        column_name, data_type\n    FROM\n        sys.all_tab_columns\n    WHERE\n        owner = :OBJECT_OWNER\n    AND\n        table_name = :OBJECT_NAME",
            "resultSet": {
                "metadata": [
                    {
                        "columnName": "COLUMN_NAME",
                        "columnTypeName": "VARCHAR2",
                        "precision": 128,
                        "scale": 0,
                        "isNullable": 0
                    },
                    {
                        "columnName": "DATA_TYPE",
                        "columnTypeName": "VARCHAR2",
                        "precision": 128,
                        "scale": 0,
                        "isNullable": 1
                    }
                ],
                "items": [ { "COLUMN_NAME": "FILE_VERSION", "DATA_TYPE": "VARCHAR2" },
                           { "COLUMN_NAME": "MODULE", "DATA_TYPE": "VARCHAR2" },
                           { "COLUMN_NAME": "FILENAME","DATA_TYPE": "VARCHAR2" },
                           { "COLUMN_NAME": "CONTENT", "DATA_TYPE": "BLOB" },
                           {
 "COLUMN_NAME": "MIMETYPE", "DATA_TYPE": "VARCHAR2" },
                           {
 "COLUMN_NAME": "MODIFIED", "DATA_TYPE": "DATE" }
                          ],
                "limit": 100,
                "count": 6
            },
            "response": []
        }
    ]
}

I attached the logfile for better traceability.
The data was removed - there are blobs in the table, and the extension still fetches them all before showing the data…

SQLdevVSCode-DataGrid_column_order.txt

Comments
Post Details
Added on May 28 2024
4 comments
231 views