diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/json.out | 29 | ||||
-rw-r--r-- | src/test/regress/expected/jsonb.out | 29 | ||||
-rw-r--r-- | src/test/regress/sql/json.sql | 6 | ||||
-rw-r--r-- | src/test/regress/sql/jsonb.sql | 6 |
4 files changed, 64 insertions, 6 deletions
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out index a68bf72b312..e9c44d3546b 100644 --- a/src/test/regress/expected/json.out +++ b/src/test/regress/expected/json.out @@ -1744,13 +1744,21 @@ SELECT rec FROM json_populate_record( -- anonymous record type SELECT json_populate_record(null::record, '{"x": 0, "y": 1}'); -ERROR: record type has not been registered +ERROR: could not determine row type for result of json_populate_record +HINT: Provide a non-null record argument, or call the function in the FROM clause using a column definition list. SELECT json_populate_record(row(1,2), '{"f1": 0, "f2": 1}'); json_populate_record ---------------------- (0,1) (1 row) +SELECT * FROM + json_populate_record(null::record, '{"x": 776}') AS (x int, y int); + x | y +-----+--- + 776 | +(1 row) + -- composite domain SELECT json_populate_record(null::j_ordered_pair, '{"x": 0, "y": 1}'); json_populate_record @@ -1834,7 +1842,8 @@ select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":[100,200,3 -- anonymous record type SELECT json_populate_recordset(null::record, '[{"x": 0, "y": 1}]'); -ERROR: record type has not been registered +ERROR: could not determine row type for result of json_populate_recordset +HINT: Provide a non-null record argument, or call the function in the FROM clause using a column definition list. SELECT json_populate_recordset(row(1,2), '[{"f1": 0, "f2": 1}]'); json_populate_recordset ------------------------- @@ -1851,9 +1860,17 @@ FROM (VALUES (1),(2)) v(i); 2 | (2,43) (4 rows) +SELECT * FROM + json_populate_recordset(null::record, '[{"x": 776}]') AS (x int, y int); + x | y +-----+--- + 776 | +(1 row) + -- empty array is a corner case SELECT json_populate_recordset(null::record, '[]'); -ERROR: record type has not been registered +ERROR: could not determine row type for result of json_populate_recordset +HINT: Provide a non-null record argument, or call the function in the FROM clause using a column definition list. SELECT json_populate_recordset(row(1,2), '[]'); json_populate_recordset ------------------------- @@ -1864,6 +1881,12 @@ SELECT * FROM json_populate_recordset(NULL::jpop,'[]') q; ---+---+--- (0 rows) +SELECT * FROM + json_populate_recordset(null::record, '[]') AS (x int, y int); + x | y +---+--- +(0 rows) + -- composite domain SELECT json_populate_recordset(null::j_ordered_pair, '[{"x": 0, "y": 1}]'); json_populate_recordset diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out index 3dfd626c410..bd6fc2e47dd 100644 --- a/src/test/regress/expected/jsonb.out +++ b/src/test/regress/expected/jsonb.out @@ -2433,13 +2433,21 @@ SELECT rec FROM jsonb_populate_record( -- anonymous record type SELECT jsonb_populate_record(null::record, '{"x": 0, "y": 1}'); -ERROR: record type has not been registered +ERROR: could not determine row type for result of jsonb_populate_record +HINT: Provide a non-null record argument, or call the function in the FROM clause using a column definition list. SELECT jsonb_populate_record(row(1,2), '{"f1": 0, "f2": 1}'); jsonb_populate_record ----------------------- (0,1) (1 row) +SELECT * FROM + jsonb_populate_record(null::record, '{"x": 776}') AS (x int, y int); + x | y +-----+--- + 776 | +(1 row) + -- composite domain SELECT jsonb_populate_record(null::jb_ordered_pair, '{"x": 0, "y": 1}'); jsonb_populate_record @@ -2516,7 +2524,8 @@ SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":[100,200 -- anonymous record type SELECT jsonb_populate_recordset(null::record, '[{"x": 0, "y": 1}]'); -ERROR: record type has not been registered +ERROR: could not determine row type for result of jsonb_populate_recordset +HINT: Provide a non-null record argument, or call the function in the FROM clause using a column definition list. SELECT jsonb_populate_recordset(row(1,2), '[{"f1": 0, "f2": 1}]'); jsonb_populate_recordset -------------------------- @@ -2533,9 +2542,17 @@ FROM (VALUES (1),(2)) v(i); 2 | (2,43) (4 rows) +SELECT * FROM + jsonb_populate_recordset(null::record, '[{"x": 776}]') AS (x int, y int); + x | y +-----+--- + 776 | +(1 row) + -- empty array is a corner case SELECT jsonb_populate_recordset(null::record, '[]'); -ERROR: record type has not been registered +ERROR: could not determine row type for result of jsonb_populate_recordset +HINT: Provide a non-null record argument, or call the function in the FROM clause using a column definition list. SELECT jsonb_populate_recordset(row(1,2), '[]'); jsonb_populate_recordset -------------------------- @@ -2546,6 +2563,12 @@ SELECT * FROM jsonb_populate_recordset(NULL::jbpop,'[]') q; ---+---+--- (0 rows) +SELECT * FROM + jsonb_populate_recordset(null::record, '[]') AS (x int, y int); + x | y +---+--- +(0 rows) + -- composite domain SELECT jsonb_populate_recordset(null::jb_ordered_pair, '[{"x": 0, "y": 1}]'); jsonb_populate_recordset diff --git a/src/test/regress/sql/json.sql b/src/test/regress/sql/json.sql index 184c5029e91..44fd7e40667 100644 --- a/src/test/regress/sql/json.sql +++ b/src/test/regress/sql/json.sql @@ -522,6 +522,8 @@ SELECT rec FROM json_populate_record( -- anonymous record type SELECT json_populate_record(null::record, '{"x": 0, "y": 1}'); SELECT json_populate_record(row(1,2), '{"f1": 0, "f2": 1}'); +SELECT * FROM + json_populate_record(null::record, '{"x": 776}') AS (x int, y int); -- composite domain SELECT json_populate_record(null::j_ordered_pair, '{"x": 0, "y": 1}'); @@ -549,11 +551,15 @@ SELECT json_populate_recordset(null::record, '[{"x": 0, "y": 1}]'); SELECT json_populate_recordset(row(1,2), '[{"f1": 0, "f2": 1}]'); SELECT i, json_populate_recordset(row(i,50), '[{"f1":"42"},{"f2":"43"}]') FROM (VALUES (1),(2)) v(i); +SELECT * FROM + json_populate_recordset(null::record, '[{"x": 776}]') AS (x int, y int); -- empty array is a corner case SELECT json_populate_recordset(null::record, '[]'); SELECT json_populate_recordset(row(1,2), '[]'); SELECT * FROM json_populate_recordset(NULL::jpop,'[]') q; +SELECT * FROM + json_populate_recordset(null::record, '[]') AS (x int, y int); -- composite domain SELECT json_populate_recordset(null::j_ordered_pair, '[{"x": 0, "y": 1}]'); diff --git a/src/test/regress/sql/jsonb.sql b/src/test/regress/sql/jsonb.sql index 227f1fcd27e..a1831adf33d 100644 --- a/src/test/regress/sql/jsonb.sql +++ b/src/test/regress/sql/jsonb.sql @@ -642,6 +642,8 @@ SELECT rec FROM jsonb_populate_record( -- anonymous record type SELECT jsonb_populate_record(null::record, '{"x": 0, "y": 1}'); SELECT jsonb_populate_record(row(1,2), '{"f1": 0, "f2": 1}'); +SELECT * FROM + jsonb_populate_record(null::record, '{"x": 776}') AS (x int, y int); -- composite domain SELECT jsonb_populate_record(null::jb_ordered_pair, '{"x": 0, "y": 1}'); @@ -665,11 +667,15 @@ SELECT jsonb_populate_recordset(null::record, '[{"x": 0, "y": 1}]'); SELECT jsonb_populate_recordset(row(1,2), '[{"f1": 0, "f2": 1}]'); SELECT i, jsonb_populate_recordset(row(i,50), '[{"f1":"42"},{"f2":"43"}]') FROM (VALUES (1),(2)) v(i); +SELECT * FROM + jsonb_populate_recordset(null::record, '[{"x": 776}]') AS (x int, y int); -- empty array is a corner case SELECT jsonb_populate_recordset(null::record, '[]'); SELECT jsonb_populate_recordset(row(1,2), '[]'); SELECT * FROM jsonb_populate_recordset(NULL::jbpop,'[]') q; +SELECT * FROM + jsonb_populate_recordset(null::record, '[]') AS (x int, y int); -- composite domain SELECT jsonb_populate_recordset(null::jb_ordered_pair, '[{"x": 0, "y": 1}]'); |