Обсуждение: query syntax to combine 2 set returning functions ?

Поиск
Список
Период
Сортировка

query syntax to combine 2 set returning functions ?

От
Marc Mamin
Дата:
Hello,
 
I have 2 set returning functions:
 
select get_modeltablelist('foo') t
 
t
--
_emc_cubelist
_efm_modellist
_efm_sequences
 
 
select get_table_depends('cicpg_logs', '_efm_sequences') d
 
Typ  Table            Object
---  -----            -------
TR   _efm_sequences   _efm_sequences_tr
 
 
Now I want to combine both.
 
This is valid, but I can't find the syntax to get the results in multiple columns instaed of a singel 'record' column:
 
select  get_table_depends('cicpg_logs', t) FROM get_modeltablelist('efeeds') t
 
get_table_depends
-----------------
(TR,_efm_sequences,_efm_sequences_tr)
(TR,_emr_reportlist,_emr_reportlist_tr)
(TR,_efm_models,_efm_models_del_tr)
 
 
 
regards,
 
Marc Mamin
 

Re: query syntax to combine 2 set returning functions ?

От
Marc Mamin
Дата:
>  I can't find the syntax to get the results in multiple columns instaed of a singel 'record' column:
>  select  get_table_depends('cicpg_logs', t) FROM get_modeltablelist('efeeds') t

I got it:

select  (get_table_depends('cicpg_logs', t)).* FROM get_modeltablelist('efeeds') t
        ^                                  ^

Marc


From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Marc Mamin
Sent: Freitag, 1. März 2013 13:51
To: pgsql-general@postgresql.org
Subject: [GENERAL] query syntax to combine 2 set returning functions ?

Hello,
 
I have 2 set returning functions:
 
select get_modeltablelist('foo') t
 
t
--
_emc_cubelist
_efm_modellist
_efm_sequences
 
 
select get_table_depends('cicpg_logs', '_efm_sequences') d
 
Typ  Table            Object
---  -----            -------
TR   _efm_sequences   _efm_sequences_tr
 
 
Now I want to combine both.
 
This is valid, but I can't find the syntax to get the results in multiple columns instaed of a singel 'record' column:
 
select  get_table_depends('cicpg_logs', t) FROM get_modeltablelist('efeeds') t
 
get_table_depends
-----------------
(TR,_efm_sequences,_efm_sequences_tr)
(TR,_emr_reportlist,_emr_reportlist_tr)
(TR,_efm_models,_efm_models_del_tr)
 
 
 
regards,
 
Marc Mamin
 


Re: query syntax to combine 2 set returning functions ?

От
Merlin Moncure
Дата:
On Mon, Mar 4, 2013 at 1:24 AM, Marc Mamin <M.Mamin@intershop.de> wrote:
>>  I can't find the syntax to get the results in multiple columns instaed of a singel 'record' column:
>>  select  get_table_depends('cicpg_logs', t) FROM get_modeltablelist('efeeds') t
>
> I got it:
>
> select  (get_table_depends('cicpg_logs', t)).* FROM get_modeltablelist('efeeds') t
>         ^                                  ^

This is another query that get's simplified through 9.3 LATERAL.  As
you have written the query, get_table_depends will get executed once
for each column that get_table_depends returns.

merlin