Skip to content

Commit 94b435c

Browse files
author
X
committed
Fix code generation error in PostgreSQL
1 parent cbd8723 commit 94b435c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backend/plugin/code_generator/crud/crud_code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async def get_all_tables(db: AsyncSession, table_schema: str) -> Sequence[RowMap
2727
WHERE table_name NOT LIKE 'sys_gen_%'
2828
AND table_schema = :table_schema;
2929
"""
30+
stmt = text(sql).bindparams(table_schema=table_schema)
3031
else:
3132
sql = """
3233
SELECT c.relname AS table_name, obj_description(c.oid) AS table_comment
@@ -36,7 +37,7 @@ async def get_all_tables(db: AsyncSession, table_schema: str) -> Sequence[RowMap
3637
AND n.nspname = 'public' -- schema 通常是 'public'
3738
AND c.relname NOT LIKE 'sys_gen_%';
3839
"""
39-
stmt = text(sql).bindparams(table_schema=table_schema)
40+
stmt = text(sql)
4041
result = await db.execute(stmt)
4142
return result.mappings().all()
4243

@@ -63,6 +64,7 @@ async def get_table(db: AsyncSession, table_name: str) -> Row[tuple]:
6364
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
6465
WHERE c.relkind = 'r'
6566
AND n.nspname = 'public' -- schema 通常是 'public'
67+
AND c.relname = :table_name
6668
AND c.relname NOT LIKE 'sys_gen_%';
6769
"""
6870
stmt = text(sql).bindparams(table_name=table_name)

0 commit comments

Comments
 (0)