Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src-tauri/src/db/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1731,8 +1731,9 @@ pub async fn execute_sql_on_conn(

/// Hard row cap for ad-hoc SQL execution. Prevents OOM on tables with millions of rows.
const EXECUTE_SQL_MAX_ROWS: usize = 1_000_000_000;
/// Statement timeout for ad-hoc queries (milliseconds).
const EXECUTE_SQL_TIMEOUT_MS: i64 = 30_000;
/// Statement timeout for ad-hoc queries (milliseconds). Generous enough for
/// heavier scans (e.g. tables with large TOASTed JSON columns) to finish.
const EXECUTE_SQL_TIMEOUT_MS: i64 = 60_000;

async fn execute_sql_pg(
pool: &sqlx::PgPool,
Expand Down
10 changes: 6 additions & 4 deletions src/lib/components/QueryHistoryPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@
}} />

{#if visible}
<aside class="flex w-56 shrink-0 flex-col border-r border-border bg-panel">
<aside class="flex w-64 shrink-0 flex-col border-r border-border bg-panel">

<!-- Header row: segmented tabs + hide-panel toggle -->
<!-- Header row: segmented tabs + hide-panel toggle. overflow-hidden on the tab
group keeps the tabs from spilling over the editor toolbar if they ever
exceed the panel width. -->
<div class="flex h-9 shrink-0 items-center justify-between gap-1 border-b border-border pl-1 pr-1.5">
<div class="flex h-full min-w-0 items-stretch">
<div class="flex h-full min-w-0 items-stretch overflow-hidden">
{#each panelTabs as t (t.id)}
{@const Icon = t.icon}
{@const active = tab === t.id}
Expand All @@ -125,7 +127,7 @@
aria-current={active ? 'page' : undefined}
onclick={() => (tab = t.id)}
class={cn(
'group/pt relative flex h-full shrink-0 items-center gap-1.5 px-2.5 text-[11px] transition-colors',
'group/pt relative flex h-full shrink-0 items-center gap-1 px-2 text-[11px] transition-colors',
active
? 'font-medium text-foreground'
: 'font-normal text-muted-foreground/55 hover:text-foreground',
Expand Down
25 changes: 20 additions & 5 deletions src/lib/components/SqlConsole.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@
<p class="min-w-0 flex-1 font-mono text-ui-xs text-muted-foreground/70">Cannot reach database — check your connection and try again.</p>
</div>
{:else}
<!-- SQL / application error strip -->
<div class="shrink-0 border-b border-destructive/20 bg-destructive/5">
<div class="flex items-start gap-2 px-3 py-2">
<span class="mt-px shrink-0 font-mono text-ui-2xs font-bold uppercase tracking-wide text-destructive/70">error</span>
<pre class="max-h-24 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-all font-mono text-ui-xs leading-relaxed text-destructive">{error}</pre>
<!-- SQL / application error strip. Header row (label + action) sits above the
message so the text gets full width and the button never crowds it. -->
<div class="shrink-0 border-b border-destructive/20 bg-destructive/5 px-3 py-2">
<div class="flex items-center justify-between gap-2">
<span class="shrink-0 font-mono text-ui-2xs font-bold uppercase tracking-wide text-destructive/70">error</span>
{#if onfixwithai}
<button
type="button"
Expand All @@ -675,6 +675,17 @@
</button>
{/if}
</div>
<!-- overflow-wrap:anywhere wraps at word boundaries first and only breaks
inside a token when it can't fit — unlike break-all, which chopped
ordinary words mid-character ("can/celing", "sta/tement"). -->
<pre class="mt-1.5 max-h-24 overflow-y-auto whitespace-pre-wrap [overflow-wrap:anywhere] font-mono text-ui-xs leading-relaxed text-destructive">{error}</pre>
{#if /statement timeout|canceling statement due to/i.test(error)}
<p class="mt-1.5 text-ui-2xs leading-relaxed text-muted-foreground/70">
The query timed out. If this table has large JSON/text columns, select just the
columns you need instead of <code class="text-foreground/70">*</code>, or add a smaller
<code class="text-foreground/70">LIMIT</code>.
</p>
{/if}
</div>
{/if}
{/if}
Expand Down Expand Up @@ -862,6 +873,10 @@
placeholder="Query name"
onkeydown={(e) => {
if (e.key === 'Enter') void confirmSaveQuery()
// Explicit Escape close: this dialog is opened programmatically from
// Monaco (⌘S), and bits-ui's default escape-to-close doesn't fire
// reliably through that focus path in the WebKit/Tauri webview.
else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); saveDialogOpen = false }
}}
/>
</div>
Expand Down
Loading