From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Glenn Schultz <glenn@bondlab.io>
To: pgsql-general@postgresql.org
Subject: Re: table value function help
Date: Thu, 22 Nov 2018 08:44:47 -0800
Message-ID: <8b93663b-34c3-2c62-e9fe-87d54d9b6169@aklaver.com> (raw)
In-Reply-To: <CAE-4=KGD4fH=A0YMqYht3V6cOr4Wyd1eoH=hOtZ7TS8YCvX89g@mail.gmail.com>
References: <CAE-4=KGD4fH=A0YMqYht3V6cOr4Wyd1eoH=hOtZ7TS8YCvX89g@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, glenn@bondlab.io
Subject: Re: table value function help
In-Reply-To: <8b93663b-34c3-2c62-e9fe-87d54d9b6169@aklaver.com>
References: <CAE-4=KGD4fH=A0YMqYht3V6cOr4Wyd1eoH=hOtZ7TS8YCvX89g@mail.gmail.com> <8b93663b-34c3-2c62-e9fe-87d54d9b6169@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox