小编Dev*_*evR的帖子

PostgreSQL错误:运算符不存在:name = integer

在执行简单查询时获取操作符不匹配错误.是什么导致这个?

dev_db=# `select * from registrants where user=1;`
ERROR:  operator does not exist: name = integer
LINE 1: select * from registrants where user=1;
                                            ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

表定义:

dev_db=# \d+ registrants
                              Table "public.registrants"
    Column    |           Type           |     Modifiers      | Storage  | Description
--------------+--------------------------+--------------------+----------+-------------
 user         | integer                  | not null           | plain    |
 degree       | text                     |                    | extended |
 title        | text                     |                    | …

sql postgresql

7
推荐指数
1
解决办法
3880
查看次数

将数组文字传递给PostgreSQL函数

我有一个包含select语句的Postgres函数.我需要使用包含字符串值数组的传入变量添加条件.

CREATE OR REPLACE FUNCTION get_questions(vcode text)
  RETURN return_value as $f$
DECLARE vresult return_value;

BEGIN
--snip--

SELECT id, title, code
FROM questions WHERE code NOT IN (vcode);

--snip--
Run Code Online (Sandbox Code Playgroud)

questions 表:

id ,title, code
1, "title1", "qcode1"
2, "title2", "qcode2"
3, "title3", "qcode3"
4, "title4", "qcode4"
Run Code Online (Sandbox Code Playgroud)

如何vcode在PHP中格式化文字以及条件的语法应该是什么?

使用PostgreSQL 9.1.1,PHP 5.3.6 , pg_query_params.

php sql arrays postgresql parameter-passing

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

postgresql ×2

sql ×2

arrays ×1

parameter-passing ×1

php ×1