-
Notifications
You must be signed in to change notification settings - Fork 129
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
Error when opening repositories management page with SQL Server #36
Comments
I would tend to agree with your proposed fix, but I would advise to use VARCHAR(255) and not 250, as this is the maximum length for a filename in most file systems [1]. However, I am not really sure why @jreese set the filename column's type to TEXT instead of VARCHAR. John, care to comment ? Do you see any issue with changing the schema definition ? [1] http://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits |
It's a TEXT field because it stores more than just the individual filename, it also stores the entire file path from the root of the repository, which can easily and quickly exceed 255 characters. I would be hesitant to suggest changing it from TEXT for those reasons, especially since the majority of users will be running mysql or postgres where that query functions correctly. I'm not familiar with SQL Server, so I have no idea of what is or isn't possible there, but for that specific query instance, it's not really "necessary" as it just provides a bit of stats for the repo list, so could simply be omitted in cases where the DB doesn't support those semantics. |
VARCHAR(MAX) would do the trick -- you can store as many characters as you want (up to 2 Go) in VARCHAR(MAX) field As it is stated here:
So
|
Then I would suggest modifying the plugin's schema() section to check the database type, and modify the schema for that column to use varchars only on sql server. I would advise against adding a new ALTER schema row though, in favor of just returning a modified CREATE row, so that schema versions aren't out of sync between various database types. Ideally, only the initial CREATE row would be part of the conditional block, which might require altering the semantics of the block, but would be better IMO than duplicating the entire schema array entirely. |
Thanks for the feedback John.
In that case, the limit would be the maximum path length, which is 4096 in Linux and 32767 on NTFS. But indeed as you say, the best approach is probably to keep it as TEXT and make an MSSQL-specific schema - assuming ADOdb can actually handle this VARCHAR(MAX) thing.
That would potentially cause issues for existing installations, unless they manually execute an ALTER TABLE, no ? What do you think about adding a schema change for MSSQL, and a no-op upgrade step for other DB's (similar to what I did in my MantisBT oracle branch ? |
My question is whether that sort of null/noop schema row is supported by the plugin manager, which uses a slightly different schema definition/system than the core of Mantis. |
You're right, it wouldn't be supported in the current state of the code. For Oracle branch I had to modify install.php to take care of this no-op, so to make this work for plugins the same change would have to be made in plugin_api.php / plugin_upgrade() |
I can't help about the schema upgrade problematic.. it seems to be more tricky than one could expect ! @dregad about your two questions:
I switched to |
Implement the same functionality that was added to the MantisBT installer in 061e66b. This is a prerequisite to fix an issue with Source Integration plugin mantisbt-plugins/source-integration#36. Fixes #23367
Implement the same functionality that was added to the MantisBT installer in 061e66b. This is a prerequisite to fix an issue with Source Integration plugin mantisbt-plugins/source-integration#36. Fixes #23367
My configuration is MantisBT 1.2.12 with SQL Server 2008
An error occurs when opening repositories management page :
operand text is not valid for count operator
the query is
My workaround is to use VARCHAR column type instead of TEXT
Maybe VARCHAR(MAX) would be better ?
The text was updated successfully, but these errors were encountered: