laravel/telescope

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

Aberta

#1.612 aberto em 20 de jul. de 2025

 (2 comentários) (0 reação) (0 responsável)PHP (654 forks)user submission
help wanted

Métricas do repositório

Stars
 (5.187 estrelas)
Métricas de merge de PR
 (Mesclagem média 7h 14m) (6 fundiu PRs em 30d)

Description

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 ?
)

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.

Guia do colaborador