From: | Guyren Howe <guyren(at)gmail(dot)com> |
---|---|
To: | PegoraroF10 <marcos(at)f10(dot)com(dot)br> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: single sql, multiple schemas, one result set |
Date: | 2018-04-03 18:05:55 |
Message-ID: | D01ABCC8-4DD4-401F-9D38-5B9ECE2AC1AD@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Make a view that joins all the things, with a column providing the name of the schema that they came from.
> On Apr 3, 2018, at 10:47 , PegoraroF10 <marcos(at)f10(dot)com(dot)br> wrote:
>
> Suppose a DB with dozens of schemas with same structure.
> DB
> Schema1
> Table1
> Table2
> Schema2
> Table1
> Table2
> Schema3
> Table1
> Table2
> Then we want to execute a SQL on specific schemas and the result of it could
> be a UNION ALL. So, how could be a function that runs that SQL on each
> schema and results just on result set ?
>
> Then I would use something like ...
> select * from SQLFromMultipleShema(Array['Schema1,Schema3'],'select count(*)
> from Table2');
>
>
>
>
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Sargent | 2018-04-03 18:12:11 | Re: single sql, multiple schemas, one result set |
Previous Message | PegoraroF10 | 2018-04-03 17:47:40 | single sql, multiple schemas, one result set |