[Bucardo-general] selecting from view instead of underlying table for sync

Ali Asad Lotia ali at anobii.com
Tue May 8 15:35:55 UTC 2012

Hi All,
Apologies for the double post, I accidentally sent this question
before it was fully typed out.

I'm wondering if it is possible to select from a view instead of the
underlying table/s for a configured synced table. My environment has
views that do several subselects and casts on fields in the underlying
tables to preferred values. I'm syncing from PostgreSQL 9.1 to MongoDB
2.0.4 and since there are no views in MongoDB I don't have the luxury
of creating views in the target DB. I'm wondering if it is possible to
do a custom select as outlined in t/20-mongo.t file in the the "#Test
of customselect options" section.

A more detailed example of what I'm trying to do in case the above
summary was too handwavy.

I have a postgresql table foo with columns foo_id (serial), name
(varchar(255), created_on(timestamp), modified_on(timestamp).

I have a postgresql view named bar which is defined as SELECT foo_id AS
id, name, EXTRACT(EPOCH FROM created_on) AS creation_timestamp,
EXTRACT(EPOCH FROM modified_on) AS modification_timestamp FROM foo;

I'd like to be able to sync to a mongo collection called foo.

What I have in mind is to use a customname

More information about the Bucardo-general mailing list