postgresql 将字段与值进行比较并返回布尔值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10972730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compare field with value and return bool
提问by Arman Hayots
I'm trying move hash cheking from server app to PostgreSQL. In other words I'm need calling a query to PGSQL, which compare string from query with string from field and return result of equal comparison as bool, but I don't know how do this without procedures on clear SQL.
我正在尝试将哈希检查从服务器应用程序移动到 PostgreSQL。换句话说,我需要向 PGSQL 调用一个查询,它将查询中的字符串与字段中的字符串进行比较,并将相等比较的结果返回为 bool,但我不知道如果没有清除 SQL 的过程,我该怎么做。
upd: I have table userswith field password(currently text, in the future - bytea). I want write sometihng like
upd:我有带有字段密码的表用户(当前为text,将来为bytea)。我想写点东西
select * from values ('WrittenPassword' = users.password) where username = 'someuser' ,
which must return true or false as result of equal comparison.
作为相等比较的结果,它必须返回 true 或 false。