我有以下表格定义:
CREATE TYPE product_limit_type AS (
product_code varchar(5),
limit_type varchar(30),
limit_value numeric(4,0)
);
CREATE TABLE rule_locks (
session_id bigint,
rule_id bigint,
product_limit product_limit_type
);
当我执行以下查询时:
DELETE FROM rule_locks
WHERE (session_id=session_id_ AND product_limit.product_code=product_code_);
我从服务器收到此错误:
ERROR: missing FROM-clause entry for table "product_limit"
LINE 1: ...FROM rule_locks WHERE (session_id=session_id_ AND product_li...
^
session_id_
和product_code_
是相应类型的预初始化变量。
如何擦除/修改其单元成员变量满足给定条件的行?
答案 0 :(得分:3)
字段名称周围应该有括号来访问其子字段,如:
DELETE FROM rule_locks WHERE (session_id=session_id_
AND (product_limit).product_code=product_code_);
请参阅文档中的Accessing Composite Types。