Обсуждение: Getting show results into a table

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

Getting show results into a table

От
"Little, Douglas"
Дата:

Is there a way in sql to get the results of the show all command into a table?

 

I’m expecting  something like

Insert into Config_history as select * from (show all);

 

 

 

Doug Little

 

Sr. Data Warehouse Architect | Business Intelligence Architecture | Orbitz Worldwide

500 W. Madison, Suite 1000  Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741

Douglas.Little@orbitz.com

 cid:image001.jpg@01CABEC8.D4980670  orbitz.com | ebookers.com | hotelclub.com | cheaptickets.com | ratestogo.com | asiahotels.com

 

Вложения

Re: Getting show results into a table

От
"Kevin Grittner"
Дата:
Little, Douglas wrote:

> Is there a way in sql to get the results of the show all command into a table?
>
> I'm expecting something like
> Insert into Config_history as select * from (show all);

insert into Config_history
  select name, setting, short_desc from pg_settings;

or maybe:

create table config_history as
  select name, setting, short_desc as description from pg_settings;

-Kevin


Re: Getting show results into a table

От
Guillaume Lelarge
Дата:
On Wed, 2012-11-28 at 12:38 -0600, Little, Douglas wrote:
> Is there a way in sql to get the results of the show all command into a table?
>

SELECT name, setting, short_desc FROM pg_settings

> I'm expecting  something like
> Insert into Config_history as select * from (show all);
>

INSERT INTO config_history
  SELECT name, setting, short_desc FROM pg_settings;

That should work.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Getting show results into a table

От
"Little, Douglas"
Дата:
Thanks everybody.    Always wondered where the command was sourcing the data.

Thanks

-----Original Message-----
From: Guillaume Lelarge [mailto:guillaume@lelarge.info] 
Sent: Wednesday, November 28, 2012 3:24 PM
To: Little, Douglas
Cc: PostgreSQL General (pgsql-general@postgresql.org)
Subject: Re: [GENERAL] Getting show results into a table

On Wed, 2012-11-28 at 12:38 -0600, Little, Douglas wrote:
> Is there a way in sql to get the results of the show all command into a table?
> 

SELECT name, setting, short_desc FROM pg_settings

> I'm expecting  something like
> Insert into Config_history as select * from (show all);
> 

INSERT INTO config_history
  SELECT name, setting, short_desc FROM pg_settings;

That should work.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com