Skip to content

Commit

Permalink
Removed multi-array functions as never-worked
Browse files Browse the repository at this point in the history
  • Loading branch information
theirix committed Oct 2, 2012
1 parent b3e5e5e commit e68df64
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 48 deletions.
20 changes: 0 additions & 20 deletions doc/json_accessors.md
Expand Up @@ -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[]`.
Expand Down Expand Up @@ -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[]`.
Expand Down
6 changes: 0 additions & 6 deletions sql/json_accessors.sql
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
16 changes: 0 additions & 16 deletions src/json_accessors.c
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions test/expected/regress.out
Expand Up @@ -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\":[]}"}
Expand Down
3 changes: 0 additions & 3 deletions test/sql/regress.sql
Expand Up @@ -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');

Expand Down

0 comments on commit e68df64

Please sign in to comment.