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 1iNF2b-0004bL-5l for pgsql-general@arkaria.postgresql.org; Wed, 23 Oct 2019 11:43:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNF2Y-00013y-4L for pgsql-general@arkaria.postgresql.org; Wed, 23 Oct 2019 11:42:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNF2X-00013r-Ly for pgsql-general@lists.postgresql.org; Wed, 23 Oct 2019 11:42:57 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNF2Q-0002Pm-9i for pgsql-general@lists.postgresql.org; Wed, 23 Oct 2019 11:42:56 +0000 Received: by mail-wr1-x444.google.com with SMTP id a11so5633941wra.6 for ; Wed, 23 Oct 2019 04:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=+/I7koCDIQRhcteoJc7MwcxGywZFdu+tsVwvY2jyx+M=; b=ZK3ZeYRUr5kLTkOyrb9oiedW8IOAM5EybM8+oqX4ElDDm3T1HyZHgbueMgOT4bc6QN 49mgFhjemmkzbXPe7mtsLMQQf+Dm43N13c5Es97wEYo51LrEDAz5bc2GYwmSo0ISDgAk KE8SH/zbQkF2Sgf/NYV1Iqkev+6q3Ql+Ffb+o79RXWbBEUPRIYTzsjgSmcrPWdKDT1Sd cm+Umd4mzL3OmAyH/+KisG/b2BHa13nCL5nnuRtPnHjwKNo0Uj/8kW/M7HsXnGgyR9mh rUhHsY33vDO5SCv7mEor8tuP6EKrz8FwktD7ZSiIVjEUVPi+65qHeFBOuIyX0CKKAQsV h9OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=+/I7koCDIQRhcteoJc7MwcxGywZFdu+tsVwvY2jyx+M=; b=MFmKMc3urE9BvTnm0oSlfH08vC8Jn3MUdgt9CWtJ3Vos0N7xcHjSGXy86FP1BzQRwD fhfkHSQFN9umL6uaEo+4V7sKdhJsh/MMpUk/slKfwyIahQ+wuMF2ha/nqNAalAl4vwrH jx8xVHE3dZ0e2nwSzGCZl8kL467a7YJE8OFGbKpbKY0YLfJWmV2TAMpgLScjdKzLM2fg B80A59RDI4mBuFWBtOJx5UHVhvfEhbIeruKEDtV8GYVNit20+8HDwfUUptK5m/KMWgu9 j+846Kn3MrHOC5jZtSakPZvya6GCuiaVwzHramPnra8yaMVRsoTTq0oLbBcZfgb4dmpe HFng== X-Gm-Message-State: APjAAAWJi6l7cB+7XmC8krQbRxKqRTTR7mi1q6sQ7MBofCni+bLg3LcW 2+276rdvFYkkzniJXosZd20m+A== X-Google-Smtp-Source: APXvYqwPm0FyDaAuvYMzKV+fc5/QdsK/Ez2TCVGzoSJO2hStwReDmP5GJsFd7i0uxGRuaHt22PNzfw== X-Received: by 2002:adf:e9c7:: with SMTP id l7mr8025603wrn.57.1571830968899; Wed, 23 Oct 2019 04:42:48 -0700 (PDT) Received: from localhost.localdomain (dyn094136009178.dyn.user.kapper.net. [94.136.9.178]) by smtp.gmail.com with ESMTPSA id c144sm5081096wmd.1.2019.10.23.04.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 04:42:48 -0700 (PDT) Message-ID: Subject: Re: jsonb_set() strictness considered harmful to data From: Laurenz Albe To: "David G. Johnston" , "Peter J. Holzer" Cc: "pgsql-generallists.postgresql.org" Date: Wed, 23 Oct 2019 13:42:47 +0200 In-Reply-To: References: <20191019161851.v7dwloiiav5yrpwu@development> <20191019192723.luarxhq57qkzuncw@development> <1571560798575.47024@Optiver.com> <34a7ff88-0d86-0990-4eac-48159df8d7f2@2ndQuadrant.com> <5db07acf-bc75-edf8-60af-905c0adadb68@2ndQuadrant.com> <20191022225513.GA12201@hjp.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David G. Johnston wrote: > Now if only the vast majority of users could have and keep this level of understanding > in mind while writing complex queries so that they remember to always add protections > to compensate for the unique design decision that SQL has taken here... You can only say that if you don't understand NULL (you wouldn't be alone). If I modify a JSON with an unknown value, the result is unknown. This seems very intuitive to me. One could argue that whoever uses SQL should understand SQL. But I believe that it is reasonable to suppose that many people who use JSON in the database are more savvy with JSON than with SQL (they might not have chosen JSON otherwise), so I agree that it makes sense to change this particular behavior. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com