prisma: PANIC in query-engine\connectors\sql-query-connector\src\query_ext.rs:56:43index out of bounds: the len is 0 but the index is 0

Hi Prisma Team! My Prisma Client just crashed.

Versions

Name Version
Node v14.16.0
OS windows
Prisma Client 2.19.0
Query Engine query-engine c1455d0b443d66b0d9db9bcb1bb9ee0d5bbc511d
Database undefined

Query

mutation {
  queryRaw(
    query: "X"
    parameters: "X"
  )
}

Logs

krat\node_modules\@prisma\client\runtime\index.js:26388:19)
  prisma:engine     at LineStream._transform (D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client\runtime\index.js:26382:10)  {"timestamp":"Mar 18 00:53:32.312","level":"ERROR","fields":{"message":"PANIC","reason":"index out of bounds: the len is 0 but the index is 0","file":"query-engine\\connectors\\sql-query-connector\\src\\query_ext.rs","line":56,"column":43},"target":"query_engine","span":{"name":"execute_single_operation"},"spans":[{"name":"execute_single_operation"}]}  
  prisma:engine {
  prisma:engine   error: Error: read ECONNRESET
  prisma:engine       at TCP.onStreamRead (internal/stream_base_commons.js:209:20) {
  prisma:engine     errno: -4077,
  prisma:engine     code: 'ECONNRESET',
  prisma:engine     syscall: 'read'
  prisma:engine   }
  prisma:engine }  
  prisma:engine {
  prisma:engine   error: Error: connect ECONNREFUSED 127.0.0.1:59055
  prisma:engine       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  prisma:engine     errno: -4078,
  prisma:engine     code: 'ECONNREFUSED',
  prisma:engine     syscall: 'connect',
  prisma:engine     address: '127.0.0.1',
  prisma:engine     port: 59055
  prisma:engine   }
  prisma:engine }  
  prisma:engine There is a child that still runs and we want to start again  
  prisma:engine {
  prisma:engine   cwd: 'D:\\Projects\\Personal\\Consulting\\Smithsonian\\Code\\dpo-packrat\\server\\db\\prisma'
  prisma:engine }  
  prisma:engine Search for Query Engine in D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\.prisma\client  
  prisma:engine Search for Query Engine in D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client  
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '59059' ] }  
  prisma:engine stdout  Starting a mysql pool with 9 connections.  
  prisma:engine stdout  Started http server on http://127.0.0.1:59059  
  prisma:engine Search for Query Engine in D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\.prisma\client  
  prisma:engine Search for Query Engine in D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client  
  prisma:engine Client Version: 2.19.0  
  prisma:engine Engine Version: query-engine c1455d0b443d66b0d9db9bcb1bb9ee0d5bbc511d  
  prisma:engine Active provider: mysql  
  prisma:engine stdout  PANIC in query-engine\connectors\sql-query-connector\src\query_ext.rs:56:43
index out of bounds: the len is 0 but the index is 0  
  prisma:engine TypeError: this.currentRequestPromise.cancel is not a function
  prisma:engine     at NodeEngine.handlePanic (D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client\runtime\index.js:29249:36)
  prisma:engine     at NodeEngine.setError (D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client\runtime\index.js:29195:16)
  prisma:engine     at LineStream.<anonymous> (D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client\runtime\index.js:29480:24)
  prisma:engine     at LineStream.emit (events.js:315:20)
  prisma:engine     at addChunk (internal/streams/readable.js:309:12)
  prisma:engine     at readableAddChunk (internal/streams/readable.js:284:9)
  prisma:engine     at LineStream.Readable.push (internal/streams/readable.js:223:10)
  prisma:engine     at LineStream.Transform.push (internal/streams/transform.js:166:32)
  prisma:engine     at LineStream._pushBuffer (D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client\runtime\index.js:26388:19)
  prisma:engine     at LineStream._transform (D:\Projects\Personal\Consulting\Smithsonian\Code\dpo-packrat\node_modules\@prisma\client\runtime\index.js:26382:10)  {"timestamp":"Mar 18 00:53:33.284","level":"ERROR","fields":{"message":"PANIC","reason":"index out of bounds: the len is 0 but the index is 0","file":"query-engine\\connectors\\sql-query-connector\\src\\query_ext.rs","line":56,"column":43},"target":"query_engine","span":{"name":"execute_single_operation"},"spans":[{"name":"execute_single_operation"}]}  
  prisma:engine {
  prisma:engine   error: Error: read ECONNRESET
  prisma:engine       at TCP.onStreamRead (internal/stream_base_commons.js:209:20) {
  prisma:engine     errno: -4077,
  prisma:engine     code: 'ECONNRESET',
  prisma:engine     syscall: 'read'
  prisma:engine   }
  prisma:engine }  

Client Snippet

const idVocabARK: number= 75;
const idVocabUnitCMSID: number = 77;
const maxResults: number = 10;
prisma.$queryRaw<SubjectUnitIdentifier[] | null>`CALL SubjectUnitIdentifierQuery('%Armstrong%', ${idVocabARK}, ${idVocabUnitCMSID}, ${maxResults})`;

This should be executing the following SQL against my MariaDB v10.5.8 server: CALL SubjectUnitIdentifierQuery (‘%ArmStrong%’, 75, 77, 10);

When executed directly against the DB, this call returns 5 rows of data.

Schema

generator client {
  provider      = "prisma-client-js"
  output        = "../../../node_modules/@prisma/client"
  binaryTargets = ["native", "linux-musl"]
}

datasource mariasql {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model AccessAction {
  idAccessAction             Int                          @id @default(autoincrement())
  Name                       String                       @mariasql.VarChar(255)
  SortOrder                  Int
  AccessRoleAccessActionXref AccessRoleAccessActionXref[]

  @@index([SortOrder], name: "AccessAction_SortOrder")
}

model AccessContext {
  idAccessContext     Int                   @id @default(autoincrement())
  Global              Boolean
  Authoritative       Boolean
  CaptureData         Boolean
  Model               Boolean
  Scene               Boolean
  IntermediaryFile    Boolean
  AccessContextObject AccessContextObject[]
  AccessPolicy        AccessPolicy[]
}

model AccessContextObject {
  idAccessContextObject Int           @id @default(autoincrement())
  idAccessContext       Int
  idSystemObject        Int
  AccessContext         AccessContext @relation(fields: [idAccessContext], references: [idAccessContext])
  SystemObject          SystemObject  @relation(fields: [idSystemObject], references: [idSystemObject])

  @@index([idAccessContext], name: "AccessContextObject_idAccessContext")
  @@index([idSystemObject], name: "AccessContextObject_idSystemObject")
}

model AccessPolicy {
  idAccessPolicy  Int           @id @default(autoincrement())
  idUser          Int
  idAccessRole    Int
  idAccessContext Int
  AccessContext   AccessContext @relation(fields: [idAccessContext], references: [idAccessContext])
  AccessRole      AccessRole    @relation(fields: [idAccessRole], references: [idAccessRole])
  User            User          @relation(fields: [idUser], references: [idUser])

  @@index([idAccessContext], name: "AccessPolicy_idAccessContext")
  @@index([idAccessRole], name: "AccessPolicy_idAccessRole")
  @@index([idUser], name: "AccessPolicy_idUser")
}

model AccessRole {
  idAccessRole               Int                          @id @default(autoincrement())
  Name                       String                       @mariasql.VarChar(255)
  AccessPolicy               AccessPolicy[]
  AccessRoleAccessActionXref AccessRoleAccessActionXref[]
}

model AccessRoleAccessActionXref {
  idAccessRoleAccessActionXref Int          @id @default(autoincrement())
  idAccessRole                 Int
  idAccessAction               Int
  AccessAction                 AccessAction @relation(fields: [idAccessAction], references: [idAccessAction])
  AccessRole                   AccessRole   @relation(fields: [idAccessRole], references: [idAccessRole])

  @@index([idAccessAction], name: "AccessRoleAccessActionXref_idAccessAction")
  @@index([idAccessRole], name: "AccessRoleAccessActionXref_idAccessRole")
}

model Actor {
  idActor               Int                     @id @default(autoincrement())
  IndividualName        String?                 @mariasql.VarChar(255)
  OrganizationName      String?                 @mariasql.VarChar(255)
  idUnit                Int?
  Unit                  Unit?                   @relation(fields: [idUnit], references: [idUnit])
  ModelProcessingAction ModelProcessingAction[]
  SystemObject          SystemObject?

  @@index([idUnit], name: "fk_actor_unit_1")
}

model Asset {
  idAsset                                         Int                  @id @default(autoincrement())
  FileName                                        String               @mariasql.VarChar(512)
  FilePath                                        String               @mariasql.VarChar(512)
  idAssetGroup                                    Int?
  idVAssetType                                    Int
  idSystemObject                                  Int?
  StorageKey                                      String?              @unique @mariasql.VarChar(512)
  AssetGroup                                      AssetGroup?          @relation(fields: [idAssetGroup], references: [idAssetGroup])
  SystemObject_Asset_idSystemObjectToSystemObject SystemObject?        @relation("Asset_idSystemObjectToSystemObject", fields: [idSystemObject], references: [idSystemObject])
  Vocabulary                                      Vocabulary           @relation(fields: [idVAssetType], references: [idVocabulary])
  AssetVersion                                    AssetVersion[]
  CaptureData                                     CaptureData[]
  CaptureDataFile                                 CaptureDataFile[]
  IntermediaryFile                                IntermediaryFile[]
  Item                                            Item[]
  Metadata                                        Metadata[]
  Model                                           Model[]
  ModelMaterialUVMap                              ModelMaterialUVMap[]
  Scene                                           Scene[]
  Subject                                         Subject[]
  SystemObject_AssetToSystemObject_idAsset        SystemObject?        @relation("AssetToSystemObject_idAsset")

  @@index([idAssetGroup], name: "Asset_idAssetGroup")
  @@index([idSystemObject], name: "fk_asset_systemobject1")
  @@index([idVAssetType], name: "fk_asset_vocabulary1")
}

model AssetGroup {
  idAssetGroup Int     @id @default(autoincrement())
  Asset        Asset[]
}

model AssetVersion {
  idAssetVersion    Int           @id @default(autoincrement())
  idAsset           Int
  Version           Int
  FileName          String        @mariasql.VarChar(512)
  idUserCreator     Int
  DateCreated       DateTime      @mariasql.DateTime(0)
  StorageHash       String        @mariasql.VarChar(128)
  StorageSize       BigInt        @default(0)
  StorageKeyStaging String        @mariasql.VarChar(512)
  Ingested          Boolean
  BulkIngest        Boolean
  Asset             Asset         @relation(fields: [idAsset], references: [idAsset])
  User              User          @relation(fields: [idUserCreator], references: [idUser])
  SystemObject      SystemObject?

  @@index([Ingested, idUserCreator], name: "AssetVersion_Ingested_idUserCreator")
  @@index([StorageHash], name: "AssetVersion_StorageHash")
  @@index([StorageKeyStaging], name: "AssetVersion_StorageKeyStaging")
  @@index([idAsset, Version], name: "AssetVersion_idAsset_Version")
  @@index([idUserCreator, Ingested], name: "AssetVersion_idUserCreator_Ingested")
}

model CaptureData {
  idCaptureData                   Int                               @id @default(autoincrement())
  Name                            String                            @mariasql.VarChar(255)
  idVCaptureMethod                Int
  DateCaptured                    DateTime                          @mariasql.DateTime(0)
  Description                     String                            @mariasql.VarChar(8000)
  idAssetThumbnail                Int?
  Asset                           Asset?                            @relation(fields: [idAssetThumbnail], references: [idAsset])
  Vocabulary                      Vocabulary                        @relation(fields: [idVCaptureMethod], references: [idVocabulary])
  CaptureDataFile                 CaptureDataFile[]
  CaptureDataGroupCaptureDataXref CaptureDataGroupCaptureDataXref[]
  CaptureDataPhoto                CaptureDataPhoto[]
  SystemObject                    SystemObject?

  @@index([idAssetThumbnail], name: "fk_capturedata_asset1")
  @@index([idVCaptureMethod], name: "fk_capturedata_vocabulary1")
}

model CaptureDataFile {
  idCaptureDataFile       Int         @id @default(autoincrement())
  idCaptureData           Int
  idAsset                 Int
  idVVariantType          Int
  CompressedMultipleFiles Boolean
  Asset                   Asset       @relation(fields: [idAsset], references: [idAsset])
  CaptureData             CaptureData @relation(fields: [idCaptureData], references: [idCaptureData])
  Vocabulary              Vocabulary  @relation(fields: [idVVariantType], references: [idVocabulary])

  @@index([idAsset], name: "CaptureDataFile_idAsset")
  @@index([idCaptureData], name: "CaptureDataFile_idCaptureData")
  @@index([idVVariantType], name: "fk_capturedatafile_vocabulary1")
}

model CaptureDataGroup {
  idCaptureDataGroup              Int                               @id @default(autoincrement())
  CaptureDataGroupCaptureDataXref CaptureDataGroupCaptureDataXref[]
}

model CaptureDataGroupCaptureDataXref {
  idCaptureDataGroupCaptureDataXref Int              @id @default(autoincrement())
  idCaptureDataGroup                Int
  idCaptureData                     Int
  CaptureData                       CaptureData      @relation(fields: [idCaptureData], references: [idCaptureData])
  CaptureDataGroup                  CaptureDataGroup @relation(fields: [idCaptureDataGroup], references: [idCaptureDataGroup])

  @@index([idCaptureData], name: "CaptureDataGroupCaptureDataXref_idCaptureData")
  @@index([idCaptureDataGroup], name: "CaptureDataGroupCaptureDataXref_idCaptureDataGroup")
}

model CaptureDataPhoto {
  idCaptureDataPhoto                                                 Int         @id @default(autoincrement())
  idCaptureData                                                      Int
  idVCaptureDatasetType                                              Int
  CaptureDatasetFieldID                                              Int?
  idVItemPositionType                                                Int?
  ItemPositionFieldID                                                Int?
  ItemArrangementFieldID                                             Int?
  idVFocusType                                                       Int?
  idVLightSourceType                                                 Int?
  idVBackgroundRemovalMethod                                         Int?
  idVClusterType                                                     Int?
  ClusterGeometryFieldID                                             Int?
  CameraSettingsUniform                                              Boolean?
  CaptureData                                                        CaptureData @relation(fields: [idCaptureData], references: [idCaptureData])
  Vocabulary_CaptureDataPhoto_idVBackgroundRemovalMethodToVocabulary Vocabulary? @relation("CaptureDataPhoto_idVBackgroundRemovalMethodToVocabulary", fields: [idVBackgroundRemovalMethod], references: [idVocabulary])
  Vocabulary_CaptureDataPhoto_idVCaptureDatasetTypeToVocabulary      Vocabulary  @relation("CaptureDataPhoto_idVCaptureDatasetTypeToVocabulary", fields: [idVCaptureDatasetType], references: [idVocabulary])
  Vocabulary_CaptureDataPhoto_idVClusterTypeToVocabulary             Vocabulary? @relation("CaptureDataPhoto_idVClusterTypeToVocabulary", fields: [idVClusterType], references: [idVocabulary])
  Vocabulary_CaptureDataPhoto_idVFocusTypeToVocabulary               Vocabulary? @relation("CaptureDataPhoto_idVFocusTypeToVocabulary", fields: [idVFocusType], references: [idVocabulary])
  Vocabulary_CaptureDataPhoto_idVItemPositionTypeToVocabulary        Vocabulary? @relation("CaptureDataPhoto_idVItemPositionTypeToVocabulary", fields: [idVItemPositionType], references: [idVocabulary])
  Vocabulary_CaptureDataPhoto_idVLightSourceTypeToVocabulary         Vocabulary? @relation("CaptureDataPhoto_idVLightSourceTypeToVocabulary", fields: [idVLightSourceType], references: [idVocabulary])

  @@index([idCaptureData], name: "fk_capturedataphoto_capturedata1")
  @@index([idVCaptureDatasetType], name: "fk_capturedataphoto_vocabulary1")
  @@index([idVItemPositionType], name: "fk_capturedataphoto_vocabulary2")
  @@index([idVFocusType], name: "fk_capturedataphoto_vocabulary3")
  @@index([idVLightSourceType], name: "fk_capturedataphoto_vocabulary4")
  @@index([idVBackgroundRemovalMethod], name: "fk_capturedataphoto_vocabulary5")
  @@index([idVClusterType], name: "fk_capturedataphoto_vocabulary6")
}

model GeoLocation {
  idGeoLocation Int       @id @default(autoincrement())
  Latitude      Float?
  Longitude     Float?
  Altitude      Float?
  TS0           Float?
  TS1           Float?
  TS2           Float?
  R0            Float?
  R1            Float?
  R2            Float?
  R3            Float?
  Item          Item[]
  Subject       Subject[]
}

model Identifier {
  idIdentifier      Int           @id @default(autoincrement())
  IdentifierValue   String
  idVIdentifierType Int
  idSystemObject    Int?
  SystemObject      SystemObject? @relation(fields: [idSystemObject], references: [idSystemObject])
  Vocabulary        Vocabulary    @relation(fields: [idVIdentifierType], references: [idVocabulary])
  Subject           Subject[]

  @@index([IdentifierValue], name: "Identifier_IdentifierValue")
  @@index([idSystemObject, idVIdentifierType], name: "Identifier_idSystemObject_idVIdentifierType")
  @@index([idVIdentifierType, IdentifierValue], name: "Identifier_idVIdentifierType_IdentifierValue")
}

model IntermediaryFile {
  idIntermediaryFile Int           @id @default(autoincrement())
  idAsset            Int
  DateCreated        DateTime      @mariasql.DateTime(0)
  Asset              Asset         @relation(fields: [idAsset], references: [idAsset])
  SystemObject       SystemObject?

  @@index([idAsset], name: "fk_intermediaryfile_asset1")
}

model Item {
  idItem           Int           @id @default(autoincrement())
  idAssetThumbnail Int?
  idGeoLocation    Int?
  Name             String        @mariasql.VarChar(255)
  EntireSubject    Boolean
  Asset            Asset?        @relation(fields: [idAssetThumbnail], references: [idAsset])
  GeoLocation      GeoLocation?  @relation(fields: [idGeoLocation], references: [idGeoLocation])
  SystemObject     SystemObject?

  @@index([idAssetThumbnail], name: "fk_item_asset1")
  @@index([idGeoLocation], name: "fk_item_geolocation1")
}

model Job {
  idJob      Int        @id @default(autoincrement())
  idVJobType Int
  Name       String     @mariasql.VarChar(80)
  Status     Int
  Frequency  String?    @mariasql.VarChar(80)
  Vocabulary Vocabulary @relation(fields: [idVJobType], references: [idVocabulary])
  JobRun     JobRun[]

  @@index([Name], name: "Job_Name")
  @@index([Status], name: "Job_Status")
  @@index([idVJobType, idJob], name: "Job_idVJobType_idJob")
}

model JobRun {
  idJobRun      Int       @id @default(autoincrement())
  idJob         Int
  Status        Int
  Result        Boolean?
  DateStart     DateTime? @mariasql.DateTime(0)
  DateEnd       DateTime? @mariasql.DateTime(0)
  Configuration String?   @mariasql.Text
  Parameters    String?   @mariasql.Text
  Output        String?   @mariasql.Text
  Error         String?   @mariasql.Text
  Job           Job       @relation(fields: [idJob], references: [idJob])

  @@index([Status], name: "JobRun_Status")
  @@index([idJob], name: "JobRun_idJob")
}

model License {
  idLicense         Int                 @id @default(autoincrement())
  Name              String              @mariasql.VarChar(255)
  Description       String              @mariasql.VarChar(8000)
  LicenseAssignment LicenseAssignment[]
}

model LicenseAssignment {
  idLicenseAssignment Int           @id @default(autoincrement())
  idLicense           Int
  idUserCreator       Int?
  DateStart           DateTime?     @mariasql.DateTime(0)
  DateEnd             DateTime?     @mariasql.DateTime(0)
  idSystemObject      Int?
  License             License       @relation(fields: [idLicense], references: [idLicense])
  SystemObject        SystemObject? @relation(fields: [idSystemObject], references: [idSystemObject])
  User                User?         @relation(fields: [idUserCreator], references: [idUser])

  @@index([idSystemObject], name: "LicenseAssignment_idSystemObject")
  @@index([idLicense], name: "fk_licenseassignment_license1")
  @@index([idUserCreator], name: "fk_licenseassignment_user1")
}

model Metadata {
  idMetadata        Int           @id @default(autoincrement())
  Name              String        @mariasql.VarChar(100)
  ValueShort        String?       @mariasql.VarChar(255)
  ValueExtended     String?       @mariasql.Text
  idAssetValue      Int?
  idUser            Int?
  idVMetadataSource Int?
  idSystemObject    Int?
  Asset             Asset?        @relation(fields: [idAssetValue], references: [idAsset])
  SystemObject      SystemObject? @relation(fields: [idSystemObject], references: [idSystemObject])
  User              User?         @relation(fields: [idUser], references: [idUser])
  Vocabulary        Vocabulary?   @relation(fields: [idVMetadataSource], references: [idVocabulary])

  @@index([Name], name: "Metadata_Name")
  @@index([idAssetValue], name: "Metadata_idAssetValue")
  @@index([idSystemObject], name: "Metadata_idSystemObject")
  @@index([idUser], name: "fk_metadata_user1")
  @@index([idVMetadataSource], name: "fk_metadata_vocabulary1")
}

model Model {
  idModel                                        Int                     @id @default(autoincrement())
  Name                                           String                  @mariasql.VarChar(255)
  DateCreated                                    DateTime                @mariasql.DateTime(0)
  Master                                         Boolean
  Authoritative                                  Boolean
  idVCreationMethod                              Int
  idVModality                                    Int
  idVUnits                                       Int
  idVPurpose                                     Int
  idVFileType                                    Int
  idAssetThumbnail                               Int?
  idModelMetrics                                 Int?
  Asset                                          Asset?                  @relation(fields: [idAssetThumbnail], references: [idAsset])
  ModelMetrics                                   ModelMetrics?           @relation(fields: [idModelMetrics], references: [idModelMetrics])
  Vocabulary_Model_idVCreationMethodToVocabulary Vocabulary              @relation("Model_idVCreationMethodToVocabulary", fields: [idVCreationMethod], references: [idVocabulary])
  Vocabulary_Model_idVFileTypeToVocabulary       Vocabulary              @relation("Model_idVFileTypeToVocabulary", fields: [idVFileType], references: [idVocabulary])
  Vocabulary_Model_idVModalityToVocabulary       Vocabulary              @relation("Model_idVModalityToVocabulary", fields: [idVModality], references: [idVocabulary])
  Vocabulary_Model_idVPurposeToVocabulary        Vocabulary              @relation("Model_idVPurposeToVocabulary", fields: [idVPurpose], references: [idVocabulary])
  Vocabulary_Model_idVUnitsToVocabulary          Vocabulary              @relation("Model_idVUnitsToVocabulary", fields: [idVUnits], references: [idVocabulary])
  ModelMaterialUVMap                             ModelMaterialUVMap[]
  ModelObject                                    ModelObject[]
  ModelProcessingAction                          ModelProcessingAction[]
  ModelSceneXref                                 ModelSceneXref[]
  SystemObject                                   SystemObject?

  @@index([idAssetThumbnail], name: "fk_model_asset1")
  @@index([idModelMetrics], name: "fk_model_modelmetrics1")
  @@index([idVCreationMethod], name: "fk_model_vocabulary1")
  @@index([idVModality], name: "fk_model_vocabulary2")
  @@index([idVUnits], name: "fk_model_vocabulary3")
  @@index([idVPurpose], name: "fk_model_vocabulary4")
  @@index([idVFileType], name: "fk_model_vocabulary5")
}

model ModelMaterial {
  idModelMaterial      Int                    @id @default(autoincrement())
  idModelObject        Int
  Name                 String?                @mariasql.VarChar(255)
  ModelObject          ModelObject            @relation(fields: [idModelObject], references: [idModelObject])
  ModelMaterialChannel ModelMaterialChannel[]

  @@index([idModelObject], name: "Model_idModelObject")
}

model ModelMaterialChannel {
  idModelMaterialChannel Int                 @id @default(autoincrement())
  idModelMaterial        Int
  idVMaterialType        Int?
  MaterialTypeOther      String?             @mariasql.VarChar(255)
  idModelMaterialUVMap   Int?
  ChannelPosition        Int?
  ChannelWidth           Int?
  Scalar1                Float?
  Scalar2                Float?
  Scalar3                Float?
  Scalar4                Float?
  ModelMaterial          ModelMaterial       @relation(fields: [idModelMaterial], references: [idModelMaterial])
  ModelMaterialUVMap     ModelMaterialUVMap? @relation(fields: [idModelMaterialUVMap], references: [idModelMaterialUVMap])
  Vocabulary             Vocabulary?         @relation(fields: [idVMaterialType], references: [idVocabulary])

  @@index([idModelMaterial], name: "ModelMaterialChannel_idModelMaterial")
  @@index([idModelMaterialUVMap], name: "fk_modelmaterialchannel_modelmaterialuvmap1")
  @@index([idVMaterialType], name: "fk_modelmaterialchannel_vocabulary1")
}

model ModelMaterialUVMap {
  idModelMaterialUVMap Int                    @id @default(autoincrement())
  idModel              Int
  idAsset              Int
  UVMapEdgeLength      Int
  Asset                Asset                  @relation(fields: [idAsset], references: [idAsset])
  Model                Model                  @relation(fields: [idModel], references: [idModel])
  ModelMaterialChannel ModelMaterialChannel[]

  @@index([idAsset], name: "ModelUVMapFile_idAsset")
  @@index([idModel], name: "ModelUVMapFile_idModel")
}

model ModelMetrics {
  idModelMetrics               Int           @id @default(autoincrement())
  BoundingBoxP1X               Float?
  BoundingBoxP1Y               Float?
  BoundingBoxP1Z               Float?
  BoundingBoxP2X               Float?
  BoundingBoxP2Y               Float?
  BoundingBoxP2Z               Float?
  CountPoint                   Int?
  CountFace                    Int?
  CountColorChannel            Int?
  CountTextureCoorinateChannel Int?
  HasBones                     Boolean?
  HasFaceNormals               Boolean?
  HasTangents                  Boolean?
  HasTextureCoordinates        Boolean?
  HasVertexNormals             Boolean?
  HasVertexColor               Boolean?
  IsManifold                   Boolean?
  IsWatertight                 Boolean?
  Model                        Model[]
  ModelObject                  ModelObject[]
}

model ModelObject {
  idModelObject  Int             @id @default(autoincrement())
  idModel        Int
  idModelMetrics Int?
  Model          Model           @relation(fields: [idModel], references: [idModel])
  ModelMetrics   ModelMetrics?   @relation(fields: [idModelMetrics], references: [idModelMetrics])
  ModelMaterial  ModelMaterial[]

  @@index([idModel], name: "ModelObject_idModel")
  @@index([idModelMetrics], name: "fk_modelobject_modelmetrics1")
}

model ModelProcessingAction {
  idModelProcessingAction   Int                         @id @default(autoincrement())
  idModel                   Int
  idActor                   Int
  DateProcessed             DateTime                    @mariasql.DateTime(0)
  ToolsUsed                 String                      @mariasql.VarChar(1000)
  Description               String                      @mariasql.Text
  Actor                     Actor                       @relation(fields: [idActor], references: [idActor])
  Model                     Model                       @relation(fields: [idModel], references: [idModel])
  ModelProcessingActionStep ModelProcessingActionStep[]

  @@index([idActor], name: "ModelProcessingAction_idActor")
  @@index([idModel], name: "ModelProcessingAction_idModel")
}

model ModelProcessingActionStep {
  idModelProcessingActionStep Int                   @id @default(autoincrement())
  idModelProcessingAction     Int
  idVActionMethod             Int
  Description                 String                @mariasql.Text
  ModelProcessingAction       ModelProcessingAction @relation(fields: [idModelProcessingAction], references: [idModelProcessingAction])
  Vocabulary                  Vocabulary            @relation(fields: [idVActionMethod], references: [idVocabulary])

  @@index([idModelProcessingAction], name: "fk_modelprocessingactionstep_modelprocessingaction1")
  @@index([idVActionMethod], name: "fk_modelprocessingactionstep_vocabulary1")
}

model ModelSceneXref {
  idModelSceneXref Int    @id @default(autoincrement())
  idModel          Int
  idScene          Int
  TS0              Float?
  TS1              Float?
  TS2              Float?
  R0               Float?
  R1               Float?
  R2               Float?
  R3               Float?
  Model            Model  @relation(fields: [idModel], references: [idModel])
  Scene            Scene  @relation(fields: [idScene], references: [idScene])

  @@index([idModel], name: "ModelSceneXref_idModel")
  @@index([idScene], name: "ModelSceneXref_idScene")
}

model Project {
  idProject            Int                    @id @default(autoincrement())
  Name                 String                 @mariasql.VarChar(128)
  Description          String?                @mariasql.VarChar(8000)
  ProjectDocumentation ProjectDocumentation[]
  SystemObject         SystemObject?
  Workflow             Workflow[]
}

model ProjectDocumentation {
  idProjectDocumentation Int           @id @default(autoincrement())
  idProject              Int
  Name                   String        @mariasql.VarChar(255)
  Description            String        @mariasql.VarChar(8000)
  Project                Project       @relation(fields: [idProject], references: [idProject])
  SystemObject           SystemObject?

  @@index([idProject], name: "fk_projectdocumentation_project1")
}

model Scene {
  idScene          Int              @id @default(autoincrement())
  Name             String           @mariasql.VarChar(255)
  idAssetThumbnail Int?
  IsOriented       Boolean
  HasBeenQCd       Boolean
  Asset            Asset?           @relation(fields: [idAssetThumbnail], references: [idAsset])
  ModelSceneXref   ModelSceneXref[]
  SystemObject     SystemObject?

  @@index([idAssetThumbnail], name: "fk_scene_asset1")
}

model Stakeholder {
  idStakeholder     Int           @id @default(autoincrement())
  IndividualName    String        @mariasql.VarChar(255)
  OrganizationName  String        @mariasql.VarChar(255)
  EmailAddress      String?       @mariasql.VarChar(255)
  PhoneNumberMobile String?       @mariasql.VarChar(32)
  PhoneNumberOffice String?       @mariasql.VarChar(32)
  MailingAddress    String?       @mariasql.VarChar(255)
  SystemObject      SystemObject?
}

model Subject {
  idSubject             Int           @id @default(autoincrement())
  idUnit                Int
  idAssetThumbnail      Int?
  idGeoLocation         Int?
  Name                  String        @mariasql.VarChar(255)
  idIdentifierPreferred Int?
  Asset                 Asset?        @relation(fields: [idAssetThumbnail], references: [idAsset])
  GeoLocation           GeoLocation?  @relation(fields: [idGeoLocation], references: [idGeoLocation])
  Identifier            Identifier?   @relation(fields: [idIdentifierPreferred], references: [idIdentifier])
  Unit                  Unit          @relation(fields: [idUnit], references: [idUnit])
  SystemObject          SystemObject?

  @@index([idAssetThumbnail], name: "fk_subject_asset1")
  @@index([idGeoLocation], name: "fk_subject_geolocation1")
  @@index([idIdentifierPreferred], name: "fk_subject_identifier1")
  @@index([idUnit], name: "fk_subject_unit1")
}

model SystemObject {
  idSystemObject                                                        Int                               @id @default(autoincrement())
  idUnit                                                                Int?                              @unique
  idProject                                                             Int?                              @unique
  idSubject                                                             Int?                              @unique
  idItem                                                                Int?                              @unique
  idCaptureData                                                         Int?                              @unique
  idModel                                                               Int?                              @unique
  idScene                                                               Int?                              @unique
  idIntermediaryFile                                                    Int?                              @unique
  idAsset                                                               Int?                              @unique
  idAssetVersion                                                        Int?                              @unique
  idProjectDocumentation                                                Int?                              @unique
  idActor                                                               Int?                              @unique
  idStakeholder                                                         Int?                              @unique
  Retired                                                               Boolean
  Actor                                                                 Actor?                            @relation(fields: [idActor], references: [idActor])
  Asset_AssetToSystemObject_idAsset                                     Asset?                            @relation("AssetToSystemObject_idAsset", fields: [idAsset], references: [idAsset])
  AssetVersion                                                          AssetVersion?                     @relation(fields: [idAssetVersion], references: [idAssetVersion])
  CaptureData                                                           CaptureData?                      @relation(fields: [idCaptureData], references: [idCaptureData])
  IntermediaryFile                                                      IntermediaryFile?                 @relation(fields: [idIntermediaryFile], references: [idIntermediaryFile])
  Item                                                                  Item?                             @relation(fields: [idItem], references: [idItem])
  Model                                                                 Model?                            @relation(fields: [idModel], references: [idModel])
  Project                                                               Project?                          @relation(fields: [idProject], references: [idProject])
  ProjectDocumentation                                                  ProjectDocumentation?             @relation(fields: [idProjectDocumentation], references: [idProjectDocumentation])
  Scene                                                                 Scene?                            @relation(fields: [idScene], references: [idScene])
  Stakeholder                                                           Stakeholder?                      @relation(fields: [idStakeholder], references: [idStakeholder])
  Subject                                                               Subject?                          @relation(fields: [idSubject], references: [idSubject])
  Unit                                                                  Unit?                             @relation(fields: [idUnit], references: [idUnit])
  AccessContextObject                                                   AccessContextObject[]
  Asset_Asset_idSystemObjectToSystemObject                              Asset[]                           @relation("Asset_idSystemObjectToSystemObject")
  Identifier                                                            Identifier[]
  LicenseAssignment                                                     LicenseAssignment[]
  Metadata                                                              Metadata[]
  SystemObjectVersion                                                   SystemObjectVersion[]
  SystemObjectXref_SystemObjectToSystemObjectXref_idSystemObjectDerived SystemObjectXref[]                @relation("SystemObjectToSystemObjectXref_idSystemObjectDerived")
  SystemObjectXref_SystemObjectToSystemObjectXref_idSystemObjectMaster  SystemObjectXref[]                @relation("SystemObjectToSystemObjectXref_idSystemObjectMaster")
  UserPersonalizationSystemObject                                       UserPersonalizationSystemObject[]
  WorkflowStepSystemObjectXref                                          WorkflowStepSystemObjectXref[]

  @@index([idActor], name: "SystemObject_idActor")
  @@index([idAsset], name: "SystemObject_idAsset")
  @@index([idAssetVersion], name: "SystemObject_idAssetVersion")
  @@index([idCaptureData], name: "SystemObject_idCaptureData")
  @@index([idIntermediaryFile], name: "SystemObject_idIntermediaryFile")
  @@index([idItem], name: "SystemObject_idItem")
  @@index([idModel], name: "SystemObject_idModel")
  @@index([idProject], name: "SystemObject_idProject")
  @@index([idProjectDocumentation], name: "SystemObject_idProjectDocumentation")
  @@index([idScene], name: "SystemObject_idScene")
  @@index([idStakeholder], name: "SystemObject_idStakeholder")
  @@index([idSubject], name: "SystemObject_idSubject")
  @@index([idUnit], name: "SystemObject_idUnit")
}

model SystemObjectVersion {
  idSystemObjectVersion Int          @id @default(autoincrement())
  idSystemObject        Int
  PublishedState        Int
  SystemObject          SystemObject @relation(fields: [idSystemObject], references: [idSystemObject])

  @@index([idSystemObject, idSystemObjectVersion], name: "ObjectVersion_idSystemObject_idObjectVersion")
}

model SystemObjectXref {
  idSystemObjectXref                                                Int          @id @default(autoincrement())
  idSystemObjectMaster                                              Int
  idSystemObjectDerived                                             Int
  SystemObject_SystemObjectToSystemObjectXref_idSystemObjectDerived SystemObject @relation("SystemObjectToSystemObjectXref_idSystemObjectDerived", fields: [idSystemObjectDerived], references: [idSystemObject])
  SystemObject_SystemObjectToSystemObjectXref_idSystemObjectMaster  SystemObject @relation("SystemObjectToSystemObjectXref_idSystemObjectMaster", fields: [idSystemObjectMaster], references: [idSystemObject])

  @@index([idSystemObjectDerived], name: "SystemObjectXref_idSystemObjectDerived")
  @@index([idSystemObjectMaster], name: "SystemObjectXref_idSystemObjectMaster")
}

model Unit {
  idUnit       Int           @id @default(autoincrement())
  Name         String        @mariasql.VarChar(255)
  Abbreviation String?       @mariasql.VarChar(20)
  ARKPrefix    String?       @mariasql.VarChar(255)
  Actor        Actor[]
  Subject      Subject[]
  SystemObject SystemObject?
  UnitEdan     UnitEdan[]
}

model UnitEdan {
  idUnitEdan   Int    @id @default(autoincrement())
  idUnit       Int?
  Abbreviation String @unique @mariasql.VarChar(100)
  Unit         Unit?  @relation(fields: [idUnit], references: [idUnit])

  @@index([Abbreviation], name: "UnitEdan_Abbreviation")
  @@index([idUnit], name: "fk_unitedan_idunit")
}

model User {
  idUser                          Int                               @id @default(autoincrement())
  Name                            String                            @mariasql.VarChar(255)
  EmailAddress                    String                            @mariasql.VarChar(255)
  SecurityID                      String                            @mariasql.VarChar(255)
  Active                          Boolean
  DateActivated                   DateTime                          @mariasql.DateTime(0)
  DateDisabled                    DateTime?                         @mariasql.DateTime(0)
  WorkflowNotificationTime        DateTime?                         @mariasql.Time(0)
  EmailSettings                   Int?
  AccessPolicy                    AccessPolicy[]
  AssetVersion                    AssetVersion[]
  LicenseAssignment               LicenseAssignment[]
  Metadata                        Metadata[]
  UserPersonalizationSystemObject UserPersonalizationSystemObject[]
  UserPersonalizationUrl          UserPersonalizationUrl[]
  Workflow                        Workflow[]
  WorkflowStep                    WorkflowStep[]

  @@index([EmailAddress], name: "user_EmailAddress")
}

model UserPersonalizationSystemObject {
  idUserPersonalizationSystemObject Int          @id @default(autoincrement())
  idUser                            Int
  idSystemObject                    Int
  Personalization                   String?      @mariasql.VarChar(8000)
  SystemObject                      SystemObject @relation(fields: [idSystemObject], references: [idSystemObject])
  User                              User         @relation(fields: [idUser], references: [idUser])

  @@index([idUser], name: "UserPersonalizationObject_idUser")
  @@index([idUser, idSystemObject], name: "UserPersonalizationObject_idUser_idSystemObject")
  @@index([idSystemObject], name: "fk_userpersonalizationsystemobject_systemobject1")
}

model UserPersonalizationUrl {
  idUserPersonalizationUrl Int    @id @default(autoincrement())
  idUser                   Int
  URL                      String @mariasql.VarChar(255)
  Personalization          String @mariasql.VarChar(8000)
  User                     User   @relation(fields: [idUser], references: [idUser])

  @@index([idUser, URL], name: "UserPersonalizationUrl_idUser_URL")
}

model Vocabulary {
  idVocabulary                                                             Int                         @id @default(autoincrement())
  idVocabularySet                                                          Int
  SortOrder                                                                Int
  Term                                                                     String                      @mariasql.VarChar(255)
  VocabularySet                                                            VocabularySet               @relation(fields: [idVocabularySet], references: [idVocabularySet])
  Asset                                                                    Asset[]
  CaptureData                                                              CaptureData[]
  CaptureDataFile                                                          CaptureDataFile[]
  CaptureDataPhoto_CaptureDataPhoto_idVBackgroundRemovalMethodToVocabulary CaptureDataPhoto[]          @relation("CaptureDataPhoto_idVBackgroundRemovalMethodToVocabulary")
  CaptureDataPhoto_CaptureDataPhoto_idVCaptureDatasetTypeToVocabulary      CaptureDataPhoto[]          @relation("CaptureDataPhoto_idVCaptureDatasetTypeToVocabulary")
  CaptureDataPhoto_CaptureDataPhoto_idVClusterTypeToVocabulary             CaptureDataPhoto[]          @relation("CaptureDataPhoto_idVClusterTypeToVocabulary")
  CaptureDataPhoto_CaptureDataPhoto_idVFocusTypeToVocabulary               CaptureDataPhoto[]          @relation("CaptureDataPhoto_idVFocusTypeToVocabulary")
  CaptureDataPhoto_CaptureDataPhoto_idVItemPositionTypeToVocabulary        CaptureDataPhoto[]          @relation("CaptureDataPhoto_idVItemPositionTypeToVocabulary")
  CaptureDataPhoto_CaptureDataPhoto_idVLightSourceTypeToVocabulary         CaptureDataPhoto[]          @relation("CaptureDataPhoto_idVLightSourceTypeToVocabulary")
  Identifier                                                               Identifier[]
  Job                                                                      Job[]
  Metadata                                                                 Metadata[]
  Model_Model_idVCreationMethodToVocabulary                                Model[]                     @relation("Model_idVCreationMethodToVocabulary")
  Model_Model_idVFileTypeToVocabulary                                      Model[]                     @relation("Model_idVFileTypeToVocabulary")
  Model_Model_idVModalityToVocabulary                                      Model[]                     @relation("Model_idVModalityToVocabulary")
  Model_Model_idVPurposeToVocabulary                                       Model[]                     @relation("Model_idVPurposeToVocabulary")
  Model_Model_idVUnitsToVocabulary                                         Model[]                     @relation("Model_idVUnitsToVocabulary")
  ModelMaterialChannel                                                     ModelMaterialChannel[]
  ModelProcessingActionStep                                                ModelProcessingActionStep[]
  WorkflowStep                                                             WorkflowStep[]

  @@index([idVocabularySet, SortOrder], name: "Vocabulary_idVocabulySet_SortOrder")
}

model VocabularySet {
  idVocabularySet  Int          @id @default(autoincrement())
  Name             String       @mariasql.VarChar(255)
  SystemMaintained Boolean
  Vocabulary       Vocabulary[]
}

model Workflow {
  idWorkflow         Int              @id @default(autoincrement())
  idWorkflowTemplate Int
  idProject          Int?
  idUserInitiator    Int?
  DateInitiated      DateTime         @mariasql.DateTime(0)
  DateUpdated        DateTime         @mariasql.DateTime(0)
  Project            Project?         @relation(fields: [idProject], references: [idProject])
  User               User?            @relation(fields: [idUserInitiator], references: [idUser])
  WorkflowTemplate   WorkflowTemplate @relation(fields: [idWorkflowTemplate], references: [idWorkflowTemplate])
  WorkflowStep       WorkflowStep[]

  @@index([idProject], name: "Workflow_idProject")
  @@index([idUserInitiator], name: "Workflow_idUserInitiator")
  @@index([idWorkflowTemplate], name: "fk_workflow_workflowtemplate1")
}

model WorkflowStep {
  idWorkflowStep               Int                            @id @default(autoincrement())
  idWorkflow                   Int
  idUserOwner                  Int
  idVWorkflowStepType          Int
  State                        Int
  DateCreated                  DateTime                       @mariasql.DateTime(0)
  DateCompleted                DateTime?                      @mariasql.DateTime(0)
  User                         User                           @relation(fields: [idUserOwner], references: [idUser])
  Vocabulary                   Vocabulary                     @relation(fields: [idVWorkflowStepType], references: [idVocabulary])
  Workflow                     Workflow                       @relation(fields: [idWorkflow], references: [idWorkflow])
  WorkflowStepSystemObjectXref WorkflowStepSystemObjectXref[]

  @@index([State, idWorkflow], name: "WorkflowStep_State_idWorkflow")
  @@index([idUserOwner], name: "WorkflowStep_idUserOwner")
  @@index([idWorkflow, DateCompleted], name: "WorkflowStep_idWorkflow_DateCompleted")
  @@index([idWorkflow, DateCreated], name: "WorkflowStep_idWorkflow_DateCreated")
  @@index([idVWorkflowStepType], name: "fk_workflowstep_vocabulary1")
}

model WorkflowStepSystemObjectXref {
  idWorkflowStepSystemObjectXref Int          @id @default(autoincrement())
  idWorkflowStep                 Int
  idSystemObject                 Int
  Input                          Boolean
  SystemObject                   SystemObject @relation(fields: [idSystemObject], references: [idSystemObject])
  WorkflowStep                   WorkflowStep @relation(fields: [idWorkflowStep], references: [idWorkflowStep])

  @@index([idSystemObject, Input], name: "WorkflowStepSystemObjectXref_idSystemObject_Input")
  @@index([idWorkflowStep, Input], name: "WorkflowStepSystemObjectXref_idWorkflowStep_Input")
}

model WorkflowTemplate {
  idWorkflowTemplate Int        @id @default(autoincrement())
  Name               String     @mariasql.VarChar(255)
  Workflow           Workflow[]
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @janpio, this is working now for me as mentioned in the release notes with the ‘f#’ replacements - Great work! Thanks for getting this fixed, it’s much appreciated! 🙏

I have the same issue. Here is a minimal example to trigger it:

My environment:

  • node 15.7.0
  • Prisma: 2.22.1
  • Linux Ubuntu 20.04
  • MariaDB 10.5.10
  1. Create a table with this script
CREATE TABLE `Tags` (
  `TagName` varchar(100) NOT NULL,
  PRIMARY KEY (`TagName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  1. Create a stored procedure with this script:
CREATE PROCEDURE test1()
BEGIN
INSERT INTO Tags (TagName) VALUES (CONVERT(FLOOR(RAND()*1000), CHAR));
SELECT * from Tags;
END

The random stuff in the INSERT is irrelevant. This is so every time this runs you get different numbers.

  1. Now, with Prisma:
prisma.$queryRaw(`CALL test1;`).then((r) => console.log(r));

This results in the following error:

Error: 
Invalid `prisma.queryRaw()` invocation:
  PANIC in query-engine/connectors/sql-query-connector/src/query_ext.rs:58:43
index out of bounds: the len is 0 but the index is 0

This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.

If you then query the Tags table, you will see that although Prisma panicked it created two rows, when it should only have created one. (!!)

If you then remove the SELECT * from Tags;, everything works and only one row is created as expected, but of course no rows are returned since the SELECT is not there.

The same issue also occurs with anonymous procedures:

prisma.$queryRaw(`
BEGIN NOT ATOMIC
   INSERT INTO Tags (TagName) VALUES (CONVERT(FLOOR(RAND()*1000), CHAR));
    SELECT * FROM Tags;
END`
  )
  .then((r) => console.log(r));

Running the above panics and also creates two rows in the Tags table. The two rows thing has got me puzzled.

I hope this helps.

@janpio, I tweaked your edits slightly, but otherwise they seem fine. For what it’s worth, I am 100% consistently reproducing this issue using MariaDB v10.4.12. I’m not sure if ‘vanilla’ MySQL will also show the problem.

In addition to creating the stored procedure, I suspect you will also need to create the database and then the appropriate prisma client. The prisma schema was supplied above … if you need the SQL to create the DB, let me know.