slonik_execute_script has a "-c" option to give a single command to run
on the command line, which is convenient.

I ran something like this:

slonik_execute_script -c 'ALTER TABLE a RENAME to b' set3 | slonik

This silently failed. Slonik accepted the command, but nothing happened.
The reason is there is no trailing semicolon, so slonik interpreted this
as "0 commands".

I addressed this in the script by adding a trailing semicolon if there
is not one given with the "-c" option.

However, I think "slonik" should also be updated to at least provide a
warning if it receives "0 commands" to process.

   Mark
--- slonik_execute_script.pl.orig       Thu Jan 18 14:20:15 2007
+++ slonik_execute_script.pl    Thu Jan 18 14:22:26 2007
@@ -73,6 +73,9 @@
     }
 }
 elsif ($SCRIPT_ARG) {
+    # Add a trailing semicolon if one has been omitted.
+    $SCRIPT_ARG .= ';' unless ($SCRIPT_ARG =~ m/;\s*$/);
+
     # Put the script into a file
     ($fh, $filename) = tempfile();
     print $fh $SCRIPT_ARG;
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general

Reply via email to