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

error invalid time zone region #1207

Open
rioda78 opened this issue Dec 21, 2024 · 4 comments
Open

error invalid time zone region #1207

rioda78 opened this issue Dec 21, 2024 · 4 comments

Comments

@rioda78
Copy link

rioda78 commented Dec 21, 2024

environment
asp core 9
entityframeworkcore.firebird 12.0.0-beta1
project aspnet core blazor with identity default

when im try execute database update, it get error "Invalid time zone region: .21.5440". you can see detail error below

info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (33ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
      EXECUTE BLOCK
      AS
      BEGIN
        BEGIN
                EXECUTE STATEMENT
                        'CREATE TABLE "__EFMigrationsLock" (
                                "Id" INT NOT NULL CONSTRAINT "PK___EFMigrationsLock" PRIMARY KEY,
                                "Timestamp" TIMESTAMP NOT NULL
                        )';
                WHEN SQLSTATE '42S01' DO
                BEGIN
                END
        END
      END
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (21ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
      EXECUTE BLOCK
      RETURNS (ROWS_AFFECTED INT)
      AS
      BEGIN
        ROWS_AFFECTED = 1;
        BEGIN
                INSERT INTO "__EFMigrationsLock" ("Id", "Timestamp") VALUES (1, CAST('2024-12-21 11.42.21.5440' AS TIMESTAMP));
                WHEN SQLSTATE '23000' DO
                BEGIN
                        ROWS_AFFECTED = 0;
                END
        END
        SUSPEND;
      END
Failed executing DbCommand (21ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
EXECUTE BLOCK
RETURNS (ROWS_AFFECTED INT)
AS
BEGIN
        ROWS_AFFECTED = 1;
        BEGIN
                INSERT INTO "__EFMigrationsLock" ("Id", "Timestamp") VALUES (1, CAST('2024-12-21 11.42.21.5440' AS TIMESTAMP));
                WHEN SQLSTATE '23000' DO
                BEGIN
                        ROWS_AFFECTED = 0;
                END
        END
        SUSPEND;
END
FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Invalid time zone region: .21.5440
At block line: 7, col: 3
 ---> FirebirdSql.Data.Common.IscException: Invalid time zone region: .21.5440
At block line: 7, col: 3
   at FirebirdSql.Data.Client.Managed.IResponseExtensions.HandleResponseException(IResponse response)
   at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadResponse(Int32 operation)
   at FirebirdSql.Data.Client.Managed.Version10.GdsStatement.Fetch()
   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteScalar()
   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteScalar()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
   at FirebirdSql.EntityFrameworkCore.Firebird.Migrations.Internal.FbHistoryRepository.AcquireDatabaseLock()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)

change project to net core 8 fix this error.

@mrotteveel
Copy link
Member

You're using Firebird 4 or higher. The syntax for timestamp become more restrictive in Firebird 4 with the introduction of with time zone types. Since Firebird 4, the separator between hours, minutes and seconds must be a colon (:), so you should use:

CAST('2024-12-21 11:42:21.5440' AS TIMESTAMP)

See also Datetime Literals

@mrotteveel
Copy link
Member

I guess the provider generates this; if so, it needs to be fixed to generate the correct syntax.

@cincuranet If this is generated, using timestamp '...' is shorter than such cast.

@rioda78
Copy link
Author

rioda78 commented Dec 21, 2024

As information i'm using Firebird 5.0.1

@cincuranet
Copy link
Member

Hmm, looks like dependencies in FbHistoryRepository are not correct and wrong literal is generated. I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants