{"record":{"id":"00138bc43cd7f55d","repo":"cube-js/cube","slug":"unable-to-detect-type-for-field-f-name-with-d-00138b","errorCode":null,"errorMessage":"Unable to detect type for field \"${f.name}\" with dataTypeID: ${f.dataTypeID}","messagePattern":"Unable to detect type for field \"(.+?)\" with dataTypeID: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-questdb-driver/src/QuestDriver.ts","lineNumber":134,"sourceCode":"\n  private getInitialConfiguration(): Partial<QuestDriverConfiguration> {\n    return {\n      readOnly: true,\n    };\n  }\n\n  public async testConnection(): Promise<void> {\n    await this.pool.query('SELECT $1 AS number', ['1']);\n  }\n\n  private mapFields(fields: FieldDef[]) {\n    return fields.map((f) => {\n      let questType;\n      if (f.dataTypeID in NativeTypeToQuestType) {\n        questType = NativeTypeToQuestType[f.dataTypeID].toLowerCase();\n      }\n      if (!questType) {\n        throw new Error(\n          `Unable to detect type for field \"${f.name}\" with dataTypeID: ${f.dataTypeID}`\n        );\n      }\n\n      return ({\n        name: f.name,\n        type: this.toGenericType(questType)\n      });\n    });\n  }\n\n  public async query<R = unknown>(query: string, values: unknown[], _options?: QueryOptions): Promise<R[]> {\n    const result = await this.queryResponse(query, values);\n    return result.rows;\n  }\n\n  private async queryResponse(query: string, values: unknown[]) {\n    const conn = await this.pool.connect();","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-questdb-driver/src/QuestDriver.ts#L116-L152","documentation":"QuestDriver.mapFields converts PostgreSQL wire-protocol field type OIDs (dataTypeID) to QuestDB types using the NativeTypeToQuestType map. When a result column's OID is not in the map, the driver cannot determine the column type and throws during downloadQueryResults.","triggerScenarios":"downloadQueryResults returning a column whose dataTypeID has no mapping — e.g. exotic PostgreSQL types (jsonb, arrays, uuid, custom enum/domain types) in tables being introspected or uploaded.","commonSituations":"Schema introspection over a table with non-standard column types; version drift where a driver release lacks the OID mapping for a newer type; using a Postgres view with computed columns of unmapped types.","solutions":["Change the source column to a supported type (int, float, string, timestamp, boolean) or cast it in the query (e.g. `SELECT col::text`)","Add the missing dataTypeID mapping to NativeTypeToQuestType in QuestDriver.ts","Update the questdb-driver package, as newer versions add OID mappings"],"exampleFix":"// before\nSELECT * FROM events; -- extra: jsonb column\n// after\nSELECT id, ts, extra::text AS extra FROM events;","handlingStrategy":"type-guard","validationCode":"const supported = new Set(Object.values(NativeTypeToQuestType)); // cast unmapped columns in SQL before download","typeGuard":"function isMappedField(f) { return f.dataTypeID in NativeTypeToQuestType; }","tryCatchPattern":"try { await driver.downloadQueryResults(query, values); } catch (e) { if (e.message.includes('Unable to detect type for field')) { /* cast column to text and retry */ } throw e; }","preventionTips":["Cast unsupported columns (jsonb, uuid, arrays) to text in download queries","Keep the questdb-driver package updated for new OID mappings","Inspect source table types before configuring downloads"],"tags":["type-mapping","questdb","driver"],"backgroundTag":"unknown-column-type","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}