Nullable unique compound index in Tarantool

2019-08-25 00:58发布

How to create unique nullable compound index in Tarantool 1.10?

I have a space of 4 columns:

| id | user_id | type | {some data} |

The pair | user_id | type | should be unique if type column is not null. user_id should never be null.

Examples:

OK:
| 1 | 1 | 1 |
| 2 | 1 | 2 |
| 3 | 2 | 1 |

OK:
| 1 | 1 |  1   |
| 2 | 1 |  2   |
| 3 | 1 | NULL |
| 4 | 1 | NULL |
| 5 | 2 |  1   |

NOT OK:
| 1 | 1 |  1   |
| 2 | 1 |  1   |
| 3 | 1 | NULL |

NOT OK:
| 1 |  1   |   1   |
| 2 | NULL | <any> |

标签: lua tarantool
0条回答
登录 后发表回答