Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBmIl-001E5Y-Uv for pgsql-hackers@arkaria.postgresql.org; Tue, 28 May 2024 02:11:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sBmIk-008Foo-FD for pgsql-hackers@arkaria.postgresql.org; Tue, 28 May 2024 02:10:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBmIj-008Fof-JQ for pgsql-hackers@lists.postgresql.org; Tue, 28 May 2024 02:10:58 +0000 Received: from wfout6-smtp.messagingengine.com ([64.147.123.149]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBmId-002Ilr-IZ for pgsql-hackers@lists.postgresql.org; Tue, 28 May 2024 02:10:56 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.west.internal (Postfix) with ESMTP id DFD341C000AA; Mon, 27 May 2024 22:10:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 27 May 2024 22:10:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716862244; x= 1716948644; bh=4H+UB/x9KYfdw2UBt5fEoimxSTTMD/80V0HgQf0wZV0=; b=G ZYKLBvuK3HW2Qhn6Cdai960QXfO8JJUvM/ul7uzbnlALZm7PT1HjaD71sxhiuS/C do+Y7L5NC9SVC/ZsmK/6ZlpWzClUXuFwFaoAhYrcCImn57ZHW9wxHjCoa2GF1/NA 79iLfT+JE0gqA6ygi1q5nj9qZVfdpH1HGBjlNqszKhVtEEevglnDZlVVx42XTZhG GwFs8fevGfqs0T90N8+u934dAu+hXsMh9IET+mFYOF0sHRUWV6DRoYjM0K04W8xw dB880veCuWvjLR6JeenuSEG7Du4y4yHEd28A0Xhjc6Qqn0VhxNtgej0HBBttXpqH 0WwACdYN2jVOvuLaEffXg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdejhedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 May 2024 22:10:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1716816418; bh=s/MQTiBW2VnWJYY7cKZZXZGO8B+WOxsqTpvn77vnPkY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=PELujH9aTWyiurak71eTvgPJO8iqGXUxBknUNQA2I1upycz14mzlslvGgCI4X+JlV 9rVnT21lMskKBa0yDX0mEogJKsVOsZGW2/4SlPRyl4S7nPhZ2SCEp1glDDdJ/VOLIt /0jTfCQxzHx8QfUuOSdvDZvvS+lJLVuGruzcvDnWxt02jrR+56qpgPsuAhFQIsXbrd sWlyum8F9kZp+ejCwEtDiX0l/c7gKIrdfj4/t0MP8I0NF8MIpHuWXWpNHqAga2MYn5 pgfGRCWr5UB3qxwtyJRzcmDRmMaeWl0U3i7a+ac72KOit81ZSkVsmAKOEokXtk9lgj sgaYG1TrqpWgg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id E7450CD; Mon, 27 May 2024 15:26:58 +0200 (CEST) Date: Mon, 27 May 2024 15:26:58 +0200 From: Alvaro Herrera To: Amit Langote Cc: pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Add more SQL/JSON constructor functions Message-ID: <202405271326.5a5rprki64aw@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202405271313.qkl63gffldmx@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-May-27, Alvaro Herrera wrote: > > JSON_SERIALIZE() I just noticed this behavior, which looks like a bug to me: select json_serialize('{"a":1, "a":2}' returning varchar(5)); json_serialize ──────────────── {"a": I think this function should throw an error if the destination type doesn't have room for the output json. Otherwise, what good is the serialization function? -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/