我正在尝试在CASE表达式上创建索引,如下所示
CREATE TABLE test(i INT, j INT);
CREATE UNIQUE INDEX test_index ON test(CASE WHEN i=1 THEN j END);
收到此错误:
ERROR: syntax error at or near "CASE"
LINE 1: CREATE UNIQUE INDEX test_index ON test(CASE WHEN i=1 THEN j ...
^
********** Error **********
ERROR: syntax error at or near "CASE"
SQL state: 42601
Character: 40
我究竟做错了什么?
PostgreSQL 9.5.2