[Bucardo-general] how to add/remove a table or a sequence when the schema contains a dash '-'

Sylvain MARECHAL marechal.sylvain2 at gmail.com
Sat Apr 18 10:41:55 UTC 2015


2015-04-17 20:12 GMT+02:00 David Christensen <david at endpoint.com>:

> > Is there a way to add/remove table or sequence when the schema contains
> a dash. I tried using quotation marks but I do not manage to make it work.
>
> Hi Sylvain.  I’ve pushed a commit which should fix this behavior (or you
> can just make the following change to the /usr/bin/bucardo program):
>
> ----
> diff --git a/bucardo b/bucardo
> index 39a4c76..6a3858f 100755
> --- a/bucardo
> +++ b/bucardo
> @@ -5051,7 +5051,7 @@ sub add_items_to_goat_table {
>      for my $rel (sort { $a->{name} cmp $b->{name} } @$info) {
>          # XXX Is it safe to assume UTF8 encoding here? Probably not
>          my $name = $rel->{name};
> -        if ($name !~ /^([\w ]+)\.([\w ]+)$/o) {
> +        if ($name !~ /^([-\w ]+)\.([-\w ]+)$/o) {
>              die qq{Invalid name, got "$name", but expected format
> "schema.relname"};
>          }
>          my ($schema,$table) = ($1,$2);
> ----
>
> Regards,
>
> David
> --
>
Hi David,

Thank you, it is ok for add.

For remove, I guess the same change should be done; the following code
works for me:
<<<
diff --git a/bucardo b/bucardo
index 6a3858f..d644d8a 100755
--- a/bucardo
+++ b/bucardo
@@ -3566,7 +3566,7 @@ sub remove_relation {

         ## Bucardo won't fully support a table name that starts with
"db=". Darn.
         for my $name (grep { ! /^db=/ } @nouns) {
-            if ($name =~ /^\w[\w\d]*\.\w[\w\d]*$/) {
+            if ($name =~ /^\w[-\w\d]*\.\w[-\w\d]*$/) {
                 if (! exists $GOAT->{by_fullname}{$name}) {
                     print qq{No such $reltype: $name\n};
                     next;
>>>

Regards,
Sylvain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20150418/e20688e1/attachment.html>


More information about the Bucardo-general mailing list