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

Getting an error when inserting the civil field with utcOffset value to the mysql datastore #4531

Closed
kalaiyarasiganeshalingam opened this issue Jun 5, 2023 · 3 comments · Fixed by ballerina-platform/module-ballerina-sql#662
Assignees
Labels
module/persist Team/DIU Data, IO, and Util packages related issues Type/Bug

Comments

@kalaiyarasiganeshalingam
Copy link
Contributor

Description:
Return the following error when inserting the civil field with utcOffset value.

error: Unsupported value: {"utcOffset":{"hours":5,"minutes":30}, "year":2022,"month":10,"day":10,"hour":1,"minute":2,"second":3} for Civil

Steps to reproduce:
Run the following code with this entity to reproduce this error.

Entity:

type MedicalNeed record {|
    readonly int needId;
    int itemId;
    int beneficiaryId;
    time:Civil period;
    string urgency;
    int quantity;
|};
import ballerina/io;
import foo/medical_center.entities;

public function main() returns error? {
    entities:Client mcClient = check new ();
    entities:MedicalNeed mnItem2 = {
        needId: 2,
        itemId: 2,
        beneficiaryId: 2,
        period: {year: 2021, month: 10, day: 10, hour: 1, minute: 2, second: 3, utcOffset: {hours: 5, minutes: 30}},
        urgency: "NOT URGENT",
        quantity: 5
    };
    int[] needIds = check mcClient->/medicalneeds.post([mnItem2]);
    io:println("Created need id: ", needIds[0]);
    check mcClient.close();
}
@kalaiyarasiganeshalingam kalaiyarasiganeshalingam added Type/Bug Team/DIU Data, IO, and Util packages related issues module/persist labels Jun 5, 2023
@kalaiyarasiganeshalingam kalaiyarasiganeshalingam changed the title Getting an error when inserting the civil field with utcOffset value Getting an error when inserting the civil field with utcOffset value to the mysql datastore Jun 5, 2023
@daneshk
Copy link
Member

daneshk commented Jun 6, 2023

what is the problem with the civil record with an offset value?

@kalaiyarasiganeshalingam
Copy link
Contributor Author

The problem is that MySQL does not support TIMESTAMP_WITH_TIMEZONE type[1]. The following is a root error message.

java.sql.SQLFeatureNotSupportedException: Unsupported SQL type: TIMESTAMP_WITH_TIMEZONE

[1] https://dev.mysql.com/doc/refman/8.0/en/date-and-time-types.html

@github-actions
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/persist Team/DIU Data, IO, and Util packages related issues Type/Bug
Projects
Archived in project
2 participants