sqlwrite still broken in R2021a for datatype conversions (JDBC and Native drivers)
조회 수: 5 (최근 30일)
이전 댓글 표시
My question here has still gone unanswered, i.e. miliseconds are dropping on insert (windows 10, postgres, ODBC, r2020a), triggering a unique constraint violation from the database. I figured I'll use 2021a, on linux, with a native postgres driver (JDBC also doesnt work). Now I can't even get to the spot to replicate the original error (milliseconds dropping) before I am faced with a different but related error.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/722494/image.jpeg)
Checking the type of dt_start gives
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/722499/image.jpeg)
So it is asking for a numeric array or cell array of numeric scalars, this must mean datevec.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/722504/image.jpeg)
Also no. Lets try casting into a cell array.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/722509/image.jpeg)
Now it wants it to be a datetime?? Only this throws the same error as before where it asks for scalars. So lets try strings and char arrays. however, trying any of this errors and I'm asked to use scalars. Using scalars I'm asked to use characters. This is absolute insanity. What is the fix??
I've tried
datenum(dt_start)
datevec(dt_start)
num2cell(dt_start)
num2cell(datevec(dt_start))
datestr(dt_start)
string(dt_start)
{datestr(dt_start)}
Nothing works. The postgres type category for this column in the database is 'D'
psql#> select oid, typname, typcategory from pg_catalog.pg_type where typname like 'timestamptz';
-------------------------------
1184 timestamptz D
when looking at +database/+postgre/@connection/connection.m, we can see on line 257 this category is not selected, and for whatever reason, the string category is listed twice.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/722514/image.jpeg)
I am unable to debug this in any systematic way or edit the file without matlab crashing.
So two problems, same problem space, different OS and drivers. Please what is the solution? Thanks.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!