ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.21k stars 298 forks source link

Npgsql.PostgresException (0x80004005): 22P02: 无效的类型 boolean 输入语法: "public.Tab4" #2219

Closed konghao8013 closed 8 months ago

konghao8013 commented 8 months ago

Create a bug report, feature proposal, or ask a question.

NOTICE: A bug report without sufficient technical and repro details and version information WILL BE CLOSED WITHOUT ANY FURTHER ACTION.

Provide steps to reproduce a bug

Please include a complete description of the issue or link to a project that I can run to reproduce the issue.

Provide technical details


{ "CodeGenerationMode": 3, "ContextClassName": "testContext", "ContextNamespace": null, "DefaultDacpacSchema": null, "FilterSchemas": false, "IncludeConnectionString": false, "ModelNamespace": null, "OutputContextPath": null, "OutputPath": "Models", "PreserveCasingWithRegex": true, "ProjectRootNamespace": "EFLibrary", "Schemas": null, "SelectedHandlebarsLanguage": 2, "SelectedToBeGenerated": 0, "T4TemplatePath": null, "Tables": [ { "Name": "public.Tab4", "ObjectType": 0 } ], "UiHint": ".test3", "UncountableWords": null, "UseBoolPropertiesWithoutDefaultSql": true, "UseDatabaseNames": true, "UseDateOnlyTimeOnly": false, "UseDbContextSplitting": false, "UseDecimalDataAnnotationForSprocResult": true, "UseFluentApiOnly": true, "UseHandleBars": false, "UseHierarchyId": false, "UseInflector": false, "UseLegacyPluralizer": false, "UseManyToManyEntity": false, "UseNoDefaultConstructor": false, "UseNoNavigations": false, "UseNoObjectFilter": false, "UseNodaTime": false, "UseNullableReferences": false, "UsePrefixNavigationNaming": false, "UseSchemaFolders": false, "UseSchemaNamespaces": false, "UseSpatial": false, "UseT4": false }


Congratulations, 'EF Core Power Tools' has now generated a DbContext and Entity classes for you.

You need to configure your app now - here are some hints:

ASP.NET Core:

  1. Register your DbContext class in your "Program.cs" file.

    builder.Services.AddDbContext<testContext>(
        options => options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
  2. Add "ConnectionStrings" to your configuration file (secrets.json, appsettings.Development.json or appsettings.json).

    {
        "ConnectionStrings": {
            "DefaultConnection": "Persist Security Info=True;Password=123456;Username=system;Database=test3;Port=54321;Host=192.168.48.104"
        }
    }

Thank you!

Thank you for using this free tool! Have a look at the wiki to learn more about all the advanced features

You can create issues, questions and suggestions on GitHub

If you like my free tool, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship

Some issues were discovered during reverse engineering, consider addressing them:

Npgsql.PostgresException (0x80004005): 22P02: 无效的类型 boolean 输入语法: "public.Tab4"

POSITION: 793 at Npgsql.Internal.NpgsqlConnector.g__ReadMessageLong|233_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.GetTables(NpgsqlConnection connection, DatabaseModel databaseModel, Func3 tableFilter, String internalSchemas, HashSet1 enums, IDiagnosticsLogger1 logger) at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(DbConnection dbConnection, DatabaseModelFactoryOptions options) at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options) at RevEng.Core.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions, Boolean removeNullableBoolDefaults, Boolean excludeNavigations, Boolean dbContextOnly, Boolean entitiesOnly, Boolean useSchemaFolders, Boolean useSchemaNamespaces) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerScaffolder.cs:line 460 at RevEng.Core.ReverseEngineerScaffolder.GenerateDbContext(ReverseEngineerCommandOptions options, List1 schemas, String outputContextDir, String modelNamespace, String contextNamespace, String projectPath, String outputPath) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerScaffolder.cs:line 94 at RevEng.Core.ReverseEngineerRunner.GenerateFiles(ReverseEngineerCommandOptions options) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerRunner.cs:line 78 Exception data: Severity: 错误 SqlState: 22P02 MessageText: 无效的类型 boolean 输入语法: "public.Tab4" Position: 793 File: kdb_bool.c Line: 309 Routine: boolin

ErikEJ commented 8 months ago

This looks like a Npgsql issue, I dont think I can help here.

@roji ?

roji commented 8 months ago

22P02 is the PostgreSQL error "invalid_text_representation" there seems to be something problematic related to the table name... @konghao8013 can you please open this issue on https://github.com/npgsql/efcore.pg, and include a minimal database schema (preferably a single CREATE TABLE) which, when scaffolded, produces this?