如果表已经存在,我如何检入Tarantool SQL?
发布于 2019-07-16 23:04:43
只使用SQL工具就可以这样做:
SELECT EXISTS (select true from "_space" where "name" = 'table_name')例如:
tarantool> SELECT EXISTS (select true from "_space" where "name" = 'T1')
---
- metadata:
- name: EXISTS (select true from "_space" where "name" = 'T1')
type: boolean
rows:
- [true]
...
tarantool> SELECT EXISTS (select true from "_space" where "name" = 'T')
---
- metadata:
- name: EXISTS (select true from "_space" where "name" = 'T')
type: boolean
rows:
- [false]
...在Lua模式下:
tarantool> box.space.T1 ~= nil
---
- true
...
tarantool> box.space.T ~= nil
---
- false
...https://stackoverflow.com/questions/57060252
复制相似问题