Why would this be dangerous? You don't have any permissions you wouldn't ordinarily have. mclient runs as you, and so does any command it executes. The normal use case is to pipe the output through a pager. On 07/13/2017 02:38 PM, Brian Hood wrote:
So you can actually execute commands in mclient what are the normal use cases for this and looks dangerous.
Regards,
Brian Hood
On Wed, Jul 12, 2017 at 2:09 PM, Roberto Cornacchia
mailto:roberto.cornacchia@gmail.com> wrote: Oh dear.
I'm almost ashamed of sharing this, but here's the solution I found.
The following script could be piped to an interactive (-i) session of mclient (only meant as a trick for some benchmarking scripts):
sql>\|grep EXEC | perl -pe 's/^.*EXEC (\d+).*$/EXEC $1();/' > /tmp/myexec sql>prepare select 1; 1 tuple (1.097ms) sql>\| sql>\
Do I win any prize for the most ugly, unsafe mclient trick of the year?
Any cleaner solution is welcome ;) Roberto
On Wed, 12 Jul 2017 at 14:36 Roberto Cornacchia
mailto:roberto.cornacchia@gmail.com> wrote: Hi there,
I'm trying to script the execution of (generated) prepared queries. It does not look possible, because the identifier to use for the EXEC statement is returned dynamically by the PREPARE statement:
sql>prepare select 1; execute prepared statement using: EXEC 73(...)
This can obviously not be scripted. If I tried to parse the output of the prepare statement to retrieve the identifier, this would split PREPARE and EXEC in two different mclient sessions, losing the prepared statement.
As far as I know, there is at the moment no syntax available for providing the identifier, something like:
sql>prepare myid as select 1;
(that wouldn't be a bad idea, would it?)
Besides syntax extensions, I was wondering if there is any trick I could use at runtime with the current syntax to retrieve that identifier. Like, is it stored in some system table? Is it available as any undocumented variable? I could not find anything like that, but I might have missed it.
Cheers, Roberto
_______________________________________________ users-list mailing list users-list@monetdb.org mailto:users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- Sjoerd Mullender