Skip to content

Commit

Permalink
Fixed snapshot destroyer to drop the temp table. Allows function to b…
Browse files Browse the repository at this point in the history
…e run more than once in the same session without causing error
  • Loading branch information
keithf4 committed Apr 24, 2012
1 parent 0cadf97 commit e78f3f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -2,7 +2,7 @@ This set of functions is for creating materialized view snapshots on PostgreSQL

This was made to replace a replication system currently in place using dbi_link between an old Oracle 8i system and PostgreSQL 9.1. The Oracle setup file is only known for certain to work with 8i. If anyone else can supply setup files (or confirm this file works) for more modern versions of Oracle, that would be appreciated.

NOTE: You will have to edit setup_pg.sql to set the FDW server name and the schema where the oracle view is located for your systems. Also, the oracle setup file is using the ALL_TAB_COLUMNS system view. This only shows columns for tables that are accessible to the Oracle user you are using. If you want to be able to see all columns for all ables, you can try DBA_TAB_COLUMNS instead, but you'll need special permissions set for the Oracle user.
NOTE: You will have to edit setup_pg.sql to set the FDW server name and the schema where the oracle view is located for your systems. Also, the oracle setup file is using the ALL_TAB_COLUMNS system view. This only shows columns for tables that are accessible to the Oracle user you are using. If you want to be able to see all columns for all tables, you can try DBA_TAB_COLUMNS instead, but you'll need special permissions set for the Oracle user.

create_oracle_fdw_table('OWNER.TABLENAME') - Function for creating an FDW table. If you comment out 'EXECUTE v_insert_sql' near the bottom, this function can be used as a standalone function for easily creating FDW tables.

Expand Down
2 changes: 2 additions & 0 deletions ofdw.snapshot_destroyer.sql
Expand Up @@ -47,5 +47,7 @@ EXECUTE 'DELETE FROM ofdw.oracle_tbltranslation WHERE src_table = ' || quote_lit

EXECUTE 'DROP FOREIGN TABLE ' || v_fdw_table;

EXECUTE 'DROP TABLE IF EXISTS tmp_snapshot_destroy';

END
$_$;

0 comments on commit e78f3f2

Please sign in to comment.