Nullable unique compound index in Tarantool

∥☆過路亽.° 提交于 2019-12-11 16:53:08

问题


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> |

来源:https://stackoverflow.com/questions/56737313/nullable-unique-compound-index-in-tarantool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!