From 6bde9c000ce04eacb8bb9c34ec1a253288907c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=A3=9E?= Date: Mon, 14 Oct 2024 11:39:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=90=86=E8=AE=BA=E4=B8=8A,=20=E4=B8=8B?= =?UTF-8?q?=E6=A0=87=E4=B8=8D=E4=BC=9A=E8=B6=8A=E7=95=8C=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/engines/pgsql.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/engines/pgsql.py b/sql/engines/pgsql.py index 2bae666f72..cbe9150813 100644 --- a/sql/engines/pgsql.py +++ b/sql/engines/pgsql.py @@ -213,7 +213,10 @@ def query( for row in rows: new_row = [] for idx, col_value in enumerate(row): - column_type_code = column_type_codes[idx] if idx < len(column_type_codes) else None + # 理论上, 下标不会越界的 + column_type_code = ( + column_type_codes[idx] if idx < len(column_type_codes) else None + ) # 只在列类型为 json 或 jsonb 时转换 if column_type_code in [JSON_TYPE_CODE, JSONB_TYPE_CODE]: if isinstance(col_value, (dict, list)):