【发布时间】:2016-02-06 14:15:18
【问题描述】:
我想使用 UUID 作为标识符,提供前 8 位数字以确定它是否存在于数据库中。
通常我可以毫无问题地做到这一点:
select * from TABLE where id = 'e99aec55-9e32-4c84-aed2-4a0251584941'::uuid
但这给了我错误:
select * from TABLE where id LIKE 'e99aec55%@'::uuid
错误:
ERROR: invalid input syntax for uuid: "e99aec55%@"
LINE 1: select * from TABLE where id LIKE 'e99aec55...
^
Query failed
PostgreSQL said: invalid input syntax for uuid: "e99aec55%@"
有没有办法在 postgresql 中查询 UUID 类型的前 n 位数字?
【问题讨论】:
标签: ruby-on-rails postgresql activerecord