* makeArrayResult - produce 1-D final result of accumArrayResult * * Note: only releases astate if it was initialized within a separate memory * context (i.e. using subcontext=true when calling initArrayResultWithSize). * * astate is working state (must not be NULL) * rcontext is where to construct result */
| 5301 | * rcontext is where to construct result |
| 5302 | */ |
| 5303 | Datum |
| 5304 | makeArrayResult(ArrayBuildState *astate, |
| 5305 | MemoryContext rcontext) |
| 5306 | { |
| 5307 | int ndims; |
| 5308 | int dims[1]; |
| 5309 | int lbs[1]; |
| 5310 | |
| 5311 | /* If no elements were presented, we want to create an empty array */ |
| 5312 | ndims = (astate->nelems > 0) ? 1 : 0; |
| 5313 | dims[0] = astate->nelems; |
| 5314 | lbs[0] = 1; |
| 5315 | |
| 5316 | return makeMdArrayResult(astate, ndims, dims, lbs, rcontext, |
| 5317 | astate->private_cxt); |
| 5318 | } |
| 5319 | |
| 5320 | /* |
| 5321 | * makeMdArrayResult - produce multi-D final result of accumArrayResult |