blob: e4f7ad979116179a7fa6d7b89c27e9d3c705cb07 [file] [log] [blame]
-- ===================================================================
-- create FDW objects
-- ===================================================================
CREATE EXTENSION pxf_fdw;
DROP ROLE IF EXISTS pxf_fdw_user;
CREATE ROLE pxf_fdw_user;
NOTICE: resource queue required -- using default resource queue "pg_default"
-- ===================================================================
-- Validation for WRAPPER options
-- ===================================================================
--
-- Foreign-data wrapper creation fails if protocol option is not provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator;
ERROR: the protocol option must be defined for PXF foreign-data wrappers
--
-- Foreign-data wrapper creation fails if protocol option is empty
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol '' );
ERROR: the protocol option must be defined for PXF foreign-data wrappers
--
-- Foreign-data wrapper creation fails if resource option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( resource '/invalid/option/for/wrapper' );
ERROR: the resource option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper creation fails if header option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', header 'TRUE' );
ERROR: invalid option "header"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if delimiter option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', delimiter ' ' );
ERROR: invalid option "delimiter"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if quote option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', quote '`' );
ERROR: invalid option "quote"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if escape option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', escape '\' );
ERROR: invalid option "escape"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if null option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', null '' );
ERROR: invalid option "null"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if encoding option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', encoding 'UTF-8' );
ERROR: invalid option "encoding"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if newline option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', newline 'CRLF' );
ERROR: invalid option "newline"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if fill_missing_fields option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', fill_missing_fields '' );
ERROR: invalid option "fill_missing_fields"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if force_null option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', force_null 'true' );
ERROR: invalid option "force_null"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if force_not_null option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', force_not_null 'true' );
ERROR: invalid option "force_not_null"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper creation fails if reject_limit option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', reject_limit '5' );
ERROR: the reject_limit option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper creation fails if reject_limit_type option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', reject_limit_type 'rows' );
ERROR: the reject_limit_type option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper creation fails if log_errors option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', log_errors 'true' );
ERROR: the log_errors option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper creation fails if config option is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', config '/foo/bar' );
ERROR: the config option can only be defined at the pg_foreign_server level
--
-- Foreign-data wrapper succeeds when protocol is provided
--
CREATE FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
HANDLER pxf_fdw_handler
VALIDATOR pxf_fdw_validator
OPTIONS ( protocol 'pxf_fdw_test', mpp_execute 'all segments' );
--
-- Foreign-data wrapper alteration fails when protocol is dropped
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( DROP protocol );
ERROR: the protocol option must be defined for PXF foreign-data wrappers
--
-- Foreign-data wrapper alteration fails if protocol option is empty
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( SET protocol '' );
ERROR: the protocol option must be defined for PXF foreign-data wrappers
--
-- Foreign-data wrapper alteration fails if resource option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD resource '/invalid/option/for/wrapper' );
ERROR: the resource option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper alteration fails if header option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD header 'TRUE' );
ERROR: invalid option "header"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if delimiter option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD delimiter ' ' );
ERROR: invalid option "delimiter"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if quote option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD quote '`' );
ERROR: invalid option "quote"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if escape option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD escape '\' );
ERROR: invalid option "escape"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if null option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD null '' );
ERROR: invalid option "null"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if encoding option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD encoding 'UTF-8' );
ERROR: invalid option "encoding"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if newline option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD newline 'CRLF' );
ERROR: invalid option "newline"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if fill_missing_fields option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD fill_missing_fields '' );
ERROR: invalid option "fill_missing_fields"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if force_null option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD force_null 'true' );
ERROR: invalid option "force_null"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if force_not_null option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD force_not_null 'true' );
ERROR: invalid option "force_not_null"
HINT: There are no valid options in this context.
--
-- Foreign-data wrapper alteration fails if reject_limit option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD reject_limit '5' );
ERROR: the reject_limit option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper alteration fails if reject_limit_type option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD reject_limit_type 'rows' );
ERROR: the reject_limit_type option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper alteration fails if log_errors option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD log_errors 'true' );
ERROR: the log_errors option can only be defined at the pg_foreign_table level
--
-- Foreign-data wrapper alteration fails if config option is added
--
ALTER FOREIGN DATA WRAPPER pxf_fdw_test_pxf_fdw
OPTIONS ( ADD config '/foo/bar' );
ERROR: the config option can only be defined at the pg_foreign_server level