I use PostgreSQL and try to add the index below:
CREATE UNIQUE INDEX product_type_serial_pin_unique
ON servicestore.product_unit(serial)
WHERE serial is not null AND product_id = (SELECT id FROM servicestore.product WHERE product_type = 'SERIAL_PIN');
I got the following error:
ERROR: cannot use subquery in index predicate
how can I solve this problem?