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 1h3hXM-0002IL-RQ for pgsql-sql@arkaria.postgresql.org; Tue, 12 Mar 2019 13:33:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3hXK-0000kx-Lo for pgsql-sql@arkaria.postgresql.org; Tue, 12 Mar 2019 13:33:42 +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 1h3hXJ-0000cy-V8 for pgsql-sql@lists.postgresql.org; Tue, 12 Mar 2019 13:33:42 +0000 Received: from resqmta-po-09v.sys.comcast.net ([2001:558:fe16:19:96:114:154:168]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3hXF-0005VW-Pk for pgsql-sql@lists.postgresql.org; Tue, 12 Mar 2019 13:33:41 +0000 Received: from resomta-po-20v.sys.comcast.net ([96.114.154.244]) by resqmta-po-09v.sys.comcast.net with ESMTP id 3hPbhi15huXuh3hXAhTvkz; Tue, 12 Mar 2019 13:33:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1552397612; bh=yXyelSGXNgY3CSi2kYAJ3ZYMmLWs7KPMNg42BIXnSqw=; h=Received:Received:Date:From:Reply-To:To:Message-ID:Subject: MIME-Version:Content-Type; b=EfAagbVrKF0+B/28goaqV4jJPMsvgS5sGPi6JxE5B0hsZRep/4Tf+SNB9SFZXG0x8 4vGDsoch1tj2DdAx1pN4Wsf3ONWIdA23mi1Bmzy0AYObZ+uzPDSuNI1FaM6v9MEx1R QYZ1+KbN2NdKTfqFBCgFNafZX6lUCyqrWr7SwAkRgV3dVvEIwj6o1QUEKkegYqNL4l Py+i8mZJcGdEV+PbR2XON7r6zHg0Y50nfxiCFRAQdsauV6ZY4JGgOyzPHme1tlBk1C aKx/yJMcl2queERnWOCXr91cd/un2Rdje/9Y8yrV2BnM/+sFieKCKEaRzEFx+HMYEJ hzF8DexUaaNQw== Received: from oxapp-hoa-65o.email.comcast.net ([96.116.225.25]) by resomta-po-20v.sys.comcast.net with ESMTPS id 3hX9hi3PigqMm3hXAhesb0; Tue, 12 Mar 2019 13:33:32 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedutddrgeekgdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucevohhmtggrshhtqdftvghsihdpqfgfvfdppffquffrtefokffrnecuuegrihhlohhuthemuceftddtnecuogfthfevqddquegrugfkmhhpohhrthgrnhgtvgculddvtddmnegoteefjeefqddtgeculdehtddmnecujfgurhepfffhrhfvkffugggtgffrkghiofesthejsgdtredtjeenucfhrhhomhepoffkvefjtefgnfcunfetkgfnqfcuoehgihgrnhhtmhgvthhfrghnsegtohhmtggrshhtrdhnvghtqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeeliedrudduiedrvddvhedrvdehpdduheehrddujeekrddukedtrdduvdenucfrrghrrghmpehhvghlohepohigrghpphdqhhhorgdqieehohdrvghmrghilhdrtghomhgtrghsthdrnhgvthdpihhnvghtpeeliedrudduiedrvddvhedrvdehpdhmrghilhhfrhhomhepghhirghnthhmvghtfhgrnhestghomhgtrghsthdrnhgvthdprhgtphhtthhopehpghhsqhhlqdhsqhhlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-Xfinity-VMeta: sc=??;st=legit Date: Tue, 12 Mar 2019 09:33:31 -0400 (EDT) From: MICHAEL LAZLO Reply-To: MICHAEL LAZLO To: pgsql-sql@lists.postgresql.org Message-ID: <1310583700.228697.1552397611933@connect.xfinity.com> Subject: Jsonb column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Originating-Client: open-xchange-appsuite X-Originating-IP: ::ffff:155.178.180.12 X-Mailer: Open-Xchange Mailer v7.8.4-Rev38 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have a table that has a column, properties, of type jsonb. Based on documentation: https://www.postgresql.org/docs/10/functions-json.html To see all key / value pairs laid out as a table structure of columns, I can use function: jsonb_each(jsonb) which returns: "setof key text, value jsonb" Also if I want to see just the keys, I can use function: jsonb_object_keys(jsonb) which returns: "Returns set of keys in the outermost JSON object." , as per documentation. So why does my output look like this: SELECT jsonb_pretty(properties) as properties,jsonb_object_keys(properties) as keys,jsonb_each(properties) as json, properties::jsonb ? 'sendTo' as second FROM JMS_MESSAGE FETCH FIRST 1 ROWS ONLY; properties | keys | json | second -------------------------------------------------------------------------------+------+---------------+-------- { +| uri | (uri,"""/""") | t "uri": "/", +| | | "sendTo": "all", +| | | "tracon": "A80", +| | | "airport": "KATL", +| | | "msgType": "ML", +| | | "version": "4.0", +| | | "__HQ_CID": "5499f946-2ec6-11e9-916d-d566236f637b", +| | | "globalID": "41965859", +| | | "msgSeqID": "2530832", +| | | "timeline": "1550015275141 1550015275141 1550015275216", +| | | "timestamp": "2019-02-12T23:47:55.141Z", +| | | "req_method": "POST", +| | | "JMS_Solace_isXML": "true", +| | | "JMSXDeliveryCount": "1", +| | | "HQ_BRIDGE_MSG_ID_LIST": "ID:10.182.186.1188f32163b022a1ad0:16940996805",+| | | "JMS_Solace_DeliverToOne": "false", +| | | "solace_routing_dest_name": "SMES/all/ML/KATL/A80", +| | | "JMS_Solace_ElidingEligible": "false", +| | | "JMS_Solace_DeadMsgQueueEligible": "false", +| | | "Solace_JMS_Prop_IS_Reply_Message": "false" +| | | } | | | (1 row) The above jsonb_each and jsonb_object_keys both return only the first key. The boolean check if some key is in the jsonb column, (properties::jsonb ? 'sendTo'), returns true so I should see it in the returns for jsonb_each and json_object_keys. Anyone know why I am not seeing all the keys in this row column?