HicServices / RDMP

Research Data Management Platform (RDMP) is an open source application for the loading,linking,anonymisation and extraction of datasets stored in relational databases.
https://github.com/HicServices/RDMP#research-data-management-platform
GNU General Public License v3.0
36 stars 16 forks source link

column "isTest" is of type boolean but expression is of type integer #1857

Closed rkm closed 1 month ago

rkm commented 1 month ago

Describe the bug

Follow-up from #1831.

When trying to create a new logging server on a blank Postgres database, the error in the issue title is produced.

To Reproduce

  1. Download rdmp-cli v8.1.6
  2. docker run --rm -d -p5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:14
  3. ./rdmp --dir conf --command run CreateNewExternalDatabaseServer LiveLoggingServer_ID "DatabaseType:PostgreSql:Server=127.0.0.1;Uid=postgres;Database=postgres"

Expected behavior

The logging server is created.

RDMP Version

./rdmp --version
2024-06-15 19:19:37.1879 INFO Dotnet Version:8.0.5 .
2024-06-15 19:19:37.2017 INFO RDMP Version:8.1.6.0 .
rdmp 8.1.6
2024-06-15 19:19:37.2129 INFO Exiting with code 0 .

Error with Stack Trace

```console 2024-06-15 19:22:40.7594 INFO Dotnet Version:8.0.5 . 2024-06-15 19:22:40.7752 INFO RDMP Version:8.1.6.0 . 2024-06-15 19:22:42.1817 TRACE Running Command 'ExecuteCommandCreateNewExternalDatabaseServer' . Success:About to run: /*--Version:1.0.0*/ /*--Description:Initial Create*/ CREATE TABLE "postgres".public."DataSet"( "dataSetID" varchar(150) NOT NULL , "name" varchar(2000) NULL , "description" text NULL , "time_period" varchar(64) NULL , "SLA_required" varchar(3) NULL , "supplier_name" varchar(32) NULL , "supplier_tel_no" varchar(32) NULL , "supplier_email" varchar(64) NULL , "contact_name" varchar(64) NULL , "contact_position" varchar(64) NULL , "currentContactInstitutions" varchar(64) NULL , "contact_tel_no" varchar(32) NULL , "contact_email" varchar(64) NULL , "frequency" varchar(32) NULL , "method" varchar(16) NULL , CONSTRAINT PK_DataSet PRIMARY KEY ("dataSetID")); CREATE TABLE "postgres".public."DataLoadTask"( "ID" int NOT NULL , "description" text NULL , "name" varchar(1000) NULL , "createTime" timestamp default now() NULL , "userAccount" varchar(500) NULL , "statusID" int NULL , "isTest" boolean NULL , "dataSetID" varchar(150) NULL , CONSTRAINT PK_DataLoadTask PRIMARY KEY ("ID"), ... /*create tasks*/ [18/738] INSERT INTO "DataLoadTask" ("ID", "description", "name", "userAccount", "statusID", "isTest", "dataSetID") VALUES(1, 'Internal', 'Internal', 'Thomas', 1, 0, 'Internal'); INSERT INTO "DataLoadTask" ("ID", "description", "name", "userAccount", "statusID", "isTest", "dataSetID") VALUES(2, 'DataExtraction', 'DataExtraction', 'Thomas', 1, 0, 'DataExtraction'); Warning:Database postgres already exists Fail:Create failed 2024-06-15 19:22:42.5440 ERROR Failed check with message: Create failed . 2024-06-15 19:22:42.5440 INFO Fatal error occurred so returning -1 . System.Exception: Failed check with message: Create failed ---> Npgsql.PostgresException (0x80004005): 42804: column "isTest" is of type boolean but expression is of type integer POSITION: 172 at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 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(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery() at Rdmp.Core.ReusableLibraryCode.UsefulStuff.ExecuteBatchNonQuery(String sql, DbConnection conn, DbTransaction transaction, Dictionary`2& performanceFigures, Int32 timeout) in D:\a\RDMP\RDMP\Rdmp.Core\ReusableLibraryCode\UsefulStuff.cs:line 304 at Rdmp.Core.MapsDirectlyToDatabaseTable.Versioning.MasterDatabaseScriptExecutor.RunSQL(KeyValuePair`2 kvp) in D:\a\RDMP\RDMP\Rdmp.Core\MapsDirectlyToDatabaseTable\Versioning\MasterDatabaseScriptExecutor.cs:line 142 at Rdmp.Core.MapsDirectlyToDatabaseTable.Versioning.MasterDatabaseScriptExecutor.CreateDatabase(Patch initialCreationPatch, ICheckNotifier notifier) in D:\a\RDMP\RDMP\Rdmp.Core\MapsDirectlyToDatabaseTable\Versioning\MasterDatabaseScriptExecutor.cs:line 123 Exception data: Severity: ERROR SqlState: 42804 MessageText: column "isTest" is of type boolean but expression is of type integer Hint: You will need to rewrite or cast the expression. Position: 172 File: parse_target.c Line: 587 Routine: transformAssignedExpr --- End of inner exception stack trace --- at Rdmp.Core.ReusableLibraryCode.Checks.AcceptAllCheckNotifier.OnCheckPerformed(CheckEventArgs args) in D:\a\RDMP\RDMP\Rdmp.Core\ReusableLibraryCode\Checks\AcceptAllCheckNotifier.cs:line 35 at Rdmp.Core.MapsDirectlyToDatabaseTable.Versioning.MasterDatabaseScriptExecutor.CreateDatabase(Patch initialCreationPatch, ICheckNotifier notifier) in D:\a\RDMP\RDMP\Rdmp.Core\MapsDirectlyToDatabaseTable\Versioning\MasterDatabaseScriptExecutor.cs:line 133 at Rdmp.Core.MapsDirectlyToDatabaseTable.Versioning.MasterDatabaseScriptExecutor.CreateAndPatchDatabase(IPatcher patcher, ICheckNotifier notifier) in D:\a\RDMP\RDMP\Rdmp.Core\MapsDirectlyToDatabaseTable\Versioning\MasterDatabaseScriptExecutor.cs:line 422 at Rdmp.Core.CommandExecution.BasicActivateItems.CreateNewPlatformDatabase(ICatalogueRepository catalogueRepository, PermissableDefaults defaultToSet, IPatcher patcher, DiscoveredDatabase db) in D:\a\RDMP\RDMP\Rdmp.Core\CommandExecution\BasicActivateItems.cs:line 730 at Rdmp.Core.CommandExecution.AtomicCommands.ExecuteCommandCreateNewExternalDatabaseServer.Execute() in D:\a\RDMP\RDMP\Rdmp.Core\CommandExecution\AtomicCommands\ExecuteCommandCreateNewExternalDatabaseServer.cs:line 97 at Rdmp.Core.CommandExecution.CommandInvoker.ExecuteCommand(ConstructorInfo constructorInfo, CommandLineObjectPicker picker) in D:\a\RDMP\RDMP\Rdmp.Core\CommandExecution\CommandInvoker.cs:line 298 at Rdmp.Core.CommandLine.Runners.ExecuteCommandRunner.RunCommand(String command) in D:\a\RDMP\RDMP\Rdmp.Core\CommandLine\Runners\ExecuteCommandRunner.cs:line 104 at Rdmp.Core.CommandLine.Runners.ExecuteCommandRunner.Run(IRDMPPlatformRepositoryServiceLocator repositoryLocator, IDataLoadEventListener listener, ICheckNotifier checkNotifier, GracefulCancellationToken token) in D:\a\RDMP\RDMP\Rdmp.Core\CommandLine\Runners\ExecuteCommandRunner.cs:line 94 at Rdmp.Core.CommandLine.RdmpCommandLineBootStrapper.Run(RDMPCommandLineOptions opts, IRunner explicitRunner, IRDMPPlatformRepositoryServiceLocator existingLocator) in D:\a\RDMP\RDMP\Rdmp.Core\CommandLine\RdmpCommandLineBootStrapper.cs:line 145 at Rdmp.Core.Program.HandleArguments(String[] args, Logger logger) in D:\a\RDMP\RDMP\Tools\rdmp\Program.cs:line 83 ```

Database Engine

Postgres

rkm commented 1 month ago

Confirmed this is resolved with #1860 ! 😃