Skip to content

PostgreSQL jsonb values are truncated in result view and CSV export #1102

@bootun

Description

@bootun

Bug Description

When viewing long jsonb values in DBCode, the content is truncated and cannot be viewed completely.

The same truncation happens in multiple places:

  • Directly browsing table data
  • Viewing the value through a SQL query
  • Exporting the result to CSV

For long jsonb fields, DBCode shows only partial content and appends a size marker such as ... (~2KB). Currently I cannot find a way to view or export the full original jsonb value inside DBCode.

The related table/data below has been anonymized.

Repro steps

  1. Connect to a PostgreSQL database in DBCode.
  2. Create a table with a jsonb column, for example:
CREATE TABLE public.example_generation_record (
    id bigint NOT NULL,
    -- ...
    reference_files jsonb DEFAULT '[]'::jsonb NOT NULL,
    -- ...
);
  1. Insert or query a row containing a relatively long jsonb value, for example:
INSERT INTO public.example_generation_record (
    id,
    ...
    reference_files,
    ...
) VALUES (
    1,
    ...
    '[
      {
        "id": "prop:00000000-0000-0000-0000-000000000000",
        "url": "https://example.com/uploaded-files/example-image.png",
        "type": "image",
        "label": "example image label",
        "source": "asset_context",
        "view_id": "00000000-0000-0000-0000-000000000000",
        "asset_id": "00000000-0000-0000-0000-000000000000",
        "state_id": "00000000-0000-0000-0000-000000000000",
        "metadata": {
          "long_text": "This is a long anonymized jsonb field. Repeat this text many times to make the jsonb value larger than a few KB. This should be enough to reproduce the truncation behavior in the DBCode result grid and CSV export."
        }
      },
      ...
    ]'::jsonb,
  ...
);
  1. View the table data directly in DBCode.
  2. Run a query such as:
SELECT reference_files
FROM public.example_generation_record
WHERE id = 1;
  1. Observe that the jsonb value is truncated and ends with something like:
... (~2KB)
  1. Export the query result or table data as CSV.
  2. Open the exported CSV and observe that the exported value is also truncated.

Expected Behavior

DBCode should provide a way to view and export the full jsonb value.

For example:

  • The result grid could show a truncated preview, but allow opening the full cell value in a separate viewer/editor.
  • SQL query results should preserve the full value internally.
  • CSV export should export the complete original jsonb content, not the truncated display preview.

Actual Behavior

Long jsonb values are truncated in the DBCode UI.

The truncated value appears to include a size marker like:

... (~2KB)

The same truncated content is also exported to CSV, so the original full jsonb data cannot be retrieved through DBCode.

Environment

  • DBCode version: 1.31.2
  • VS Code (or fork) version: 1.120.0 (Universal)
  • OS: MacOS
  • Database: PostgreSQL
  • Connection: direct

Error Meesages (if applicable)

No error message is shown. The jsonb value is silently truncated.

Screenshots

If applicable, add screenshots showing:

  • The truncated jsonb value in the result grid
  • The ... (~2KB) suffix
  • The exported CSV containing the same truncated value

Logs

If available, paste relevant logs from the Output panel: View > Output > DBCode.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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