[MDEV-5953] Cannot create CONNECT MYSQL table with BLOB type Created: 2014-03-26 Updated: 2014-03-31 Resolved: 2014-03-31 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.9 |
| Fix Version/s: | 10.0.11 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Kolbe Kegel (Inactive) | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | connect-engine | ||
| Environment: |
any |
||
| Description |
|
Apparently it is not possibly to create a MYSQL table with a blob column?
I didn't see any documentation about this. And creating a PROXY table causes it to try using the wrong datatype
Should this be supported? If not, obviously, it must be clearly documented at https://mariadb.com/kb/en/connect-data-types/ Currently, that page seems to suggest that blob might be supported when it says TYPE_STRING should be used for "char, varchar, text, blob". |
| Comments |
| Comment by Olivier Bertrand [ 2014-03-26 ] |
|
The current documentation does not say anything explicitly about the TEXT/BLOB types. Meanwhile, this is the current handling provided by CONNECT: 1) For all file based types, TEXT and BLOB are not supported. What can be done? Perhaps making Discovery refuse to do the conversion or set the length to a smaller value (but which one?) Waiting for, the solution is to manually specify the columns in the CREATE TABLE statement. For instance, the above example can be solved doing: CREATE TABLE xt1( The issue is that, the way it is implemented, CONNECT cannot directly pass the text from the target table column to the CONNECT column but must internally pass by a CONNECT data type. |
| Comment by Kolbe Kegel (Inactive) [ 2014-03-26 ] |
|
Olivier, thanks for replying. Here are my thoughts. My view is that silent conversions and truncations should never be performed. If someone wants to do something crazy and explicitly define something in a way that will truncate their data, we should warn them, but it's probably OK to let them proceed. Explicitly defining a MYSQL table to use a datatype different from the source might qualify. But this should never happen automatically. On top of that, though, BLOB should not turn into a VARCHAR; it should be at the very least VARBINARY. Maybe that's a change that could be made now to reduce potential problems for binary data being treated as string data? |
| Comment by Olivier Bertrand [ 2014-03-27 ] |
|
CONNECT now support global variables (for instance connect_xtrace replaces the use of the connect.ini entry) I can add a variable specifying whether a conversion from TEXT to VARCHAR should be done and how. For instance: NO: no conversion. BLOB and TEXT will be rejected (this would be the default) In all cases, warnings shall be issued. Remains the issue of what VARCHAR length should be given for TEXT columns. What do you think about this? |
| Comment by Kolbe Kegel (Inactive) [ 2014-03-27 ] |
|
I think that is an interesting idea. I like it. What is holding back CONNECT from having a binary data type? In MariaDB, VARBINARY(...) is equivalent to VARCHAR(...) CHARACTER SET BINARY. (VARCHAR with BINARY character set is converted to VARBINARY.) Maybe CONNECT could simply do something like that? It looks like CONNECT doesn't worry much about character sets anyway (maybe I am wrong), so perhaps this would be pretty straightforward? |
| Comment by Olivier Bertrand [ 2014-03-27 ] |
|
OK, I'll work on it. |
| Comment by Olivier Bertrand [ 2014-03-31 ] |
|
Two new system variables are added for CONNECT: connect_type_conv: enum (no, yes,or skip) defaults to no. In the case of TEXT columns, the handling depends on the values given to the connect_type_conv and connect_conv_size system variables. If the value of connect_type_conv is: NO: No conversion. TYPE_ERROR is returned causing a “not supported” message. Note: BLOB is currently not converted until a TYPE_BIN type is added to CONNECT. However, the SKIP option also applies to BLOB columns. |