Postgres

PostgreSQL 10 JSON 全文检索(译)

published on
译文版权@归原文所有. 这是对 JSON 数据的又一个很酷的补充. 现在我们可以轻松地添加 json 值的全文搜索. 一个它如何运作的快速例子: $ select id, jsonb_pretty(payload) from test; id | jsonb_pretty ----+------------------------------------------------------------------------------------------------------------- 1 | { + | "glossary": { + | "title": "example glossary", + | "GlossDiv": { + | "title": "S", + | "GlossList": { + | "GlossEntry": { + | "ID": "SGML", + | "Abbrev": "ISO 8879:1986", + | "SortAs": "SGML", + | "Acronym": "SGML", + | "GlossDef": { + | "para": "A meta-markup language, used to create markup languages such as DocBook. Read More...

Conditional expressions in Postgres

published on
A simple example from Postgres offical documents: SELECT * FROM test; a --- 1 2 3 SELECT a, CASE WHEN a=1 THEN 'one' WHEN a=2 THEN 'two' ELSE 'other' END FROM test; a | case ---+------- 1 | one 2 | two 3 | other It is based on this form: CASE WHEN condition THEN result [WHEN ...] [ELSE result] END It is very convenient in aggregation functions, just think table foo below: Read More...