projects
/
users
/
bernd
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b810473
)
intarray: return empty zero-dimensional array for an empty array
author
Bruce Momjian
<
[email protected]
>
Sat, 7 Sep 2013 15:44:33 +0000
(11:44 -0400)
committer
Bruce Momjian
<
[email protected]
>
Sat, 7 Sep 2013 15:44:33 +0000
(11:44 -0400)
Previously a one-dimensional empty array was returned, but its text
representation matched a zero-dimensional array, and there is no way to
dump/reload a one-dimensional empty array.
BACKWARD INCOMPATIBILITY
Per report from elein
contrib/intarray/_int_tool.c
patch
|
blob
|
blame
|
history
diff --git
a/contrib/intarray/_int_tool.c
b/contrib/intarray/_int_tool.c
index 863557672ee33e612b1a8780f8bb8df1cdbb7a20..fc462b20766054cff68fb6e0b345db58a77eacc8 100644
(file)
--- a/
contrib/intarray/_int_tool.c
+++ b/
contrib/intarray/_int_tool.c
@@
-246,6
+246,13
@@
resize_intArrayType(ArrayType *a, int num)
int nbytes = ARR_DATA_OFFSET(a) + sizeof(int) * num;
int i;
+ /* if no elements, return a zero-dimensional array */
+ if (num == 0)
+ {
+ ARR_NDIM(a) = 0;
+ return a;
+ }
+
if (num == ARRNELEMS(a))
return a;