Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iMHBY-0001jo-Qx for pgsql-general@arkaria.postgresql.org; Sun, 20 Oct 2019 19:48:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iMHBX-0002B9-7P for pgsql-general@arkaria.postgresql.org; Sun, 20 Oct 2019 19:48:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iMHBW-0002B2-Qu for pgsql-general@lists.postgresql.org; Sun, 20 Oct 2019 19:48:14 +0000 Received: from mail-yw1-xc44.google.com ([2607:f8b0:4864:20::c44]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iMHBP-000234-Ig for pgsql-general@lists.postgresql.org; Sun, 20 Oct 2019 19:48:13 +0000 Received: by mail-yw1-xc44.google.com with SMTP id r63so724303ywe.3 for ; Sun, 20 Oct 2019 12:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=r7jDd+Lw2d5RskPjmOw2PgiL9cShYw1iFY22p7TGNGU=; b=VuP03fQxjXK1M4+HdK3/bLzclVt1daJXm3ZEJwQl29rfWFMxqeTtUcU97Z+ZDJzl51 UsY6/RADmrxd0w3DmICmCrlA6QpqqzVy5IMkrMpX+QoVrZxIPofKrGw9wVYf+NjhK6iv d1yprFs+SoWY0Ex/KXi30Y/SRaksDUq3TZ5jQ6KBoaRtxAsojVH3SSRCBt3Ky8x+q9Ec TpAqcEzDYWoiOWkruCPUucEQyfRkVF0hNpS6p0Qr6F30tRpk2cI/lAHG++eZur4XQJ5L 9UCRjBvlTQOPK2c/pS6dr5PYd2IFrTDLlsiB4GUh0XZ63S7CoJN614vvRn0dxvYBKN7v AFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=r7jDd+Lw2d5RskPjmOw2PgiL9cShYw1iFY22p7TGNGU=; b=iRzyCMnfR+82up5BXMKUxhS1kpwCiETIzQMsK5O9m9S9Mdt9vRFa0mYKCx/wxSTPO1 UDsumh9pZLM42/q5DQUJDF/Pezu8p+FR80lkYUtf01QAPMqZeAAE5L8uiHOwSa0kUoEO 2yJo9up1EzZcXW3MS/7qLlI4Vov3KZHL/NYDCWff+81ljlD8ZzryemlBpehn6Eb0NFep 92EOdvgJm47giJx7NgPHxjtbKW9RYTGsv821y5FmsH/Otm3E5/nTvT2ZR5TnpVY4f23R zSPLF7wKNy9r6doDE+DceA662vG/EYvodAIC36LliKL8U7W6AwWl16WGIMPOOockkfGO BS+A== X-Gm-Message-State: APjAAAW4TqjDEUX1YmJfhUiWRXOcIW+t4VVIsqfdIiYUB44JtWebFIyv blc2MIIbsS7jpSNgvhtiIMSu X-Google-Smtp-Source: APXvYqzSDL5Vr2o+RbT4OMHKXKcWQP7ML2vjuX3zWMc9RU0QiktEREXI924MDBnxeDHuRELLLarpQQ== X-Received: by 2002:a81:1189:: with SMTP id 131mr2341419ywr.308.1571600886576; Sun, 20 Oct 2019 12:48:06 -0700 (PDT) Received: from [192.168.10.146] (99-10-92-30.lightspeed.rlghnc.sbcglobal.net. [99.10.92.30]) by smtp.gmail.com with ESMTPSA id a20sm3089272ywl.76.2019.10.20.12.48.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Oct 2019 12:48:06 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: jsonb_set() strictness considered harmful to data To: "David G. Johnston" Cc: Floris Van Nee , Ariadne Conill , Tomas Vondra , Mark Felder , "pgsql-generallists.postgresql.org" , PostgreSQL Hackers References: <7dc242bd-b78f-2e0d-0c38-7b4b299f11bf@2ndQuadrant.com> <20191019161851.v7dwloiiav5yrpwu@development> <20191019192723.luarxhq57qkzuncw@development> <1571560798575.47024@Optiver.com> <34a7ff88-0d86-0990-4eac-48159df8d7f2@2ndQuadrant.com> Openpgp: preference=signencrypt Autocrypt: addr=andrew.dunstan@2ndQuadrant.com; prefer-encrypt=mutual; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNL0FuZHJldyBEdW5zdGFuIDxhbmRyZXcuZHVuc3RhbkAybmRRdWFkcmFudC5jb20+wsCY BBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUJDyV6hBYhBOQ+WEYd/Hy/RGkV pZn6f8tZ/DuBBQJcH/EVAhkBAAoJEJn6f8tZ/DuB7BEH/iDWZEbVft2m2MT6SPjARzTupt/l xLLZ/Cl6n2US2hov5+fBbnR5xvECk/YCOfG9ICvKNlpFjceqNLRKStd8cmndnI+kDw91uNM2 hpL4aJMeW65XCHvqXlOLSwv5chBpXz9NG7FMaJ+q+59sWEWjcTNmjXgkEHn53y+1pc7nSLDe cr5ZI1aB3nGXRm1SoDY5PYZkUKMykW+YBZwgcs/Q5tRaE+siN7DKbz8E628+PerwAkmHPVXN MdJFD6gs4S0gDFA8IxcyIwZU2v4By+brzcJ9Se3FK5BYxBDHtaYZxgSrJAvOUOrLIZPQTQfL TtnVs3C3JTfrxCH1ceHtnA6dRuTOwE0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oK Waqf+wmW4tpDe/VVcxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7 llV0xSSoFiieQBsrGvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8 BoVrRFcdzlIY/NFNhFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C 4R+M6w7o2PLGOjdZ+kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaY L++LAEOqrlvm2TvqQqZRtnEAEQEAAcLAZQQYAQIADwIbDAUCXA6fpAUJDyV6xAAKCRCZ+n/L Wfw7geU4B/9vFFsVmWxerDWgNjyiK80zIPmlw/iwdUlU6FIu0JWLMg4093kvxBs7RMZV9hBq n3ekBvD4IvFsVLJrw9qzSI2FH3UeYy5WXpEs01Ppia60NOlvRDqXbryzuvfe+iYo6bVP3Ikr TPTNYL/BePUTD2DPvSI82SbGTyzuA7SJv6NRqqQDMIy1fU6KyQFLmQJp/QJyhKWzm9jWh8ee w8jVaoMY0Kbq5N7RqisEx1Lu/Iw646UphdYzQNymf+kbiU5Kf4I6DhzV8w9sie1Bo1juNj3I c5/fFJsmxljbnaDbXPcnFsur1Oo9mIHFakgWgOBMuxoWfjONiLjjLh/9+ZIqSSLX Message-ID: <5db07acf-bc75-edf8-60af-905c0adadb68@2ndQuadrant.com> Date: Sun, 20 Oct 2019 15:48:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-MW List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/20/19 1:14 PM, David G. Johnston wrote: > On Sun, Oct 20, 2019 at 5:31 AM Andrew Dunstan > > wrote: > > And yet another is to > raise an exception, which is easy to write but really punts the issue > back to the application programmer who will have to decide how to > ensure > they never pass in a NULL parameter. > > > That's kinda the point - if they never pass NULL they won't encounter > any problems but as soon as the data and their application don't see > eye-to-eye the application developer has to decide what they want to > do about it.  We are in no position to decide for them and making it > obvious they have a decision to make and implement here doesn't seem > like a improper position to take. The app dev can avoid this problem today by making sure they don't pass a NULL as the value. Or they can use a wrapper function which does that for them. So frankly this doesn't seem like much of an advance. And, as has been noted, it's not consistent with what either MySQL or MSSQL do. In general I'm not that keen on raising an exception for cases like this. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services