PostgreSQL before 9.1.23, 9.2.x before 9.2.18, 9.3.x before 9.3.14, 9.4.x before 9.4.9, and 9.5.x before 9.5.4 allow remote authenticated users to cause a denial of service (NULL pointer dereference and server crash), obtain sensitive memory information, or possibly execute arbitrary code via (1) a CASE expression within the test value subexpression of another CASE or (2) inlining of an SQL function that implements the equality operator used for a CASE expression involving values of different types.
https://www.postgresql.org/docs/current/static/release-9-5-4.html
https://www.postgresql.org/docs/current/static/release-9-4-9.html
https://www.postgresql.org/docs/current/static/release-9-3-14.html
https://www.postgresql.org/docs/current/static/release-9-2-18.html
https://www.postgresql.org/docs/current/static/release-9-1-23.html
https://www.postgresql.org/about/news/1688/
https://security.gentoo.org/glsa/201701-33
https://bugzilla.redhat.com/show_bug.cgi?id=1364001
https://access.redhat.com/errata/RHSA-2017:2425
http://www.securitytracker.com/id/1036617
http://www.securityfocus.com/bid/92433
http://www.debian.org/security/2016/dsa-3646
http://rhn.redhat.com/errata/RHSA-2016-2606.html
http://rhn.redhat.com/errata/RHSA-2016-1821.html