laravel/telescope

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

Open

#1,612 建立於 2025年7月20日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)PHP (5,187 star) (654 fork)user submission
help wanted

描述

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.

貢獻者指南

Error with ::vector(1536) – pgvector + PostgreSQL · laravel/telescope#1612 | Good First Issue