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 1uX0Gt-004TaY-Ff for pgsql-general@arkaria.postgresql.org; Wed, 02 Jul 2025 16:25:19 +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 1uX0Gr-003nfa-JC for pgsql-general@arkaria.postgresql.org; Wed, 02 Jul 2025 16:25:18 +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 1uX0Gr-003nfR-7b for pgsql-general@lists.postgresql.org; Wed, 02 Jul 2025 16:25:17 +0000 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uX0Gq-005BVd-0W for pgsql-general@postgresql.org; Wed, 02 Jul 2025 16:25:16 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 7A51D1D001F0; Wed, 2 Jul 2025 12:25:15 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Wed, 02 Jul 2025 12:25:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1751473515; x=1751559915; bh=+2iir/UjThcZFMBmlnxLjfREK0Tq3ThgxjKH9S/N7xc=; b= Eide5ChfvIzjN6dkit8Aez1sQIdkaHvwzGYnh+ZoGrGXmzhz5azJwOVnNf0HQYs4 nHCAljZXnjlraD7f2ud4b0rNHnbYVb1XOo6mQ2GJOj3ida/U2rJAf17OI+5fWrkU efOVe7iI5VsMihg8GeeygS+BhgVvxw/cP2YW1LzulqSuup+mRQs6TYBQE2uuny9x YjKXntUkO85SlrXCylF9K41WZ4aHTY8INSAXpETL+fdaqbQQmtrDm6Q1VxgFjX5A 8WGbsCU1ZruopX5ufCIYSQmsh8s8HiCcJJi7Un1FaGgFTdn2Gp4oGU7QByl4g41U ysTWE9F76+4SPgI37bM+5g== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1751473515; x= 1751559915; bh=+2iir/UjThcZFMBmlnxLjfREK0Tq3ThgxjKH9S/N7xc=; b=A YSTgmm7K9+Taft2C3lzQqgWSTNtVBUr80OkWiKyZ/hJeZdU3lWkyW+Fo3qBrQfEx jXaeyL2EmBr5XDHJ2U/Q3Npo5BU/YgRSEsVBmm/NO1wDWNaA+AEBrFiVjHEDhnKi yIFw7715vmHDaK/WqB/p2xZSjVPb2FsRwzeoIs9XWq0LYGddixlJhnu8bcCslJiL VG0cXuRTknjkt7g9LFYzuDFsc+psX54BMk7Gxro3Y26PcXfxdtNxeRke5aiBy1mR H9Xx2NnDi8qSRvcAsCtgbNWqOM9Bce/vEPq2ikdjE92vadOYN2JeGupNJ0tZR8gO YqANxovCRxnNkLkLwp1ag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeekjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertd dtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepfeegfeeiuedtgf fgteeggfehkeejheetieeliefgteeikeejvdeiveeigfehvedtnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepughurhhumhgurghrrgesghhmrghilhdrtghomhdprhgtphhtth hopehrohhnlhhjohhhnhhsohhnjhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhg shhqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Jul 2025 12:25:14 -0400 (EDT) Message-ID: <70fdcda5-b4a8-4876-baa4-528cc80e057a@aklaver.com> Date: Wed, 2 Jul 2025 09:25:14 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: PLPGSQL - store fetched records in array of record To: Durumdara , Ron Johnson Cc: pgsql-general References: Content-Language: en-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 7/2/25 07:26, Durumdara wrote: > Sorry. > I forgot to mention that I have two arrays (records). > > One for the modifiable elements, and one for the checkable elements. > > If there is a conflict between the actual mod. item and one of the > checkable items, the checkable item will move to the end of the > modification list. > And the actual mod. item starting time could be changed in this process. > > First I imagined a temporary table, but I felt this has too much > overhead against an "in memory" array. > UPDATE, INSERT, DELETE and reopen after each modification. Assuming it is installed and you have the necessary permissions there is plpython3u. As it is Python it is looser on types. As example: CREATE OR REPLACE FUNCTION public.python_test() RETURNS void LANGUAGE plpython3u AS $function$ rec_list = [] for row in plpy.cursor("select category_fk, cell_per from cell_per where cell_per > 1"): rec_list.append({"cat": row["category_fk"], "cp": row["cell_per"]}) plpy.notice(rec_list) $function$ ; select * from python_test(); NOTICE: [{'cat': 'HERB 3.5', 'cp': 18}, {'cat': 'H PREM 3.5', 'cp': 18}, {'cat': 'HERB 2.5', 'cp': 32}, {'cat': 'H PREM 2.5', 'cp': 32}, {'cat': 'GER SC 3.5', 'cp': 18}, {'cat': 'SUCCULENTS', 'cp': 18}] python_test ------------- (1 row) > > > Ron Johnson > > ezt írta (időpont: 2025. júl. 2., Sze, 15:29): > > On Wed, Jul 2, 2025 at 8:21 AM Durumdara > wrote: > > Hello! > > I have to store some fetched records into two lists (arrays) to > work with them. > > > There's almost certainly a way to do what you need done without > using arrays.  Might require a bit of rethinking, though. > -- > Death to , and butter sauce. > Don't boil me, I'm still alive. > lobster! > -- Adrian Klaver adrian.klaver@aklaver.com