Haskell SqlError,因为“创建数据库”的参数化值周围有单引号`

Haskell SqlError,因为“创建数据库”的参数化值周围有单引号`,haskell,postgresql-simple,Haskell,Postgresql Simple,我在使用“postgresql simple”库时遇到了一个SqlError,错误如下: _ <- execute con "CREATE DATABASE ?" (Only ("example" :: String)) 数据库日志为: [postgres-db-b6f75998b-5qnnx db] 2019-12-28 12:28:40.062 UTC [100] ERROR: syntax error at or near "'example'" at character 17

我在使用“postgresql simple”库时遇到了一个SqlError,错误如下:

_ <- execute con "CREATE DATABASE ?" (Only ("example" :: String))
数据库日志为:

[postgres-db-b6f75998b-5qnnx db] 2019-12-28 12:28:40.062 UTC [100] ERROR:  syntax error at or near "'example'" at character 17 
[postgres-db-b6f75998b-5qnnx db] 2019-12-28 12:28:40.062 UTC [100] STATEMENT:  CREATE DATABASE 'example' 
为什么要在值周围添加单引号

这可能是因为postgresql simple没有使用预先准备好的语句吗

与“postgresql simple”不同,该库使用预先准备好的语句, 这使得数据库每次只能解析一次SQL语句 连接


因此,我错误地假设postgresql simple将使用预先准备好的语句,因此它会在任何字符串值周围添加单引号。

我对这个库一无所知,但我希望查询中的
占位符被替换为正确的转义和引号字符串,以防止SQL注入。
[postgres-db-b6f75998b-5qnnx db] 2019-12-28 12:28:40.062 UTC [100] ERROR:  syntax error at or near "'example'" at character 17 
[postgres-db-b6f75998b-5qnnx db] 2019-12-28 12:28:40.062 UTC [100] STATEMENT:  CREATE DATABASE 'example'