Skip to content

Error with ::vector(1536) – pgvector + PostgreSQL #1612

@ahmadmayahi

Description

@ahmadmayahi

Telescope Version

5.10.0

Laravel Version

12.20.0

PHP Version

8.4.10

Database Driver & Version

pgsql 17

Description

I’m running into a parsing error when using a query like this in Telescope:

Parse error: Unexpected "::vector(1"
This likely happens because you're using the default "sql" dialect.

This is the line that seems to break it:

?::vector(1536)

It’s valid PostgreSQL syntax when using the pgvector extension, works fine in the database itself. But whatever is parsing the query (probably for display or formatting in the frontend) doesn’t seem to recognize the ::vector cast and throws an error.

My Query (Truncated):

WITH vectorchord_candidates AS (
    SELECT id, chunk, embedding, agent_file_id,
           {$distanceOperator}
    FROM documents
    WHERE agent_id = ?
    ORDER BY embedding <-> ?::vector(1536)
    LIMIT ?
)
Image Image

Steps To Reproduce

Steps to Reproduce

  1. Use PostgreSQL with the pgvector extension installed.
  2. Run a query that uses ?::vector. Example:
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\DB;

Route::get('/test', function () {
    DB::select('
        SELECT ARRAY[0.0, 0.1, 0.2, 0.3, 0.4, 0.0]::vector(6) AS test_vector
    ');
});
  1. Open the query in Telescope.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions