Skip to content

[BUG]: Nulls in array returned as strings #997

@Ciantic

Description

@Ciantic

pglite 0.4.5

Repro, this test fails, PGLite returns instead: [ 'NULL', 'hello', 'NULL' ] which is it doesn't handle nulls.

import { PGlite } from "@electric-sql/pglite";
import { describe, expect, it } from "vitest";

describe("pglite array NULL reproduction", () => {
  it("text[] with NULL elements returns null, not string 'NULL'", async () => {
    const pg = new PGlite();
    await pg.waitReady;

    await pg.exec("CREATE TEMP TABLE t (val text[])");

    await pg.query("INSERT INTO t (val) VALUES ($1)", [[null, "hello", null]]);

    const res = await pg.query("SELECT val FROM t");
    expect(res.rows[0].val).toEqual([null, "hello", null]);
  });
});

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions