Skip to content
Browse files

Removed multi-array functions as never-worked

  • Loading branch information...
1 parent b3e5e5e commit e68df644c085b3b2c0f0745c0d255f1917406a6d @theirix committed
Showing with 0 additions and 48 deletions.
  1. +0 −20 doc/json_accessors.md
  2. +0 −6 sql/json_accessors.sql
  3. +0 −16 src/json_accessors.c
  4. +0 −3 test/expected/regress.out
  5. +0 −3 test/sql/regress.sql
View
20 doc/json_accessors.md
@@ -115,16 +115,6 @@ Example:
select json_array_to_object_array('[{"foo":42}, {"bar":[]}]') = array['{"foo":42}','{"bar":[]}']
-#### json_array_to_multi_array(text) -> text[]
-
-_Experimental_
-
-Converts a JSON array of any depth (single or multidimensional) to a PG multidimensional array. Original JSON must contains only arrays, objects are not allowed.
-
-Example:
-
- select json_array_to_multi_array('[["foo", "bar"], []]') = array[['foo','bar'], []];
-
#### json_array_to_text_array(text) -> text[]
Converts a JSON array of text objects to PG array `text[]`.
@@ -169,16 +159,6 @@ Example:
select json_get_object_array('{"key" : [{"foo":42}, {"bar":[]}]}', 'key') = array['{"foo":42}','{"bar":[]}'];
-#### json_get_multi_array(text, text) -> text[]
-
-_Experimental_
-
-Extract and converts a JSON array of JSON arrays to PG array of text arrays `text[]`.
-
-Example:
-
- select json_get_multi_array('{"key" : [["foo", "bar"], []] }', 'key') = array[['foo','bar'], []];
-
#### json_get_text_array(text, text) -> text[]
Extract and converts a JSON array of text objects to PG array `text[]`.
View
6 sql/json_accessors.sql
@@ -34,9 +34,6 @@ create or replace function json_get_timestamp(text, text) returns timestamp with
create or replace function json_array_to_object_array(text) returns text[]
as 'MODULE_PATHNAME' language C immutable strict;
-create or replace function json_array_to_multi_array(text) returns text[]
- as 'MODULE_PATHNAME' language C immutable strict;
-
create or replace function json_array_to_text_array(text) returns text[]
as 'MODULE_PATHNAME' language C immutable strict;
@@ -60,9 +57,6 @@ create or replace function json_array_to_timestamp_array(text) returns timestamp
create or replace function json_get_object_array(text, text) returns text[]
as 'MODULE_PATHNAME' language C immutable strict;
-create or replace function json_get_multi_array(text, text) returns text[]
- as 'MODULE_PATHNAME' language C immutable strict;
-
create or replace function json_get_text_array(text, text) returns text[]
as 'MODULE_PATHNAME' language C immutable strict;
View
16 src/json_accessors.c
@@ -85,7 +85,6 @@ Datum json_get_numeric(PG_FUNCTION_ARGS);
Datum json_get_timestamp(PG_FUNCTION_ARGS);
Datum json_array_to_object_array(PG_FUNCTION_ARGS);
-Datum json_array_to_multi_array(PG_FUNCTION_ARGS);
Datum json_array_to_text_array(PG_FUNCTION_ARGS);
Datum json_array_to_boolean_array(PG_FUNCTION_ARGS);
Datum json_array_to_int_array(PG_FUNCTION_ARGS);
@@ -94,7 +93,6 @@ Datum json_array_to_numeric_array(PG_FUNCTION_ARGS);
Datum json_array_to_timestamp_array(PG_FUNCTION_ARGS);
Datum json_get_object_array(PG_FUNCTION_ARGS);
-Datum json_get_multi_array(PG_FUNCTION_ARGS);
Datum json_get_text_array(PG_FUNCTION_ARGS);
Datum json_get_boolean_array(PG_FUNCTION_ARGS);
Datum json_get_int_array(PG_FUNCTION_ARGS);
@@ -116,7 +114,6 @@ PG_FUNCTION_INFO_V1(json_get_numeric);
PG_FUNCTION_INFO_V1(json_get_timestamp);
PG_FUNCTION_INFO_V1(json_array_to_object_array);
-PG_FUNCTION_INFO_V1(json_array_to_multi_array);
PG_FUNCTION_INFO_V1(json_array_to_text_array);
PG_FUNCTION_INFO_V1(json_array_to_boolean_array);
PG_FUNCTION_INFO_V1(json_array_to_int_array);
@@ -125,7 +122,6 @@ PG_FUNCTION_INFO_V1(json_array_to_numeric_array);
PG_FUNCTION_INFO_V1(json_array_to_timestamp_array);
PG_FUNCTION_INFO_V1(json_get_object_array);
-PG_FUNCTION_INFO_V1(json_get_multi_array);
PG_FUNCTION_INFO_V1(json_get_text_array);
PG_FUNCTION_INFO_V1(json_get_boolean_array);
PG_FUNCTION_INFO_V1(json_get_int_array);
@@ -538,12 +534,6 @@ Datum json_array_to_object_array(PG_FUNCTION_ARGS)
return json_array_to_array_generic_args(fcinfo, CJSON_TYPE_ANY, TEXTOID, extract_json_to_string);
}
-Datum json_array_to_multi_array(PG_FUNCTION_ARGS)
-{
- // TODO convert to multidim
- return json_array_to_array_generic_args(fcinfo, CJSON_TYPE_ANY, TEXTOID, extract_json_to_string);
-}
-
Datum json_array_to_text_array(PG_FUNCTION_ARGS)
{
return json_array_to_array_generic_args(fcinfo, cJSON_String, TEXTOID, extract_json_string);
@@ -589,12 +579,6 @@ Datum json_get_object_array(PG_FUNCTION_ARGS)
return json_object_get_generic_args(fcinfo, cJSON_Array, extract_object_array);
}
-Datum json_get_multi_array(PG_FUNCTION_ARGS)
-{
- // TODO convert to multidim
- return json_object_get_generic_args(fcinfo, cJSON_Array, extract_object_array);
-}
-
Datum json_get_text_array(PG_FUNCTION_ARGS)
{
return json_object_get_generic_args(fcinfo, cJSON_Array, extract_text_array);
View
3 test/expected/regress.out
@@ -87,9 +87,6 @@ baz2
-- {"{\"foo\":42}","{\"bar\":[]}"}
select json_array_to_object_array('[{"foo":42}, {"bar":[]}]');
{"{\"foo\":42}","{\"bar\":[]}"}
--- {"[\"foo\",\"bar\"]",[]}
-select json_array_to_multi_array('[["foo", "bar"], []]');
-{"[\"foo\",\"bar\"]",[]}
-- {"{\"foo\":42}","{\"bar\":[]}"}
select json_get_object_array('{"key" : [{"foo":42}, {"bar":[]}]}', 'key');
{"{\"foo\":42}","{\"bar\":[]}"}
View
3 test/sql/regress.sql
@@ -67,9 +67,6 @@ select (json_array_to_text_array(json_get_object('{"foo":"qq", "bar": ["baz1", "
-- {"{\"foo\":42}","{\"bar\":[]}"}
select json_array_to_object_array('[{"foo":42}, {"bar":[]}]');
--- {"[\"foo\",\"bar\"]",[]}
-select json_array_to_multi_array('[["foo", "bar"], []]');
-
-- {"{\"foo\":42}","{\"bar\":[]}"}
select json_get_object_array('{"key" : [{"foo":42}, {"bar":[]}]}', 'key');

0 comments on commit e68df64

Please sign in to comment.
Something went wrong with that request. Please try again.