From 35ff51626d243d2d4e5ec764147dd0e9d0e1f632 Mon Sep 17 00:00:00 2001 From: Seidko Date: Wed, 21 Feb 2024 19:21:55 +0800 Subject: [PATCH] fix(postgres): postgres incorrectly use escapeId from sql-utils (#73) --- packages/postgres/src/builder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/postgres/src/builder.ts b/packages/postgres/src/builder.ts index 2197283d..fe8b2395 100644 --- a/packages/postgres/src/builder.ts +++ b/packages/postgres/src/builder.ts @@ -1,9 +1,13 @@ -import { Builder, escapeId, isBracketed } from '@minatojs/sql-utils' +import { Builder, isBracketed } from '@minatojs/sql-utils' import { Dict, isNullable, Time } from 'cosmokit' import { Field, isEvalExpr, Model, randomId, Selection } from 'minato' const timeRegex = /(\d+):(\d+):(\d+)/ +export function escapeId(value: string) { + return '"' + value.replace(/"/g, '""') + '"' +} + export function formatTime(time: Date) { const year = time.getFullYear().toString() const month = Time.toDigits(time.getMonth() + 1)