Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table names truncated at 20 characters for oracle #237

Open
nlinaje opened this issue May 20, 2024 · 3 comments
Open

Table names truncated at 20 characters for oracle #237

nlinaje opened this issue May 20, 2024 · 3 comments

Comments

@nlinaje
Copy link

nlinaje commented May 20, 2024

After the plugin connects to the oracle database and puts all tables in the tree, some of the tables get truncated.

The plugin truncates it at 20 characters, but the maximum number of characters in Oracle is 30. (Versions <=12.2)

I changed the line:
\ 'COLUMN table_name FORMAT a25',
to
\ 'COLUMN table_name FORMAT a30',
to be able to see the full table names in my database in the tree window (as I am using version 12.2)

Additionally, there are other columns which are not using the maximum number of characters allowed by Oracle. This table is a summary of what I found out:

table version >12.2 version <=12.2 set by plugin (schemas.vim) set by plugin (helpers)
owner 128 bytes 30 bytes a20 a20
table_name 128 bytes 30 bytes a25 a20
column_name 128 bytes 30 bytes a25 a20
constraint_type 128 bytes 30 bytes - a20
index_name 128 bytes 30 bytes - a20

Link to oracle documentation: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Database-Object-Names-and-Qualifiers.html#GUID-75337742-67FD-4EC0-985F-741C93D918DA

Setting the format to big values have drawbacks. For example, setting the columns to 128 in the helpers, makes the preview window in some cases (i.e. "references") unusable, as each column has 128 chars for data being between 10 and 20 chars.

From my point of view, the table_name and owner in schemas.vim should be changed to 30 chars (or 128 for versions >12.2) so that the tree can be created correctly. The column_name could be set to 30 chars too. In the helpers I would leave it with 20 or maximum set it to 30.

@kristijanhusak
Copy link
Owner

@Iron-E added initial support for some Oracle stuff.

@Iron-E , can you provide some feedback on this PR? Thanks!

@dbmatheus
Copy link

I agree with @nlinaje in this one, I was having the same issue with the Schemas / Tables navigation because I have a customer with table names bigger than 25 characters.

Thanks!

@Iron-E
Copy link
Contributor

Iron-E commented Jun 26, 2024

@Iron-E added initial support for some Oracle stuff.

@Iron-E , can you provide some feedback on this PR? Thanks!

Sorry for the long time without a response!

I seem to recall the decision for a20 was purely viaual, and if that isn't working for users today then I agree it should be changed (especially if the max name length has increased so much 😅).

Perhaps an option would work here? I don't recall the vim-dadbod-ui architecture off the top of my head, but it could be beneficial (if possible) to allow for max lengths across adapters (e.g. g:db_ui_trim = {'columns': 35}, and just default to no max length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants