Re: table value function help

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Glenn Schultz <glenn(at)bondlab(dot)io>, pgsql-general(at)postgresql(dot)org
Subject: Re: table value function help
Date: 2018-11-22 16:44:47
Message-ID: 8b93663b-34c3-2c62-e9fe-87d54d9b6169@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-11-22 17:02:54 Re: table value function help
Previous Message Tom Lane 2018-11-22 16:34:09 Re: Compile postgresql libraries with VS17