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
What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)
( )
Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
I have designed a special-purpose table to store hundreds of text columns.
However, when creating the table and querying the data, I encountered the following error message:
[models/research_data_vault.go:2388] models: failed to assign all query results to ResearchDataVault slice:
[sqlboiler/[email protected]/queries/reflect.go:262] failed to bind pointers to obj:
sql: Scan error on column index 255, name "r7_use_bispho": unsupported Scan, storing driver.Value type []uint8 into type *models.ResearchDataVault
The key takeaway from this error message is the number 255. The table I created during testing had about 300 columns.
The mapping is generated as a result of calling the BindMapping function, and its value ranges from 0xff00 to 0xffff.
In the case of the 256th column, the value is mapped to 0xff00 again. This is an overflow from 255.
It appears that a variable related to this issue is a sentinel, which seems to have been set to detect a value of 255.
Along with the magic number 8, it works as intended for tables with 255 or fewer columns, but an error occurs for tables with more columns.
This issue can be resolved by modifying both the sentinel and the magic number.
However, while I have solved the problem for myself, I am not fully aware of the other site effects.
MySQL has a hard limit of 4096 columns that can be created. However, InnoDB allows up to 1017 columns.
Based on this fact, I believe it is a good idea to modify the sentinel to 4096.
In the case of InnoDB, an error will occur in the DBMS itself if more than 1017 columns are created anyway.
(see - https://dev.mysql.com/doc/mysql-reslimits-excerpt/8.0/en/column-count-limit.html)
I'll submit a PR related to this issue soon.
Thank you for the great work, everyone on your team.
Dos
The text was updated successfully, but these errors were encountered:
doscode-kr
added a commit
to doscode-kr/sqlboiler
that referenced
this issue
Mar 1, 2024
- Increase Depth Limit in ptrFromMapping Function
for Deeper Structure Access in reflect.go
- This fix addresses errors encoutered with tables
exceeding 255 columns.
- this fixes issue volatiletech#1359
What version of SQLBoiler are you using (
sqlboiler --version
)?What is your database and version (eg. Postgresql 10)
If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
If this happened at runtime what code produced the issue? (if not applicable leave blank)
What is the output of the command above with the
-d
flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
I have designed a special-purpose table to store hundreds of text columns.
However, when creating the table and querying the data, I encountered the following error message:
The key takeaway from this error message is the number
255
. The table I created during testing had about 300 columns.in reflect.go
The mapping is generated as a result of calling the BindMapping function, and its value ranges from 0xff00 to 0xffff.
In the case of the 256th column, the value is mapped to 0xff00 again. This is an overflow from 255.
It appears that a variable related to this issue is a
sentinel
, which seems to have been set to detect a value of 255.Along with the magic number 8, it works as intended for tables with 255 or fewer columns, but an error occurs for tables with more columns.
This issue can be resolved by modifying both the sentinel and the magic number.
However, while I have solved the problem for myself, I am not fully aware of the other site effects.
MySQL has a hard limit of 4096 columns that can be created. However, InnoDB allows up to 1017 columns.
Based on this fact, I believe it is a good idea to modify the sentinel to 4096.
In the case of InnoDB, an error will occur in the DBMS itself if more than 1017 columns are created anyway.
(see - https://dev.mysql.com/doc/mysql-reslimits-excerpt/8.0/en/column-count-limit.html)
I'll submit a PR related to this issue soon.
Thank you for the great work, everyone on your team.
Dos
The text was updated successfully, but these errors were encountered: