Reputation: 544
I have the following table definition:
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
);
When I execute the following query:
DELETE FROM rule_locks
WHERE (session_id=session_id_ AND product_limit.product_code=product_code_);
I get this error from the server:
ERROR: missing FROM-clause entry for table "product_limit"
LINE 1: ...FROM rule_locks WHERE (session_id=session_id_ AND product_li...
^
session_id_
and product_code_
are pre-initialized variables of corresponding types.
How is it supposed to erase/modify a row, whose cell member variable satisfies given condition?
Upvotes: 1
Views: 888
Reputation: 61546
There should be parentheses around the field's name to access its subfields, as in:
DELETE FROM rule_locks WHERE (session_id=session_id_
AND (product_limit).product_code=product_code_);
See Accessing Composite Types in the documentation.
Upvotes: 3