const DISCOVER_PGVECTOR_COLUMNS_QUERY: &str = r#"
SELECT
a.attname as column_name,
a.atttypmod as atttypmod,
format_type(a.atttypid, a.atttypmod) as formatted_type
FROM pg_attribute a
JOIN pg_class c ON c.oid = a.attrelid
JOIN pg_namespace n ON n.oid = c.relnamespace
JOIN pg_type t ON t.oid = a.atttypid
WHERE n.nspname = $1
AND c.relname = $2
AND t.typname = 'vector'
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY a.attnum
"#;Expand description
Discover pgvector columns with both atttypmod (dimension) and format_type text.
vector(n) is stored as atttypmod = n, while dimension-less vector uses -1.
We rely on this to keep user-defined type modifiers that are not preserved by sea-schema.