Thread: why cannot UNION both SELECT and SHOW?

why cannot UNION both SELECT and SHOW?

From
Konstantin Izmailov
Date:
Is it possible instead of executing following two statements:
  SHOW search_path; SELECT version();
to execute just one statement returning both search_path and version?

I'm using Postgres 9.0 and need the result either as two tuples or two fields...

Could you suggest how to rewrite the two statements?

Thx

Re: why cannot UNION both SELECT and SHOW?

From
Adrian Klaver
Date:
On 08/01/2011 02:07 PM, Konstantin Izmailov wrote:
> Is it possible instead of executing following two statements:
>    SHOW search_path; SELECT version();
> to execute just one statement returning both search_path and version?
>
> I'm using Postgres 9.0 and need the result either as two tuples or two
> fields...
>
> Could you suggest how to rewrite the two statements?

http://www.postgresql.org/docs/9.0/interactive/functions-info.html

production=> select current_schemas('f'),version();
      current_schemas      |
  version

--------------------------+--------------------------------------------------------------------------------------------------
  {public,utility,history} | PostgreSQL 9.0.3 on i686-pc-linux-gnu,
compiled by GCC gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 32-bit

>
> Thx


--
Adrian Klaver
adrian.klaver@gmail.com

Re: why cannot UNION both SELECT and SHOW?

From
Jerry Sievers
Date:
Konstantin Izmailov <pgfizm@gmail.com> writes:

> Is it possible instead of executing following two statements:
> ? SHOW search_path; SELECT version();
> to execute just one statement returning both search_path and version?
>
> I'm using Postgres 9.0 and need the result either as two tuples or two fields...
>
> Could you suggest how to rewrite the two statements?



foo=# select current_setting('search_path'), version();
 current_setting |                                                     version
           

-----------------+-----------------------------------------------------------------------------------------------------------------
 "$user",public  | PostgreSQL 9.0.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc (Ubuntu/Linaro 4.4.4-14ubuntu5)
4.4.5,64-bit 
(1 row)

>
> Thx
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 305.321.1144

Re: why cannot UNION both SELECT and SHOW?

From
Rodrigo Gonzalez
Date:
select current_setting('search_path') union select version();

Regards

Rodrigo

On 08/01/2011 06:07 PM, Konstantin Izmailov wrote:
> Is it possible instead of executing following two statements:
>   SHOW search_path; SELECT version();
> to execute just one statement returning both search_path and version?
>
> I'm using Postgres 9.0 and need the result either as two tuples or two
> fields...
>
> Could you suggest how to rewrite the two statements?
>
> Thx