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 1gPs65-0004Gz-3P for pgsql-general@arkaria.postgresql.org; Thu, 22 Nov 2018 16:44:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gPs63-0001sb-O5 for pgsql-general@arkaria.postgresql.org; Thu, 22 Nov 2018 16:44:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPs61-0001sU-RU for pgsql-general@lists.postgresql.org; Thu, 22 Nov 2018 16:44:55 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPs5y-0005gQ-8d for pgsql-general@postgresql.org; Thu, 22 Nov 2018 16:44:52 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 306B0226C0; Thu, 22 Nov 2018 11:44:49 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 22 Nov 2018 11:44:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=v /qEU7c7m6y6Y3Js7qkv2bMpmbOFbQZ+V/ZHBFpgN6g=; b=kLRxJGPNMMFHbbS0O fXaSQNGHpJ/rr7nhKgVoCzftY54rakpAUZuLF7Bsdh644XUBAdl+Otj8NUwPiywf XC4YvYa6DUjRqTfVerEN7DkRKB0Rbmz1xXwO7v6BYQ80xwFc7Oe66QLu9JkpGsaT mFcuqzO30OwIzp8SVdE0GrnDdj/FR48dxutqOZnAGiAgrUbsiaqBxMYd/NfXdYvd ZOqH8TBfluz2uvbP3D/aDAEhuySep7y5V6H2WpeJe2UUEu4S06uTyMpGu3qd03WD UknP6cBc6pmUBbxqPBShKF/VUKItiKTCo0el2rw7ddLEfOJ1jqgysyO5tJemHHpS NHZIQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=v/qEU7c7m6y6Y3Js7qkv2bMpmbOFbQZ+V/ZHBFpgN 6g=; b=SPEXxURXknK/DpLCqJM60ZrKWBhcZzpyRwVBii88AJJaDFcRpUU+3IMLr qlBAvwLC1gutXNiBkRWFAM2RXOL7V2hZy6Q5IjZ17YF2/zkOOul/MDwTsqTeLEOR jaET++yomzL10XWTSgKJEPjZrZxpLjDSNFaSul0e/5B+hYsJGz7pdBviRr626xub lH24Ms5B79WnFhuNLX1qnD1kRA5GWCOfHDYNBx0xQTSGvR9PRdqO1oPt0/z7TF/7 KQPwz8nUMFzPQozbWwHHXxEIFOIql+duGflb2S47/s5aguiKeDLBiX1XGavoiutA P9TYfaCmyOMmlCAOYQkCK2NpyGPtg== X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 2F018E405D; Thu, 22 Nov 2018 11:44:48 -0500 (EST) Subject: Re: table value function help To: Glenn Schultz , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: <8b93663b-34c3-2c62-e9fe-87d54d9b6169@aklaver.com> Date: Thu, 22 Nov 2018 08:44:47 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/22/18 8:25 AM, Glenn Schultz wrote: > Hello, > > I have a table value function and would like the first and second input > to take multiple arguments (array or list) I suppose.  Like the below: I cannot follow what you are trying to achieve. > > > create or replace function myfunction(sector, agency, term) > returns table (cusip char(9), sector char(12)) > language sql > stable > as $function$ > > select foo > from > atable > where > sector in (myfunction.sector) From above: 1) Where is term used? 2) Where is agency used? 3) If you are returning two fields why is there only one in the query? It might be best to outline the procedure you want to execute. As example: 1) Consume inputs of this type and layout. 2) Process inputs this way. 3) Output this. > > usage > > sectorselect('sector_1 sector_2', 'agent_1 agent_2, 120) I going to assume sectorselect = myfunction, correct? > -- Adrian Klaver adrian.klaver@aklaver.com