Test json rpc arguments

In particular, check buggy behavior around embedded quoted JSON
and Postgres versions, compare

https://www.postgresql.org/message-id/D6921B37-BD8E-4664-8D5F-DB3525765DCD%40vllmrt.net

This adds version-bounded tests for the handling of quoted JSON,
and a pending test that documents the assumption that Postgres >=10
intends to parse quoted JSON as a string (similar to how jsonb works
now).
This commit is contained in:
Robert Vollmert
2019-06-02 01:26:52 -05:00
committed by Steve Chávez
parent 1f69822fa3
commit 30d5a81156
3 changed files with 80 additions and 4 deletions
+12 -2
View File
@@ -206,18 +206,28 @@ CREATE FUNCTION varied_arguments(
date date,
money money,
enum enum_menagerie_type,
"integer" integer default 42
"integer" integer default 42,
json json default '{}',
jsonb jsonb default '{}'
) RETURNS text
LANGUAGE sql
AS $_$
SELECT 'Hi'::text;
$_$;
COMMENT ON FUNCTION varied_arguments(double precision, character varying, boolean, date, money, enum_menagerie_type, integer) IS
COMMENT ON FUNCTION varied_arguments(double precision, character varying, boolean, date, money, enum_menagerie_type, integer, json, jsonb) IS
$_$An RPC function
Just a test for RPC function arguments$_$;
CREATE FUNCTION json_argument(arg json) RETURNS text
LANGUAGE sql
AS $_$
SELECT json_typeof(arg);
$_$;
--
-- Name: jwt_test(); Type: FUNCTION; Schema: test; Owner: -
--