Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5Czt-0002C9-Ht for pgsql-general@arkaria.postgresql.org; Wed, 05 Jan 2022 20:35:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5Czr-0006cv-JH for pgsql-general@arkaria.postgresql.org; Wed, 05 Jan 2022 20:34:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5Czp-0006cf-Jg for pgsql-general@lists.postgresql.org; Wed, 05 Jan 2022 20:34:59 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5Czm-0003yP-Fi for pgsql-general@lists.postgresql.org; Wed, 05 Jan 2022 20:34:56 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 07A223201F5A; Wed, 5 Jan 2022 15:34:51 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 05 Jan 2022 15:34:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=N yL9dp8LEiYIMrSisARy1Ailaq3sZkZ9twXneVNWYJ8=; b=AT4s7aOBA+7t0Nlzv tF+2DsL/eenIk4bNXyCaoY5hzi1xdVhEbK5xwHRDjfcLROJzg/KjRkmfidlSNm+n ++kRamgX5ehc9+ZNWgFYyKrwwGRp6Owhxxp68RMDhb/xwdCxvWCwoYcMIfdZr+BM ZeauXzio/nFiGhx0DIlTVAbi38ugZbxalp17GWUAVlP1jjUAQtZSmIpQsQv5kEeq H3UgEqrjH6c5p2YxE8J3BnNSj0GlmwKouX56obx5RUE+F88b+Ap1fdIU1XKxv7bk +BHehS7BV42LeGO+oyiiB+8Sr1qUATauXBGnNpuFsMdQGPDwVYcbGKaEvWEGB78v TbPkQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=NyL9dp8LEiYIMrSisARy1Ailaq3sZkZ9twXneVNWY J8=; b=QqfCKkbBh5sVBAvyg6aebUQVsvHiDvYRpEG6CpyLDw+RNX2mGnyePFQt2 8m+nrlnQjYjsAmgWdwhN43udrVLXY1/Rpr3M8fi9txHl+GfLlDzqfCqMbQi4LUwm vaL6px9wRnid++Jp6tVckjwo0Y1Q8XBDpENDZ2iEClMYaD0kIRH/dlFae8Dr1D34 zuENfXLXC4Xc7d6acYvIB9BIksTCmcPftnnwC4zENZwFs4+R/j3UhKtw+F9o67+B cMKOGBvdP5hTgBhEq5RzN/z5Irftfkn5jhKq9sLxv0xX4n2IrA3+Ixm+6B+iChQO y/I6FbhdIvf3yBgdtXsVJOO83f4Ug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudefjedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeekleevleefjeeiheekvdeiveeujeduueekffekgeel leegvdfggfegudduffdvvdenucffohhmrghinhepghhithhhuhgsrdgtohhmpdhpohhsth hgrhgvshhqlhdrohhrghdpjhhushhtrghthhgvohhrhidrtghomhenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Jan 2022 15:34:50 -0500 (EST) Message-ID: Date: Wed, 5 Jan 2022 12:34:50 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: How best to create and use associative array type in Postgres? Content-Language: en-US To: Shaozhong SHI , Tom Lane Cc: pgsql-general References: <41274.1641394465@sss.pgh.pa.us> <299857.1641399856@sss.pgh.pa.us> From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/5/22 12:26, Shaozhong SHI wrote: > Have a look at this one. > > GitHub - theory/kv-pair: A key/value pair data type for PostgreSQL > > > There is no documentation on how to use it. Why use it when you have: https://www.postgresql.org/docs/current/datatype-json.html Or if you want something simpler: https://www.postgresql.org/docs/current/hstore.html > > Regards, > > David > > On Wed, 5 Jan 2022 at 16:24, Tom Lane > wrote: > > Shaozhong SHI > writes: > > What do you think this attempt by using create type and create a > function? > > Managing Key/Value Pairs in PostgreSQL (justatheory.com > ) > > > > > The date alone should suggest to you that there might be > better ways to do it by now. > >                         regards, tom lane > -- Adrian Klaver adrian.klaver@aklaver.com