fix(postgres): strip length from fixed-size types and fix SQL library UX issues

* fix(postgre): Fix the data type syntax when creating tables in PostgreSQL

* fix(ui): Save the state when closing the SQL library through the close button
This commit is contained in:
ptma
2026-06-20 22:10:26 +08:00
committed by GitHub
parent 9d329920b9
commit 5bc168f20c
4 changed files with 58 additions and 2 deletions
+1 -1
View File
@@ -1485,7 +1485,7 @@ onUnmounted(() => {
<div v-if="showSqlLibraryPanel" :class="isClassicLayout ? 'h-full shrink-0 relative z-30 isolate bg-background' : 'h-full shrink-0 relative z-30 isolate rounded-md border border-border/80 bg-background'" :style="{ width: sqlLibraryWidth + 'px' }">
<div class="panel-resize-handle panel-resize-handle--left" @mousedown="startSqlLibraryResize" />
<div class="h-full min-h-0 overflow-hidden">
<SqlLibraryPanel @close="showSqlLibraryPanel = false" />
<SqlLibraryPanel @close="toggleSqlLibrary" />
</div>
</div>
</div>
@@ -779,6 +779,7 @@ function showDropInside(targetId: string) {
<template #default="{ onContextMenu }">
<div
class="h-full"
@contextmenu.capture="contextTarget = 'panel'"
@contextmenu.prevent="
contextTarget = 'panel';
onContextMenu($event);
@@ -794,6 +795,7 @@ function showDropInside(targetId: string) {
@mousemove="updateDropTarget($event, row.folder.id, 'folder')"
@mouseleave="clearDropTarget(row.folder.id)"
@click="toggleFolder(row.folder.id)"
@contextmenu.capture="contextTarget = row.folder"
@contextmenu.prevent="
contextTarget = row.folder;
onContextMenu($event);
@@ -829,6 +831,7 @@ function showDropInside(targetId: string) {
@mousemove="updateDropTarget($event, row.file.id, 'file')"
@mouseleave="clearDropTarget(row.file.id)"
@click="openFile(row.file)"
@contextmenu.capture="contextTarget = row.file"
@contextmenu.prevent="
contextTarget = row.file;
onContextMenu($event);
@@ -872,6 +875,7 @@ function showDropInside(targetId: string) {
@mousemove="updateDropTarget($event, file.id, 'file')"
@mouseleave="clearDropTarget(file.id)"
@click="openFile(file)"
@contextmenu.capture="contextTarget = file"
@contextmenu.prevent="
contextTarget = file;
onContextMenu($event);
@@ -13,7 +13,7 @@ const forwardedProps = useForwardProps(delegatedProps);
</script>
<template>
<DialogDescription data-slot="dialog-description" v-bind="forwardedProps" :class="cn('text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3', props.class)">
<DialogDescription data-slot="dialog-description" v-bind="forwardedProps" :style="{ wordBreak: 'break-all' }" :class="cn('text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3', props.class)">
<slot />
</DialogDescription>
</template>
@@ -374,6 +374,53 @@ export const QUESTDB_TYPE_LENGTHS: Record<string, string> = {
export const DEFAULT_TYPE_LENGTH_DISABLES: string[] = [];
export const POSTGRES_TYPE_LENGTH_DISABLES: string[] = [
"bigint",
"int8",
"bigserial",
"serial8",
"boolean",
"bool",
"box",
"bytea",
"cidr",
"circle",
"date",
"double precision",
"float",
"float8",
"inet",
"integer",
"int",
"int4",
"json",
"jsonb",
"line",
"lseg",
"macaddr",
"macaddr8",
"money",
"path",
"pg_lsn",
"pg_snapshot",
"point",
"polygon",
"real",
"float4",
"smallint",
"int2",
"smallserial",
"serial2",
"serial",
"serial4",
"text",
"tsquery",
"tsvector",
"txid_snapshot",
"uuid",
"xml",
];
export function parseExtraToColumnExtra(extra: string | null | undefined, databaseType?: DatabaseType): ColumnExtra {
const result: ColumnExtra = {};
if (!extra) return result;
@@ -610,6 +657,9 @@ export function combineDataType(baseType: string, params: string): string {
}
export function combineDataTypeForDatabase(dbType: DatabaseType | undefined, baseType: string, params: string): string {
if (isDataTypeLengthDisabled(dbType, baseType)) {
return baseType;
}
return combineDataType(baseType, normalizeDataTypeParams(dbType, baseType, params));
}
@@ -673,6 +723,8 @@ export function isDataTypeLengthDisabled(_dbType: DatabaseType | undefined, base
return key !== "geohash" && key !== "decimal";
} else if (_dbType === "manticoresearch") {
return key !== "bit" && key !== "float_vector";
} else if (_dbType === "postgres" || _dbType === "gaussdb" || _dbType === "kwdb" || _dbType === "opengauss" || _dbType === "highgo" || _dbType === "vastbase" || _dbType === "kingbase") {
return POSTGRES_TYPE_LENGTH_DISABLES.includes(key);
} else {
return DEFAULT_TYPE_LENGTH_DISABLES.includes(key);
}