Skip to content

[BUG] Prompted to enter variables using PostgreSQL $${ .. } JSON #1721

@learyt

Description

@learyt
  • Database type and version: PostgreSQL 17.5

Environment:

VS Code Version: 1.108.1 (user setup)
Database Client Version: 8.4.3 & 8.4.4 (both tested)
OS: Windows 11 (10.0.22631)
Electron: 39.2.7
Node.js: 22.21.1
Description:

Running a command with an $${ .. } JSON in it expects variables to be entered for the { portion.

Message: "Please enter a value for the variable {."

INSERT INTO
    bsve."StaticAsset" (id, "name", "value")
VALUES (
        gen_random_uuid (),
        'some name' $${
        "app": {
            "name": "API",
            "environment": "development",
            "allowHeaders": "Content-Type, Authorization, Apollo-Require-Preflight, X-Api-Key",
            "allowMethods": "POST,GET,OPTIONS",
        }
      }$$::jsonb
    )
ON CONFLICT (name) DO
UPDATE
SET
    "value" = excluded."value";
Image

What I've Tried:
Running without the $${ .. } works correctly

INSERT INTO
    bsve."StaticAsset" (id, "name", "value")
VALUES (
        gen_random_uuid (),
        'some name',
        '{ "app": { "name": "API", "environment": "development", "allowHeaders": "Content-Type, Authorization, Apollo-Require-Preflight, X-Api-Key", "allowMethods": "POST,GET,OPTIONS" } }'
    )
ON CONFLICT (name) DO
UPDATE
SET
    "value" = excluded."value";

INSERT INTO
    bsve."StaticAsset" (id, "name", "value")
VALUES (
        gen_random_uuid (),
        'some name',
        '{ "app": { "name": "API", "environment": "development", "allowHeaders": "Content-Type, Authorization, Apollo-Require-Preflight, X-Api-Key", "allowMethods": "POST,GET,OPTIONS" } }'::jsonb
    )
ON CONFLICT (name) DO
UPDATE
SET
    "value" = excluded."value";

Expected Behavior:
Should run without prompting to put in values.

Additional Context:
This works fine using the Microsoft PostgreSQL VSCode extension, Beekeeper Studio, and WebStorm database commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions