Permalink
Browse files

New test for error conditions.

  • Loading branch information...
1 parent d759365 commit 265df734b8d31af535978acd6933c9b72b314e6f Ronan Dunklau committed Oct 5, 2012
Showing with 34 additions and 0 deletions.
  1. +19 −0 test/expected/multicorn_error_test.out
  2. +15 −0 test/sql/multicorn_error_test.sql
@@ -0,0 +1,19 @@
+CREATE EXTENSION multicorn;
+-- Test that the wrapper option is required on the server.
+CREATE server multicorn_srv foreign data wrapper multicorn;
+ERROR: The wrapper parameter is mandatory, specify a valid class name
+-- Test that the wrapper option cannot be altered on the table
+CREATE server multicorn_srv foreign data wrapper multicorn options (
+ wrapper 'multicorn.testfdw.TestForeignDataWrapper'
+);
+CREATE foreign table testmulticorn (
+ test1 character varying,
+ test2 character varying
+) server multicorn_srv options (
+ option1 'option1',
+ wrapper 'multicorn.evilwrapper.EvilDataWrapper'
+);
+ERROR: Cannot set the wrapper class on the table
+HINT: Set it on the server
+DROP EXTENSION multicorn cascade;
+NOTICE: drop cascades to server multicorn_srv
@@ -0,0 +1,15 @@
+CREATE EXTENSION multicorn;
+-- Test that the wrapper option is required on the server.
+CREATE server multicorn_srv foreign data wrapper multicorn;
+-- Test that the wrapper option cannot be altered on the table
+CREATE server multicorn_srv foreign data wrapper multicorn options (
+ wrapper 'multicorn.testfdw.TestForeignDataWrapper'
+);
+CREATE foreign table testmulticorn (
+ test1 character varying,
+ test2 character varying
+) server multicorn_srv options (
+ option1 'option1',
+ wrapper 'multicorn.evilwrapper.EvilDataWrapper'
+);
+DROP EXTENSION multicorn cascade;

0 comments on commit 265df73

Please sign in to comment.