Search code examples
postgresqlforeign-data-wrapper

Postgres 9.3 Foreign table | Not all rows returned from external view


I have two PG databases. On the 1st I have view v_articles, on the second DB I have created foreign data table (ft_articles) which reads all entries from the foreign data source view v_articles (with foreign data wrapper). So far everything worked great, but today I noticed that no all records from the view v_articles are inside this foreign data table. Do you have any suggestions what could cause this kind of behavior. In most cases it works - during the last few months there have been just few records which were not "transferred" from view v_articles to ft_articles. Any suggestions where should I start?


Solution

  • I managed to find temporal solution to fix this problem. On the 1st server I created materialized view mv_articles, which reads everything from the standard view v_articles. On the 2nd server I read data into foreign table ft_articles all records from materialized view mv_articles rather than from v_articles. In this case I have all records in ft_articles, but that doesn't answer the question - why there was one record missing in a foreign table when reading from the standard view..