Skip to content

vector(N) columns enforce dimensions but expose atttypmod = -1 and format_type = '???' #3230

Description

@off-axis
  • Image: dolthub/doltgresql:1.3.0
  • PostgreSQL-compatible Django database connection backed by psycopg 3
  • pgvector extension enabled

Doltgres correctly creates and enforces a dimensioned pgvector column, but PostgreSQL catalog introspection cannot report its type modifier.

Repro

CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE vector_typmod_probe (
    embedding vector(1024) NOT NULL
);

SELECT
    attribute.atttypmod,
    format_type(attribute.atttypid, attribute.atttypmod)
FROM pg_attribute AS attribute
JOIN pg_class AS relation
    ON relation.oid = attribute.attrelid
WHERE relation.relname = 'vector_typmod_probe'
  AND attribute.attname = 'embedding'
  AND attribute.attnum > 0
  AND NOT attribute.attisdropped;

Actual result

atttypmod | format_type
----------+------------
-1        | ???

Expected result

format_type(...) should report:

vector(1024)

The catalog should preserve enough typmod information for standard PostgreSQL schema-introspection queries to recover the declared dimension.

The dimension is enforced despite the missing metadata:

INSERT INTO vector_typmod_probe VALUES ('[1,2,3]'::vector);

Doltgres correctly rejects this with:

expected 1024 dimensions, not 3

Valid 1024-dimensional vectors can be stored and queried, and pgvector distance operations work. The problem appears limited to PostgreSQL catalog and type-formatting compatibility.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions