diff --git a/packages/server/src/integration-test/postgres.spec.ts b/packages/server/src/integration-test/postgres.spec.ts index cf80f2359f..ec4cb90a86 100644 --- a/packages/server/src/integration-test/postgres.spec.ts +++ b/packages/server/src/integration-test/postgres.spec.ts @@ -1200,4 +1200,38 @@ describe("postgres integrations", () => { expect(Object.keys(schema).sort()).toEqual(["id", "val1"]) }) }) + + describe("check custom column types", () => { + beforeAll(async () => { + await rawQuery( + rawDatasource, + `CREATE TABLE binaryTable ( + id BYTEA PRIMARY KEY, + column1 TEXT, + column2 INT + ); + ` + ) + }) + + it("should handle binary columns", async () => { + const response = await makeRequest( + "post", + `/api/datasources/${datasource._id}/schema` + ) + expect(response.body).toBeDefined() + expect(response.body.datasource.entities).toBeDefined() + const table = response.body.datasource.entities["binarytable"] + expect(table).toBeDefined() + expect(table.schema.id.externalType).toBe("bytea") + const row = await config.api.row.save(table._id, { + id: "1111", + column1: "hello", + column2: 222, + }) + expect(row._id).toBeDefined() + const decoded = decodeURIComponent(row._id!).replace(/'/g, '"') + expect(JSON.parse(decoded)[0]).toBe("1111") + }) + }) })