diff --git a/Makefile b/Makefile index 44803f2..5b353bf 100644 --- a/Makefile +++ b/Makefile @@ -5,21 +5,6 @@ testdeps: $(TEST_SQL_FILES) $(TEST_SOURCE_FILES) testdeps: $(TESTDIR)/deps.sql $(TESTDIR)/load.sql -# -# Docs -# -ifeq (,$(ASCIIDOC)) -ASCIIDOC = $(shell which asciidoc) -endif # ASCIIDOC -ifneq (,$(ASCIIDOC)) -DOCS_built := $(DOCS:.asc=.html) $(DOCS:.adoc=.html) -DOCS += $(DOCS_built) - -install: $(DOCS_built) -%.html: %.asc - asciidoc $< -endif # ASCIIDOC - # # OTHER DEPS # diff --git a/test/deps.sql b/test/deps.sql index 93dfda4..f9c6a6b 100644 --- a/test/deps.sql +++ b/test/deps.sql @@ -2,13 +2,6 @@ -- Add any test dependency statements here --CREATE EXTENSION IF NOT EXISTS trunklet; -DO $$ BEGIN - IF current_setting('server_version_num')::int < 100000 THEN - CREATE EXTENSION IF NOT EXISTS cat_tools; - CREATE EXTENSION IF NOT EXISTS trunklet; - CREATE EXTENSION IF NOT EXISTS extension_drop; - END IF; -END$$; -- Have to reset our search_path --SET search_path = public,tap; @@ -18,11 +11,7 @@ SET client_min_messages = WARNING -- Necessary due to CASCADE AS $body$ BEGIN -- No IF NOT EXISTS because we'll be confused if we're not loading the new stuff - IF current_setting('server_version_num')::int < 100000 THEN - CREATE EXTENSION "trunklet-format" ; - ELSE - EXECUTE $exec$CREATE EXTENSION "trunklet-format" CASCADE$exec$; - END IF; + CREATE EXTENSION "trunklet-format" CASCADE; END $body$; diff --git a/test/expected/base.out b/test/expected/base.out index a077c24..d77098f 100644 --- a/test/expected/base.out +++ b/test/expected/base.out @@ -1,4 +1,12 @@ \set ECHO none +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +psql:test/load.sql:5: WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead ok 1 ok 2 diff --git a/test/expected/base_94.out b/test/expected/base_94.out deleted file mode 100644 index 7595aca..0000000 --- a/test/expected/base_94.out +++ /dev/null @@ -1,94 +0,0 @@ -\set ECHO none -ok 1 -ok 2 -ok 3 -ok 4 -ok 5 -ok 6 -ok 7 - test optional handling with s and 1.1 -ok 8 - test optional handling with s and -ok 9 - test optional handling with s and text -ok 10 - test optional handling with s and true -ok 11 - test optional handling with L and 1.1 -ok 12 - test optional handling with L and -ok 13 - test optional handling with L and text -ok 14 - test optional handling with L and true -ok 15 - threw 22004: SQL identifier format option ("I") not allowed with optional parameters -THIS ERROR IS OK! -DETAIL: parameter "test parameter" at template position 11 -ERROR: SQL identifier format option ("I") not allowed with optional parameters -DETAIL: parameter "test parameter" at template position 11 -HINT: SQL identifiers can not be NULL or empty, so identifier formats may not be optional. -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 27 at EXECUTE statement -ok 16 - threw Unexpected character "" in format specifier "" -ok 17 - threw Unexpected character "" in format specifier "O" -ok 18 - threw Unexpected character "a" in format specifier "a" -ok 19 - threw Unexpected character "a" in format specifier "Oa" -ok 20 - threw Unexpected character "S" in format specifier "S" -ok 21 - threw Unexpected character "S" in format specifier "OS" -ok 22 - threw Unexpected character "i" in format specifier "i" -ok 23 - threw Unexpected character "i" in format specifier "Oi" -ok 24 - threw Unexpected character "l" in format specifier "l" -ok 25 - threw Unexpected character "l" in format specifier "Ol" -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "S" in format specifier "OS" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 27 at EXECUTE statement -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "l" in format specifier "l" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 27 at EXECUTE statement -ok 26 - Should throw exception like 'parameter "mia" not found' -ok 27 - Should throw exception like 'parameter "mia" not found' -ok 28 - Should throw exception like 'parameter "mia" not found' -ok 29 - Should throw exception like 'parameter "mia" not found' -ok 30 - Should throw exception like 'parameter "mia" not found' -ok 31 - Should throw exception like 'parameter "mia" not found' -ok 32 - Should throw exception like 'parameter "mia" not found' -ok 33 - Should throw exception like 'parameter "mia" not found' -ok 34 - Should throw exception like 'parameter "mia" not found' -ok 35 - Should throw exception like 'parameter "mia" not found' -ok 36 - Should throw exception like 'parameter "mia" not found' -ok 37 - Should throw exception like 'parameter "mia" not found' -ok 38 - Should throw exception like 'parameter "mia" not found' -ok 39 - Should throw exception like 'parameter "mia" not found' -ok 40 - Should throw exception like 'parameter "mia" not found' -ok 41 - Should throw exception like 'parameter "mia" not found' -ok 42 - Should throw exception like 'parameter "mia" not found' -ok 43 - Should throw exception like 'parameter "mia" not found' -ok 44 - Should throw exception like 'parameter "mia" not found' -ok 45 - Should throw exception like 'parameter "mia" not found' -ok 46 - Should throw exception like 'parameter "mia" not found' -ok 47 - Should throw exception like 'parameter "mia" not found' -ok 48 - Should throw exception like 'parameter "mia" not found' -ok 49 - Should throw exception like 'parameter "mia" not found' -ok 50 - Test extract_paramaters() for single string -ok 51 - Test extract_paramaters() for number -ok 52 - Test extract_paramaters() for multiple -ok 53 - Test extract_paramaters() for num & bogus -ok 54 - Test extract_paramaters() for bogus -ok 55 - SELECT trunklet.process_language('format', 'template', ('{"value": 1.1}'::jsonb)->'value') -ok 56 - SELECT trunklet.process_language('format', 'template', ('{"value": "text"}'::jsonb)->'value') -ok 57 - SELECT trunklet.process_language('format', 'template', ('{"value": true}'::jsonb)->'value') -ok 58 - SELECT trunklet.process_language('format', 'template', ('{"value": [1, 2, 3]}'::jsonb)->'value') -ok 59 - SELECT trunklet.extract_parameters('format', ('{"value": 1.1}'::jsonb)->'value', '{a}'::text[]) -ok 60 - SELECT trunklet.extract_parameters('format', ('{"value": "text"}'::jsonb)->'value', '{a}'::text[]) -ok 61 - SELECT trunklet.extract_parameters('format', ('{"value": true}'::jsonb)->'value', '{a}'::text[]) -ok 62 - SELECT trunklet.extract_parameters('format', ('{"value": [1, 2, 3]}'::jsonb)->'value', '{a}'::text[]) -ok 63 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 64 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 65 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 66 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 67 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 68 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 69 - threw object is not supported as a parameter type -ok 70 - threw array is not supported as a parameter type -ok 71 - threw object is not supported as a parameter type -ok 72 - threw array is not supported as a parameter type -1..72 -# TRANSACTION INTENTIONALLY LEFT OPEN! diff --git a/test/expected/base_941.out b/test/expected/base_941.out deleted file mode 100644 index 2b873f3..0000000 --- a/test/expected/base_941.out +++ /dev/null @@ -1,94 +0,0 @@ -\set ECHO none -ok 1 -ok 2 -ok 3 -ok 4 -ok 5 -ok 6 -ok 7 - test optional handling with s and 1.1 -ok 8 - test optional handling with s and -ok 9 - test optional handling with s and text -ok 10 - test optional handling with s and true -ok 11 - test optional handling with L and 1.1 -ok 12 - test optional handling with L and -ok 13 - test optional handling with L and text -ok 14 - test optional handling with L and true -ok 15 - threw 22004: SQL identifier format option ("I") not allowed with optional parameters -THIS ERROR IS OK! -DETAIL: parameter "test parameter" at template position 11 -ERROR: SQL identifier format option ("I") not allowed with optional parameters -DETAIL: parameter "test parameter" at template position 11 -HINT: SQL identifiers can not be NULL or empty, so identifier formats may not be optional. -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE statement -ok 16 - threw Unexpected character "" in format specifier "" -ok 17 - threw Unexpected character "" in format specifier "O" -ok 18 - threw Unexpected character "a" in format specifier "a" -ok 19 - threw Unexpected character "a" in format specifier "Oa" -ok 20 - threw Unexpected character "S" in format specifier "S" -ok 21 - threw Unexpected character "S" in format specifier "OS" -ok 22 - threw Unexpected character "i" in format specifier "i" -ok 23 - threw Unexpected character "i" in format specifier "Oi" -ok 24 - threw Unexpected character "l" in format specifier "l" -ok 25 - threw Unexpected character "l" in format specifier "Ol" -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "S" in format specifier "OS" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE statement -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "l" in format specifier "l" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE statement -ok 26 - Should throw exception like 'parameter "mia" not found' -ok 27 - Should throw exception like 'parameter "mia" not found' -ok 28 - Should throw exception like 'parameter "mia" not found' -ok 29 - Should throw exception like 'parameter "mia" not found' -ok 30 - Should throw exception like 'parameter "mia" not found' -ok 31 - Should throw exception like 'parameter "mia" not found' -ok 32 - Should throw exception like 'parameter "mia" not found' -ok 33 - Should throw exception like 'parameter "mia" not found' -ok 34 - Should throw exception like 'parameter "mia" not found' -ok 35 - Should throw exception like 'parameter "mia" not found' -ok 36 - Should throw exception like 'parameter "mia" not found' -ok 37 - Should throw exception like 'parameter "mia" not found' -ok 38 - Should throw exception like 'parameter "mia" not found' -ok 39 - Should throw exception like 'parameter "mia" not found' -ok 40 - Should throw exception like 'parameter "mia" not found' -ok 41 - Should throw exception like 'parameter "mia" not found' -ok 42 - Should throw exception like 'parameter "mia" not found' -ok 43 - Should throw exception like 'parameter "mia" not found' -ok 44 - Should throw exception like 'parameter "mia" not found' -ok 45 - Should throw exception like 'parameter "mia" not found' -ok 46 - Should throw exception like 'parameter "mia" not found' -ok 47 - Should throw exception like 'parameter "mia" not found' -ok 48 - Should throw exception like 'parameter "mia" not found' -ok 49 - Should throw exception like 'parameter "mia" not found' -ok 50 - Test extract_paramaters() for single string -ok 51 - Test extract_paramaters() for number -ok 52 - Test extract_paramaters() for multiple -ok 53 - Test extract_paramaters() for num & bogus -ok 54 - Test extract_paramaters() for bogus -ok 55 - SELECT trunklet.process_language('format', 'template', ('{"value": 1.1}'::jsonb)->'value') -ok 56 - SELECT trunklet.process_language('format', 'template', ('{"value": "text"}'::jsonb)->'value') -ok 57 - SELECT trunklet.process_language('format', 'template', ('{"value": true}'::jsonb)->'value') -ok 58 - SELECT trunklet.process_language('format', 'template', ('{"value": [1, 2, 3]}'::jsonb)->'value') -ok 59 - SELECT trunklet.extract_parameters('format', ('{"value": 1.1}'::jsonb)->'value', '{a}'::text[]) -ok 60 - SELECT trunklet.extract_parameters('format', ('{"value": "text"}'::jsonb)->'value', '{a}'::text[]) -ok 61 - SELECT trunklet.extract_parameters('format', ('{"value": true}'::jsonb)->'value', '{a}'::text[]) -ok 62 - SELECT trunklet.extract_parameters('format', ('{"value": [1, 2, 3]}'::jsonb)->'value', '{a}'::text[]) -ok 63 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 64 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 65 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 66 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 67 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 68 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 69 - threw object is not supported as a parameter type -ok 70 - threw array is not supported as a parameter type -ok 71 - threw object is not supported as a parameter type -ok 72 - threw array is not supported as a parameter type -1..72 -# TRANSACTION INTENTIONALLY LEFT OPEN! diff --git a/test/expected/base_95.out b/test/expected/base_95.out deleted file mode 100644 index 809148d..0000000 --- a/test/expected/base_95.out +++ /dev/null @@ -1,94 +0,0 @@ -\set ECHO none -ok 1 -ok 2 -ok 3 -ok 4 -ok 5 -ok 6 -ok 7 - test optional handling with s and 1.1 -ok 8 - test optional handling with s and -ok 9 - test optional handling with s and text -ok 10 - test optional handling with s and true -ok 11 - test optional handling with L and 1.1 -ok 12 - test optional handling with L and -ok 13 - test optional handling with L and text -ok 14 - test optional handling with L and true -ok 15 - threw 22004: SQL identifier format option ("I") not allowed with optional parameters -THIS ERROR IS OK! -DETAIL: parameter "test parameter" at template position 11 -ERROR: SQL identifier format option ("I") not allowed with optional parameters -DETAIL: parameter "test parameter" at template position 11 -HINT: SQL identifiers can not be NULL or empty, so identifier formats may not be optional. -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 27 at EXECUTE -ok 16 - threw Unexpected character "" in format specifier "" -ok 17 - threw Unexpected character "" in format specifier "O" -ok 18 - threw Unexpected character "a" in format specifier "a" -ok 19 - threw Unexpected character "a" in format specifier "Oa" -ok 20 - threw Unexpected character "S" in format specifier "S" -ok 21 - threw Unexpected character "S" in format specifier "OS" -ok 22 - threw Unexpected character "i" in format specifier "i" -ok 23 - threw Unexpected character "i" in format specifier "Oi" -ok 24 - threw Unexpected character "l" in format specifier "l" -ok 25 - threw Unexpected character "l" in format specifier "Ol" -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "S" in format specifier "OS" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 27 at EXECUTE -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "l" in format specifier "l" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 27 at EXECUTE -ok 26 - Should throw exception like 'parameter "mia" not found' -ok 27 - Should throw exception like 'parameter "mia" not found' -ok 28 - Should throw exception like 'parameter "mia" not found' -ok 29 - Should throw exception like 'parameter "mia" not found' -ok 30 - Should throw exception like 'parameter "mia" not found' -ok 31 - Should throw exception like 'parameter "mia" not found' -ok 32 - Should throw exception like 'parameter "mia" not found' -ok 33 - Should throw exception like 'parameter "mia" not found' -ok 34 - Should throw exception like 'parameter "mia" not found' -ok 35 - Should throw exception like 'parameter "mia" not found' -ok 36 - Should throw exception like 'parameter "mia" not found' -ok 37 - Should throw exception like 'parameter "mia" not found' -ok 38 - Should throw exception like 'parameter "mia" not found' -ok 39 - Should throw exception like 'parameter "mia" not found' -ok 40 - Should throw exception like 'parameter "mia" not found' -ok 41 - Should throw exception like 'parameter "mia" not found' -ok 42 - Should throw exception like 'parameter "mia" not found' -ok 43 - Should throw exception like 'parameter "mia" not found' -ok 44 - Should throw exception like 'parameter "mia" not found' -ok 45 - Should throw exception like 'parameter "mia" not found' -ok 46 - Should throw exception like 'parameter "mia" not found' -ok 47 - Should throw exception like 'parameter "mia" not found' -ok 48 - Should throw exception like 'parameter "mia" not found' -ok 49 - Should throw exception like 'parameter "mia" not found' -ok 50 - Test extract_paramaters() for single string -ok 51 - Test extract_paramaters() for number -ok 52 - Test extract_paramaters() for multiple -ok 53 - Test extract_paramaters() for num & bogus -ok 54 - Test extract_paramaters() for bogus -ok 55 - SELECT trunklet.process_language('format', 'template', ('{"value": 1.1}'::jsonb)->'value') -ok 56 - SELECT trunklet.process_language('format', 'template', ('{"value": "text"}'::jsonb)->'value') -ok 57 - SELECT trunklet.process_language('format', 'template', ('{"value": true}'::jsonb)->'value') -ok 58 - SELECT trunklet.process_language('format', 'template', ('{"value": [1, 2, 3]}'::jsonb)->'value') -ok 59 - SELECT trunklet.extract_parameters('format', ('{"value": 1.1}'::jsonb)->'value', '{a}'::text[]) -ok 60 - SELECT trunklet.extract_parameters('format', ('{"value": "text"}'::jsonb)->'value', '{a}'::text[]) -ok 61 - SELECT trunklet.extract_parameters('format', ('{"value": true}'::jsonb)->'value', '{a}'::text[]) -ok 62 - SELECT trunklet.extract_parameters('format', ('{"value": [1, 2, 3]}'::jsonb)->'value', '{a}'::text[]) -ok 63 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 64 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 65 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 66 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 67 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 68 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 69 - threw object is not supported as a parameter type -ok 70 - threw array is not supported as a parameter type -ok 71 - threw object is not supported as a parameter type -ok 72 - threw array is not supported as a parameter type -1..72 -# TRANSACTION INTENTIONALLY LEFT OPEN! diff --git a/test/expected/base_951.out b/test/expected/base_951.out deleted file mode 100644 index a894538..0000000 --- a/test/expected/base_951.out +++ /dev/null @@ -1,94 +0,0 @@ -\set ECHO none -ok 1 -ok 2 -ok 3 -ok 4 -ok 5 -ok 6 -ok 7 - test optional handling with s and 1.1 -ok 8 - test optional handling with s and -ok 9 - test optional handling with s and text -ok 10 - test optional handling with s and true -ok 11 - test optional handling with L and 1.1 -ok 12 - test optional handling with L and -ok 13 - test optional handling with L and text -ok 14 - test optional handling with L and true -ok 15 - threw 22004: SQL identifier format option ("I") not allowed with optional parameters -THIS ERROR IS OK! -DETAIL: parameter "test parameter" at template position 11 -ERROR: SQL identifier format option ("I") not allowed with optional parameters -DETAIL: parameter "test parameter" at template position 11 -HINT: SQL identifiers can not be NULL or empty, so identifier formats may not be optional. -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE -ok 16 - threw Unexpected character "" in format specifier "" -ok 17 - threw Unexpected character "" in format specifier "O" -ok 18 - threw Unexpected character "a" in format specifier "a" -ok 19 - threw Unexpected character "a" in format specifier "Oa" -ok 20 - threw Unexpected character "S" in format specifier "S" -ok 21 - threw Unexpected character "S" in format specifier "OS" -ok 22 - threw Unexpected character "i" in format specifier "i" -ok 23 - threw Unexpected character "i" in format specifier "Oi" -ok 24 - threw Unexpected character "l" in format specifier "l" -ok 25 - threw Unexpected character "l" in format specifier "Ol" -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "S" in format specifier "OS" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "l" in format specifier "l" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE -ok 26 - Should throw exception like 'parameter "mia" not found' -ok 27 - Should throw exception like 'parameter "mia" not found' -ok 28 - Should throw exception like 'parameter "mia" not found' -ok 29 - Should throw exception like 'parameter "mia" not found' -ok 30 - Should throw exception like 'parameter "mia" not found' -ok 31 - Should throw exception like 'parameter "mia" not found' -ok 32 - Should throw exception like 'parameter "mia" not found' -ok 33 - Should throw exception like 'parameter "mia" not found' -ok 34 - Should throw exception like 'parameter "mia" not found' -ok 35 - Should throw exception like 'parameter "mia" not found' -ok 36 - Should throw exception like 'parameter "mia" not found' -ok 37 - Should throw exception like 'parameter "mia" not found' -ok 38 - Should throw exception like 'parameter "mia" not found' -ok 39 - Should throw exception like 'parameter "mia" not found' -ok 40 - Should throw exception like 'parameter "mia" not found' -ok 41 - Should throw exception like 'parameter "mia" not found' -ok 42 - Should throw exception like 'parameter "mia" not found' -ok 43 - Should throw exception like 'parameter "mia" not found' -ok 44 - Should throw exception like 'parameter "mia" not found' -ok 45 - Should throw exception like 'parameter "mia" not found' -ok 46 - Should throw exception like 'parameter "mia" not found' -ok 47 - Should throw exception like 'parameter "mia" not found' -ok 48 - Should throw exception like 'parameter "mia" not found' -ok 49 - Should throw exception like 'parameter "mia" not found' -ok 50 - Test extract_paramaters() for single string -ok 51 - Test extract_paramaters() for number -ok 52 - Test extract_paramaters() for multiple -ok 53 - Test extract_paramaters() for num & bogus -ok 54 - Test extract_paramaters() for bogus -ok 55 - SELECT trunklet.process_language('format', 'template', ('{"value": 1.1}'::jsonb)->'value') -ok 56 - SELECT trunklet.process_language('format', 'template', ('{"value": "text"}'::jsonb)->'value') -ok 57 - SELECT trunklet.process_language('format', 'template', ('{"value": true}'::jsonb)->'value') -ok 58 - SELECT trunklet.process_language('format', 'template', ('{"value": [1, 2, 3]}'::jsonb)->'value') -ok 59 - SELECT trunklet.extract_parameters('format', ('{"value": 1.1}'::jsonb)->'value', '{a}'::text[]) -ok 60 - SELECT trunklet.extract_parameters('format', ('{"value": "text"}'::jsonb)->'value', '{a}'::text[]) -ok 61 - SELECT trunklet.extract_parameters('format', ('{"value": true}'::jsonb)->'value', '{a}'::text[]) -ok 62 - SELECT trunklet.extract_parameters('format', ('{"value": [1, 2, 3]}'::jsonb)->'value', '{a}'::text[]) -ok 63 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 64 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 65 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 66 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 67 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 68 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 69 - threw object is not supported as a parameter type -ok 70 - threw array is not supported as a parameter type -ok 71 - threw object is not supported as a parameter type -ok 72 - threw array is not supported as a parameter type -1..72 -# TRANSACTION INTENTIONALLY LEFT OPEN! diff --git a/test/expected/base_961.out b/test/expected/base_961.out deleted file mode 100644 index 7334212..0000000 --- a/test/expected/base_961.out +++ /dev/null @@ -1,97 +0,0 @@ -\set ECHO none -ok 1 -ok 2 -ok 3 -ok 4 -ok 5 -ok 6 -ok 7 - test optional handling with s and 1.1 -ok 8 - test optional handling with s and -ok 9 - test optional handling with s and text -ok 10 - test optional handling with s and true -ok 11 - test optional handling with L and 1.1 -ok 12 - test optional handling with L and -ok 13 - test optional handling with L and text -ok 14 - test optional handling with L and true -ok 15 - threw 22004: SQL identifier format option ("I") not allowed with optional parameters -THIS ERROR IS OK! -DETAIL: parameter "test parameter" at template position 11 -ERROR: SQL identifier format option ("I") not allowed with optional parameters -DETAIL: parameter "test parameter" at template position 11 -HINT: SQL identifiers can not be NULL or empty, so identifier formats may not be optional. -CONTEXT: PL/pgSQL function _trunklet_functions.language_id_0000000001__process(text,jsonb) line 135 at RAISE -SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE -ok 16 - threw Unexpected character "" in format specifier "" -ok 17 - threw Unexpected character "" in format specifier "O" -ok 18 - threw Unexpected character "a" in format specifier "a" -ok 19 - threw Unexpected character "a" in format specifier "Oa" -ok 20 - threw Unexpected character "S" in format specifier "S" -ok 21 - threw Unexpected character "S" in format specifier "OS" -ok 22 - threw Unexpected character "i" in format specifier "i" -ok 23 - threw Unexpected character "i" in format specifier "Oi" -ok 24 - threw Unexpected character "l" in format specifier "l" -ok 25 - threw Unexpected character "l" in format specifier "Ol" -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "S" in format specifier "OS" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: PL/pgSQL function _trunklet_functions.language_id_0000000001__process(text,jsonb) line 126 at RAISE -SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE -THIS ERROR IS OK! -DETAIL: parameter "Moo" at template position 5 -ERROR: Unexpected character "l" in format specifier "l" -DETAIL: parameter "Moo" at template position 5 -CONTEXT: PL/pgSQL function _trunklet_functions.language_id_0000000001__process(text,jsonb) line 126 at RAISE -SQL statement "SELECT _trunklet_functions.language_id_0000000001__process( CAST($1 AS text), CAST($2 AS jsonb) )" -PL/pgSQL function trunklet.process_language(character varying,text,anyelement) line 44 at EXECUTE -ok 26 - Should throw exception like 'parameter "mia" not found' -ok 27 - Should throw exception like 'parameter "mia" not found' -ok 28 - Should throw exception like 'parameter "mia" not found' -ok 29 - Should throw exception like 'parameter "mia" not found' -ok 30 - Should throw exception like 'parameter "mia" not found' -ok 31 - Should throw exception like 'parameter "mia" not found' -ok 32 - Should throw exception like 'parameter "mia" not found' -ok 33 - Should throw exception like 'parameter "mia" not found' -ok 34 - Should throw exception like 'parameter "mia" not found' -ok 35 - Should throw exception like 'parameter "mia" not found' -ok 36 - Should throw exception like 'parameter "mia" not found' -ok 37 - Should throw exception like 'parameter "mia" not found' -ok 38 - Should throw exception like 'parameter "mia" not found' -ok 39 - Should throw exception like 'parameter "mia" not found' -ok 40 - Should throw exception like 'parameter "mia" not found' -ok 41 - Should throw exception like 'parameter "mia" not found' -ok 42 - Should throw exception like 'parameter "mia" not found' -ok 43 - Should throw exception like 'parameter "mia" not found' -ok 44 - Should throw exception like 'parameter "mia" not found' -ok 45 - Should throw exception like 'parameter "mia" not found' -ok 46 - Should throw exception like 'parameter "mia" not found' -ok 47 - Should throw exception like 'parameter "mia" not found' -ok 48 - Should throw exception like 'parameter "mia" not found' -ok 49 - Should throw exception like 'parameter "mia" not found' -ok 50 - Test extract_paramaters() for single string -ok 51 - Test extract_paramaters() for number -ok 52 - Test extract_paramaters() for multiple -ok 53 - Test extract_paramaters() for num & bogus -ok 54 - Test extract_paramaters() for bogus -ok 55 - SELECT trunklet.process_language('format', 'template', ('{"value": 1.1}'::jsonb)->'value') -ok 56 - SELECT trunklet.process_language('format', 'template', ('{"value": "text"}'::jsonb)->'value') -ok 57 - SELECT trunklet.process_language('format', 'template', ('{"value": true}'::jsonb)->'value') -ok 58 - SELECT trunklet.process_language('format', 'template', ('{"value": [1, 2, 3]}'::jsonb)->'value') -ok 59 - SELECT trunklet.extract_parameters('format', ('{"value": 1.1}'::jsonb)->'value', '{a}'::text[]) -ok 60 - SELECT trunklet.extract_parameters('format', ('{"value": "text"}'::jsonb)->'value', '{a}'::text[]) -ok 61 - SELECT trunklet.extract_parameters('format', ('{"value": true}'::jsonb)->'value', '{a}'::text[]) -ok 62 - SELECT trunklet.extract_parameters('format', ('{"value": [1, 2, 3]}'::jsonb)->'value', '{a}'::text[]) -ok 63 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 64 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 65 - process_language('format', 'template', %L::jsonb): parameter names may not contain "%" -ok 66 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 67 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 68 - extract_parameters('format', %L::jsonb, '{a}'::text[]): parameter names may not contain "%" -ok 69 - threw object is not supported as a parameter type -ok 70 - threw array is not supported as a parameter type -ok 71 - threw object is not supported as a parameter type -ok 72 - threw array is not supported as a parameter type -1..72 -# TRANSACTION INTENTIONALLY LEFT OPEN! diff --git a/test/expected/build.out b/test/expected/build.out index d9c8483..1efb039 100644 --- a/test/expected/build.out +++ b/test/expected/build.out @@ -1,4 +1,12 @@ \set ECHO none +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead _create --------- diff --git a/test/expected/reload.out b/test/expected/reload.out index cc997dd..fed1801 100644 --- a/test/expected/reload.out +++ b/test/expected/reload.out @@ -1,5 +1,13 @@ \set ECHO none 1..8 +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead ok 1 - Create extension ok 2 - A second extension_drop__add() call fails ok 3 - Drop extension diff --git a/test/expected/search_path.out b/test/expected/search_path.out index b8a70c0..f5f2da9 100644 --- a/test/expected/search_path.out +++ b/test/expected/search_path.out @@ -1,7 +1,23 @@ \set ECHO none 1..2 +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead ok 1 - verify search_path has not changed without cascade +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead +WARNING: function__arg_types_text() is deprecated, use routine__parse_arg_types_text instead ok 2 - verify search_path has not changed with cascade # TRANSACTION INTENTIONALLY LEFT OPEN! diff --git a/test/load.sql b/test/load.sql index 4d97909..7910163 100644 --- a/test/load.sql +++ b/test/load.sql @@ -1,6 +1,9 @@ \i test/deps.sql +\set saved_verbosity :VERBOSITY +\set VERBOSITY terse SELECT pg_temp._create(); +\set VERBOSITY :saved_verbosity -- BUG: someone is screwing up the search path... SET search_path = public, tap; diff --git a/test/sql/base.sql b/test/sql/base.sql index 9e47424..2da40a4 100644 --- a/test/sql/base.sql +++ b/test/sql/base.sql @@ -110,13 +110,14 @@ SELECT is( ), 2 ) , format( 'test optional handling with %s and %s', replace, j->>'value' ) ) - FROM unnest('{s,L}'::text[]) r(replace) - , (SELECT row_to_json(v) AS j FROM (VALUES - (to_json(1.1)) - , (to_json(NULL::int)) - , (to_json('text'::text)) - , (to_json(true)) - ) v(value) ) j + FROM ( + SELECT replace, json_build_object('value', value) AS j + FROM unnest('{s,L}'::text[]) WITH ORDINALITY r(replace, rn) + , unnest(array[to_json(1.1), to_json(NULL::int), to_json('text'::text), to_json(true)]) + WITH ORDINALITY v(value, vn) + -- Ensure consistent ordering against planner changes + ORDER BY rn, vn + ) optional_test ; SELECT throws_ok( @@ -149,8 +150,12 @@ SELECT throws_ok( , optional || specifier ) ) - FROM unnest('{"",a,S,i,l}'::text[]) s(specifier) - , unnest('{"",O}'::text[]) o(optional) + FROM ( + SELECT specifier, optional + FROM unnest('{"",a,S,i,l}'::text[]) WITH ORDINALITY s(specifier, sn) + , unnest('{"",O}'::text[]) WITH ORDINALITY o(optional, opn) + ORDER BY sn, opn + ) specifier_test ; -- This is meant to ensure the DETAIL is correct, but it doesn't work on travis :( /* @@ -177,26 +182,25 @@ SELECT throws_like( ) , 'parameter "mia" not found' ) - FROM (VALUES - ('%mia%s ') - , (' %mia%s') - , (' %mia%s ') - , ('%mia%s') - ) input( input ) - , (VALUES ('{"Moo":1}'), (NULL) - ) param( param ) - , unnest('{s,I,L}'::text[]) u(replacement) + FROM ( + SELECT input, param, replacement + FROM unnest(array['%mia%s ', ' %mia%s', ' %mia%s ', '%mia%s']) WITH ORDINALITY i(input, inn) + , unnest(array['{"Moo":1}', NULL]) WITH ORDINALITY p(param, pn) + , unnest('{s,I,L}'::text[]) WITH ORDINALITY u(replacement, un) + ORDER BY inn, pn, un + ) missing_param_test ; CREATE TEMP VIEW extract_test AS SELECT * FROM ( VALUES - ( '{s1}'::text[], '{ "s1": "string 1" }'::jsonb , 'single string'::text ) - , ( '{num}' , '{ "num": 1.1 }' , 'number' ) - , ( '{t,f,"null"}', '{ "t":true,"f":false,"null":null }' , 'multiple' ) - , ( '{num,bogus}' , '{ "num": 1.1 }' , 'num & bogus' ) - , ( '{bogus}' , NULL , 'bogus' ) - ) AS v( extract_list, expected, description ) + ( 1, '{s1}'::text[], '{ "s1": "string 1" }'::jsonb , 'single string'::text ) + , ( 2, '{num}' , '{ "num": 1.1 }' , 'number' ) + , ( 3, '{t,f,"null"}', '{ "t":true,"f":false,"null":null }' , 'multiple' ) + , ( 4, '{num,bogus}' , '{ "num": 1.1 }' , 'num & bogus' ) + , ( 5, '{bogus}' , NULL , 'bogus' ) + ) AS v( pos, extract_list, expected, description ) + ORDER BY pos ; SELECT is( @@ -232,17 +236,16 @@ SELECT throws_ok( , j ) ) - FROM - unnest(array[ - $$process_language('format', 'template', (%L::jsonb)->'value')$$ - , $$extract_parameters('format', (%L::jsonb)->'value', '{a}'::text[])$$ - ]) f(format) - , (SELECT row_to_json(v)::jsonb AS j FROM (VALUES - (to_json(1.1)) - , (to_json('text'::text)) - , (to_json(true)) - , (to_json(array[1,2,3])) - ) v(value) ) j + FROM ( + SELECT format, jsonb_build_object('value', value) AS j + FROM unnest(array[ + $$process_language('format', 'template', (%L::jsonb)->'value')$$ + , $$extract_parameters('format', (%L::jsonb)->'value', '{a}'::text[])$$ + ]) WITH ORDINALITY f(format, fn) + , unnest(array[to_json(1.1), to_json('text'::text), to_json(true), to_json(array[1,2,3])]) + WITH ORDINALITY v(value, vn) + ORDER BY fn, vn + ) non_object_test ; SELECT throws_ok( format( @@ -253,12 +256,15 @@ SELECT throws_ok( , 'parameter names may not contain "%"' , format || ': parameter names may not contain "%"' ) - FROM - unnest(array[ - $$process_language('format', 'template', %L::jsonb)$$ - , $$extract_parameters('format', %L::jsonb, '{a}'::text[])$$ - ]) f(format) - , unnest('{% key,key %,k%k}'::text[]) k(key) + FROM ( + SELECT format, key + FROM unnest(array[ + $$process_language('format', 'template', %L::jsonb)$$ + , $$extract_parameters('format', %L::jsonb, '{a}'::text[])$$ + ]) WITH ORDINALITY f(format, fn) + , unnest('{% key,key %,k%k}'::text[]) WITH ORDINALITY k(key, kn) + ORDER BY fn, kn + ) bad_key_test ; SELECT throws_ok( format( @@ -267,15 +273,15 @@ SELECT throws_ok( ) , format( '%s is not supported as a parameter type', jsonb_typeof(j->'value') ) ) - FROM - unnest(array[ - $$process_language('format', 'template', %L::jsonb)$$ - , $$extract_parameters('format', %L::jsonb, '{a}'::text[])$$ - ]) f(format) - , (SELECT row_to_json(v)::jsonb AS j FROM (VALUES - ('{"key":"value"}'::json) - , (to_json(array[1,2,3])) - ) v(value) ) j + FROM ( + SELECT format, jsonb_build_object('value', value) AS j + FROM unnest(array[ + $$process_language('format', 'template', %L::jsonb)$$ + , $$extract_parameters('format', %L::jsonb, '{a}'::text[])$$ + ]) WITH ORDINALITY f(format, fn) + , unnest(array['{"key":"value"}'::json, to_json(array[1,2,3])]) WITH ORDINALITY v(value, vn) + ORDER BY fn, vn + ) bad_type_test ; \i test/pgxntool/finish.sql diff --git a/test/sql/build.sql b/test/sql/build.sql index beb97ad..86bf8da 100644 --- a/test/sql/build.sql +++ b/test/sql/build.sql @@ -5,7 +5,10 @@ BEGIN; \i test/deps.sql -- This is just an easy way to get the dependencies pulled in on 10.0+ +\set saved_verbosity :VERBOSITY +\set VERBOSITY terse SELECT pg_temp._create(); +\set VERBOSITY :saved_verbosity DROP EXTENSION "trunklet-format"; \i sql/trunklet-format.sql diff --git a/test/sql/reload.sql b/test/sql/reload.sql index b0039c0..eb3fa0d 100644 --- a/test/sql/reload.sql +++ b/test/sql/reload.sql @@ -12,10 +12,13 @@ SELECT plan( --SET client_min_messages = WARNING; -- Necessary due to CASCADE -- Drop-reload +\set saved_verbosity :VERBOSITY +\set VERBOSITY terse SELECT lives_ok( 'SELECT pg_temp._create();' , 'Create extension' ); +\set VERBOSITY :saved_verbosity -- We assume this works, so test it... SELECT throws_ok( $throws$ @@ -34,10 +37,13 @@ SELECT lives_ok( 'DROP EXTENSION "trunklet-format";' , 'Drop extension' ); +\set saved_verbosity :VERBOSITY +\set VERBOSITY terse SELECT lives_ok( 'SELECT pg_temp._create();' , 'Create extension' ); +\set VERBOSITY :saved_verbosity SET client_min_messages = NOTICE; -- Can switch back now that we're done creating extensions -- Drop with registered template diff --git a/test/sql/search_path.sql b/test/sql/search_path.sql index ef0bcda..e7b0218 100644 --- a/test/sql/search_path.sql +++ b/test/sql/search_path.sql @@ -13,7 +13,10 @@ CREATE TEMP TABLE before AS SELECT current_setting('search_path') ; +\set saved_verbosity :VERBOSITY +\set VERBOSITY terse SELECT pg_temp._create(); +\set VERBOSITY :saved_verbosity CREATE TEMP TABLE after AS SELECT current_setting('search_path') @@ -34,7 +37,10 @@ CREATE TEMP TABLE before AS SELECT current_setting('search_path') ; +\set saved_verbosity :VERBOSITY +\set VERBOSITY terse SELECT pg_temp._create(); +\set VERBOSITY :saved_verbosity CREATE TEMP TABLE after AS SELECT current_setting('search_path')