title: Dump and restore of PostgreSQL database with hstore comparison in view fails
body: <p>I have a view which compares two <code>hstore</code> columns.</p>
  
  <p>When I dump and restore this database, the restore fails with the following error message:</p>
  
  <pre><code>Importing /tmp/hstore_test_2014-05-12.backup...
  pg_restore: [archiver (db)] Error while PROCESSING TOC:
  pg_restore: [archiver (db)] Error from TOC entry 172; 1259 1358132 VIEW hstore_test_view xxxx
  pg_restore: [archiver (db)] could not execute query: ERROR:  operator does not exist: public.hstore = public.hstore
  LINE 2:  SELECT NULLIF(hstore_test_table.column1, hstore_test_table....
                  ^
  HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
      Command was: CREATE VIEW hstore_test_view AS
   SELECT NULLIF(hstore_test_table.column1, hstore_test_table.column2) AS "nullif"
     FROM hst...
  pg_restore: [archiver (db)] could not execute query: ERROR:  relation "hstore_test_schema.hstore_test_view" does not exist
      Command was: ALTER TABLE hstore_test_schema.hstore_test_view OWNER TO xxxx;
  </code></pre>
  
  <p>I was able to create this error in PostgreSQL 9.3.0 with the following steps:</p>
  
  <pre><code>CREATE DATABASE hstore_test;
  
  \c hstore_test
  
  CREATE EXTENSION hstore WITH SCHEMA public;
  
  CREATE SCHEMA hstore_test_schema;
  
  CREATE TABLE hstore_test_schema.hstore_test_table(
     id int,
     column1 hstore,
     column2 hstore,
     PRIMARY KEY( id )
  );
  
  CREATE VIEW hstore_test_schema.hstore_test_view AS
  SELECT NULLIF(column1, column2) AS comparison FROM hstore_test_schema.hstore_test_table;
  </code></pre>
  
  <p>For completeness, the dump and restore process looked like this:</p>
  
  <pre><code>pg_dump -U xxxx -h localhost -f /tmp/hstore_test_2014-05-12.backup -Fc hstore_test
  psql -U xxxx -h localhost -d postgres -c "DROP DATABASE hstore_test"
  psql -U xxxx -h localhost -d postgres -c "CREATE DATABASE hstore_test"
  pg_restore -U xxxx -h localhost -d hstore_test /tmp/hstore_test_2014-05-12.backup
  </code></pre>
  
  <p><code>pg_restore -l /tmp/hstore_test_2014-05-12.backup</code> suggests that the <code>hstore</code> extension is enabled before the view is created:</p>
  
  <pre><code>;
  ; Archive created at Mon May 12 11:18:32 2014
  ;     dbname: hstore_test
  ;     TOC Entries: 15
  ;     Compression: -1
  ;     Dump Version: 1.12-0
  ;     Format: CUSTOM
  ;     Integer: 4 bytes
  ;     Offset: 8 bytes
  ;     Dumped from database version: 9.3.0
  ;     Dumped by pg_dump version: 9.3.0
  ;
  ;
  ; Selected TOC Entries:
  ;
  2074; 1262 1358002 DATABASE - hstore_test xxxx
  7; 2615 1358003 SCHEMA - hstore_test_schema xxxx
  5; 2615 2200 SCHEMA - public postgres
  2075; 0 0 COMMENT - SCHEMA public postgres
  2076; 0 0 ACL - public postgres
  173; 3079 11787 EXTENSION - plpgsql 
  2077; 0 0 COMMENT - EXTENSION plpgsql 
  174; 3079 1358004 EXTENSION - hstore 
  2078; 0 0 COMMENT - EXTENSION hstore 
  171; 1259 1358124 TABLE hstore_test_schema hstore_test_table xxxx
  172; 1259 1358132 VIEW hstore_test_schema hstore_test_view xxxx
  2069; 0 1358124 TABLE DATA hstore_test_schema hstore_test_table xxxx
  1960; 2606 1358131 CONSTRAINT hstore_test_schema hstore_test_table_pkey xxxx
  </code></pre>
  
  <p>Incidentally, replacing the <code>NULLIF(col1, col2)</code> with <code>col1 = col2</code> seems to make the error disappear, despite the fact it's an explicit comparison of the type <code>pg_restore</code> was complaining of.</p>