From d05a478fcef065ab02f33c7428015005d261e44d Mon Sep 17 00:00:00 2001 From: Chris Harris Date: Wed, 18 Jun 2025 09:37:33 -0500 Subject: [PATCH 1/2] fix: resolve subquery in FROM must have an alias error --- src/sync/pg-connector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sync/pg-connector.ts b/src/sync/pg-connector.ts index 4613f9f..eea1b93 100644 --- a/src/sync/pg-connector.ts +++ b/src/sync/pg-connector.ts @@ -292,7 +292,7 @@ export class PostgresConnector implements DatabaseConnector { ",\n " )} from (select * from ${doubleQuote( table - )} where ctid = any($1::tid[]))`; + )} where ctid = any($1::tid[])) as samples`; const serialized = await this.sql.unsafe(query, [allCtids]); const estimate = this.tupleEstimates.get(table) ?? "?"; From f50c45b91803215e263c92d9d782b9bf948d9950 Mon Sep 17 00:00:00 2001 From: Chris Harris Date: Wed, 18 Jun 2025 09:51:52 -0500 Subject: [PATCH 2/2] fix: allow valid postgresql prefix in conn string --- src/server/sync.dto.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/server/sync.dto.ts b/src/server/sync.dto.ts index 468b24e..d2b2bbb 100644 --- a/src/server/sync.dto.ts +++ b/src/server/sync.dto.ts @@ -1,7 +1,15 @@ import { z } from "zod/v4"; export const SyncRequest = z.object({ - db: z.string().startsWith("postgres://"), + // We shouldn't be doing separate validations on both the front end and here? Should probably consolidate + db: z + .string() + .refine( + (val) => val.startsWith("postgres://") || val.startsWith("postgresql://"), + { + message: "Must start with 'postgres://' or 'postgresql://'", + } + ), seed: z.coerce.number().min(0).max(1).default(0), schema: z.coerce.string().default("public"), requiredRows: z.coerce.number().positive().default(2),