Thread: include shell commands in query

include shell commands in query

From
"Sebastian Kniat"
Date:
Hello,
is posible to include shell commands, like ping, into query?
 e.x.
select current_timestamp, "ping IP_adress" into table table_name

With best regards
Sebastian Kniat

---------------------------------------------------
Szukasz wyjazdu wakacyjnego? Sprawdź nasze oferty!
Nowy serwis w WP http://oferty.wp.pl/wakacje.html




Re: include shell commands in query

From
Bruno Wolff III
Date:
On Fri, Jun 13, 2003 at 21:56:23 +0200,
  Sebastian Kniat <sebkniat@wp.pl> wrote:
> Hello,
> is posible to include shell commands, like ping, into query?
>  e.x.
> select current_timestamp, "ping IP_adress" into table table_name

You could write a function to do this, but it probably isn't a good idea.
Usually you want something external to the database to run commands based
on information stored in the database.

Re: include shell commands in query

From
Bruce Momjian
Date:
Sebastian Kniat wrote:
> Hello,
> is posible to include shell commands, like ping, into query?
>  e.x.
> select current_timestamp, "ping IP_adress" into table table_name

You can do it in psql:

    test=> \set x '\'' `pwd` '\''
    test=> select :x;
             ?column?
    ---------------------------
     /usr/var/local/users/root
    (1 row)

See the psql manual page for more information.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: include shell commands in query

From
Dennis Gearon
Date:
Sure, it goes in like a text string. Now, if you want it to execute while in the query and NOT go into the database, I
woulddoubt that you could have that. 

Sebastian Kniat wrote:

> Hello,
> is posible to include shell commands, like ping, into query?
>  e.x.
> select current_timestamp, "ping IP_adress" into table table_name
>
> With best regards
> Sebastian Kniat
>
> ---------------------------------------------------
> Szukasz wyjazdu wakacyjnego? Sprawdź nasze oferty!
> Nowy serwis w WP http://oferty.wp.pl/wakacje.html
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>