Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Empty PostgreSQL arrays will now be created for empty JSON arrays. #4

Merged
merged 1 commit into from

2 participants

@shartte

This fixes an issue with empty JSON arrays not being correctly recognized as arrays by the array accessors.

Using this fix, an empty PostgreSQL array with the requested element type will be created for empty JSON arrays.

@theirix theirix merged commit 18cf134 into theirix:master
@shartte

Thanks for merging!

@theirix
Owner

Thank you for the patch too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/json_accessors.c
View
4 src/json_accessors.c
@@ -310,6 +310,10 @@ Datum json_array_to_array_generic_impl(cJSON *jsonArray, int json_type, Oid elem
pfree(items);
}
+ else
+ {
+ array = construct_empty_array(elem_oid);
+ }
if (!array)
ereport(ERROR,
Something went wrong with that request. Please try again.