Skip to content

Validation fails for COPY FROM '/dev/blob' used with pglite #90

@shadow-identity

Description

@shadow-identity

Describe the bug

Hello,

I've encountered an issue with a query that is valid in pglite (https://pglite.dev/docs/api#dev-blob)

The following query:

COPY some_table FROM '/dev/blob' WITH (FORMAT csv);

...triggers a validation error: could not open file "/dev/blob" for reading: No such file or directory.

This syntax is correct within pglite, which treats /dev/blob as a special in-memory blob reference. It seems the language server is trying to validate the path against the local filesystem, which doesn't work for this special case.

It would be great if plpgsql-lsp could recognize /dev/blob as a special path and skip the filesystem check for it, or have a flag to ignore this specific check (queries on the frontend are not always used where they was defined)

I'm willing to help and contribute a pull request to fix this. Could you please provide some pointers on where this file path validation logic is located in the codebase? I want to make sure my changes align with the project's design.

Thank you for the great tool!


As a temporary workaround, I disable validation for this specific file by adding the following comment at the top of copyCsvBlob.sql:

/* plpgsql-language-server:disable validation */

Expected Behavior

No error is given

Current Behavior

could not open file "/dev/blob" for reading: No such file or directory

Environment

  • Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions