The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: cron logs query to handle type cast (#39704)
Han Qiao3c9d46ffdefe
diff --git a/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts b/apps/studio/components/interfaces/Settings/Logs/Logs.utils.tsindex b08cb3ce1f1..b0572f6c69c 100644--- a/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts+++ b/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts@@ -228,8 +228,7 @@ limit ${limit}return `select id, postgres_logs.timestamp, event_message, parsed.error_severity, parsed.queryfrom postgres_logs- cross join unnest(metadata) as m- cross join unnest(m.parsed) as parsed+${joins}${pgCronWhere}${orderBy}limit ${limit}@@ -293,7 +292,13 @@ export const maybeShowUpgradePrompt = (from: string | null | undefined, planId?:}export const genCountQuery = (table: LogsTableName, filters: Filters): string => {- const where = genWhereStatement(table, filters)+ let where = genWhereStatement(table, filters)+ // pg_cron logs are a subset of postgres logs+ // to calculate the chart, we need to query postgres logs+ if (table === LogsTableName.PG_CRON) {+ table = LogsTableName.POSTGRES+ where = basePgCronWhere+ }const joins = genCrossJoinUnnests(table)return `SELECT count(*) as count FROM ${table} ${joins} ${where}`}@@ -320,7 +325,7 @@ const calcChartStart = (params: Partial<LogsEndpointParams>): [Dayjs, string] =>return [its.add(-extendValue, trunc), trunc]}-const basePgCronWhere = `where ( parsed.application_name = 'pg_cron' or regexp_contains(event_message, 'cron job') )`+const basePgCronWhere = `where ( parsed.application_name = 'pg_cron' or event_message::text LIKE '%cron job%' )`/**** generates log event chart query