我尝试在动态SQL中调用子字符串函数。
from psycopg2 import sql as ps_sql
sql = ps_sql.SQL('select {}').format(ps_sql.Identifier("substring('TEST',1,2)"))
with db.conn_ogis.cursor() as cursor:
cursor.execute(sql)
我有错误:psycopg2.errors.UndefinedColumn:错误:列“ substring('TEST',1,2)”不存在
如何正确调用函数?