fix(postgres): handle tsvector columns
This commit is contained in:
1 parent
f2a0c65724
commit
e0d481cc2e
5 files changed
+333
-15
No files matched your search
@@ -852,6 +852,9 @@ async function newQuery() {
|
||||
function isAutoGeneratedColumn(column: ColumnInfo, _dbType?: DatabaseType): boolean {
|
||||
const extra = (column.extra ?? "").toLowerCase().trim();
|
||||
const colDefault = (column.column_default ?? "").toLowerCase().trim();
|
||||
const dataType = (column.data_type ?? "").trim();
|
||||
|
||||
if (typeLooksPostgresTextSearchVector(dataType)) return true;
|
||||
|
||||
// MySQL / MariaDB: extra contains "auto_increment"
|
||||
if (extra.includes("auto_increment")) return true;
|
||||
@@ -919,6 +922,14 @@ function typeLooksArray(dataType: string): boolean {
|
||||
return /^(array|vector|_float\d*|_int\d*|_text|_varchar|_bool|_uuid)/i.test(dataType.trim());
|
||||
}
|
||||
|
||||
function typeLooksPostgresTextSearchVector(dataType: string): boolean {
|
||||
const normalized = dataType
|
||||
.trim()
|
||||
.replace(/^"+|"+$/g, "")
|
||||
.toLowerCase();
|
||||
return normalized === "tsvector" || normalized.endsWith(".tsvector");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a type-appropriate placeholder value for a template column.
|
||||
* Inspects column.data_type and database type to produce the right
|
||||
|
||||
Reference in new issue
Block a user