Aaron Neo
Aaron Neo

Reputation: 11

bucardo customcols not working

I can't get bucardo customcols to work. Any help or advice will be greatly appreciated.

I have 2 databases: - test_source - test_target

Both databases only have 1 table (partner), the columns definition is: - id: integer (Primary key) - name: character varying[20]

I issued these bucardo commands in sequence:

bucardo add db test_source dbname=test_source host=127.0.0.1 user=user pass=user port=5432
bucardo add db test_target dbname=test_target host=127.0.0.1 user=user pass=user port=5432
bucardo add all tables db=test_source herd=test_herd
bucardo add sync test_sync relgroup=test_herd dbs=test_source,test_target
bucardo add customcols public.partner "select id,name from public.partner where name = 'copy me'" db=test_source sync=test_sync

When I inserted a new row in test_source partner table:

id | name

1 | 'dont copy'

The new row gets synchronized to test_target partner table! It shouldn't be synchronized. It seems that customcols is not working as expected. Please help. Thanks.

Upvotes: 1

Views: 355

Answers (1)

Co00olCat
Co00olCat

Reputation: 1

I am directly adding records to bucardo.customcols at target server.

Adjusted for your case:

INSERT INTO bucardo.customcols (goat, clause)
    SELECT 
        id,
        'select id,name from public.partner'
    FROM bucardo.goat
    WHERE CONCAT(schemaname, '.', tablename) = 'public.partner'
    AND id NOT IN (SELECT goat FROM bucardo.customcols)

After running it, do not forget to run

bucardo reload config; bucardo restart

Upvotes: 0

Related Questions