小编Sud*_*ndi的帖子

从 C++ 代码通过 PQsendQuery 执行 sql 时,Postgres SQL 解析错误 - SQLState: 42601 消息:“”处或附近的语法错误

我在 Postgres 9.5 数据库上有下表:

\d t_rstats
               Table "public.t_rstats"
  Column   |  Type   | Collation | Nullable | Default
-----------+---------+-----------+----------+---------
 eid       | bigint  |           | not null |
 timestamp | integer |           | not null |
 mids      | hstore  |           |          |
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用 libpq 库/API 的PQsendQuery从 C++ 执行以下 SQL 命令。

SELECT eid, timestamp, mids->'1144' AS m1144 FROM t_rstats
WHERE timestamp BETWEEN 1608638528 AND 1608638618
AND eid IN (3568,3600,4088,4120,4608,4640,5128,5160,5648,5680,6584)
ORDER BY eid, timestamp
Run Code Online (Sandbox Code Playgroud)

作为参考,准备上述 SQL 的 C++ 代码的一部分

std::vector<unsigned> metric_ids;
string selected_fields("SELECT …
Run Code Online (Sandbox Code Playgroud)

c++ postgresql-9.5

5
推荐指数
1
解决办法
772
查看次数

标签 统计

c++ ×1

postgresql-9.5 ×1