From 38f96c65140f00f0b15efc495a487cfd5db510b8 Mon Sep 17 00:00:00 2001 From: daisy1754 Date: Fri, 9 Feb 2018 05:59:33 -0800 Subject: [PATCH] Add handling for empty Jsonb to fix #1649 (#1650) --- dialects/postgres/postgres.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dialects/postgres/postgres.go b/dialects/postgres/postgres.go index b8e76891..1d0dcb60 100644 --- a/dialects/postgres/postgres.go +++ b/dialects/postgres/postgres.go @@ -63,6 +63,9 @@ type Jsonb struct { // Value get value of Jsonb func (j Jsonb) Value() (driver.Value, error) { + if len(j.RawMessage) == 0 { + return nil, nil + } return j.MarshalJSON() }