array.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. /*-------------------------------------------------------------------------
  2. *
  3. * array.h
  4. * Declarations for Postgres arrays.
  5. *
  6. * A standard varlena array has the following internal structure:
  7. * <vl_len_> - standard varlena header word
  8. * <ndim> - number of dimensions of the array
  9. * <dataoffset> - offset to stored data, or 0 if no nulls bitmap
  10. * <elemtype> - element type OID
  11. * <dimensions> - length of each array axis (C array of int)
  12. * <lower bnds> - lower boundary of each dimension (C array of int)
  13. * <null bitmap> - bitmap showing locations of nulls (OPTIONAL)
  14. * <actual data> - whatever is the stored data
  15. *
  16. * The <dimensions> and <lower bnds> arrays each have ndim elements.
  17. *
  18. * The <null bitmap> may be omitted if the array contains no NULL elements.
  19. * If it is absent, the <dataoffset> field is zero and the offset to the
  20. * stored data must be computed on-the-fly. If the bitmap is present,
  21. * <dataoffset> is nonzero and is equal to the offset from the array start
  22. * to the first data element (including any alignment padding). The bitmap
  23. * follows the same conventions as tuple null bitmaps, ie, a 1 indicates
  24. * a non-null entry and the LSB of each bitmap byte is used first.
  25. *
  26. * The actual data starts on a MAXALIGN boundary. Individual items in the
  27. * array are aligned as specified by the array element type. They are
  28. * stored in row-major order (last subscript varies most rapidly).
  29. *
  30. * NOTE: it is important that array elements of toastable datatypes NOT be
  31. * toasted, since the tupletoaster won't know they are there. (We could
  32. * support compressed toasted items; only out-of-line items are dangerous.
  33. * However, it seems preferable to store such items uncompressed and allow
  34. * the toaster to compress the whole array as one input.)
  35. *
  36. *
  37. * The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with
  38. * generic arrays, but they support only one-dimensional arrays with no
  39. * nulls (and no null bitmap). They don't support being toasted, either.
  40. *
  41. * There are also some "fixed-length array" datatypes, such as NAME and
  42. * POINT. These are simply a sequence of a fixed number of items each
  43. * of a fixed-length datatype, with no overhead; the item size must be
  44. * a multiple of its alignment requirement, because we do no padding.
  45. * We support subscripting on these types, but array_in() and array_out()
  46. * only work with varlena arrays.
  47. *
  48. * In addition, arrays are a major user of the "expanded object" TOAST
  49. * infrastructure. This allows a varlena array to be converted to a
  50. * separate representation that may include "deconstructed" Datum/isnull
  51. * arrays holding the elements.
  52. *
  53. *
  54. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  55. * Portions Copyright (c) 1994, Regents of the University of California
  56. *
  57. * src/include/utils/array.h
  58. *
  59. *-------------------------------------------------------------------------
  60. */
  61. #ifndef ARRAY_H
  62. #define ARRAY_H
  63. #include "fmgr.h"
  64. #include "utils/expandeddatum.h"
  65. /*
  66. * Arrays are varlena objects, so must meet the varlena convention that
  67. * the first int32 of the object contains the total object size in bytes.
  68. * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though!
  69. *
  70. * CAUTION: if you change the header for ordinary arrays you will also
  71. * need to change the headers for oidvector and int2vector!
  72. */
  73. typedef struct
  74. {
  75. int32 vl_len_; /* varlena header (do not touch directly!) */
  76. int ndim; /* # of dimensions */
  77. int32 dataoffset; /* offset to data, or 0 if no bitmap */
  78. Oid elemtype; /* element type OID */
  79. } ArrayType;
  80. /*
  81. * An expanded array is contained within a private memory context (as
  82. * all expanded objects must be) and has a control structure as below.
  83. *
  84. * The expanded array might contain a regular "flat" array if that was the
  85. * original input and we've not modified it significantly. Otherwise, the
  86. * contents are represented by Datum/isnull arrays plus dimensionality and
  87. * type information. We could also have both forms, if we've deconstructed
  88. * the original array for access purposes but not yet changed it. For pass-
  89. * by-reference element types, the Datums would point into the flat array in
  90. * this situation. Once we start modifying array elements, new pass-by-ref
  91. * elements are separately palloc'd within the memory context.
  92. */
  93. #define EA_MAGIC 689375833 /* ID for debugging crosschecks */
  94. typedef struct ExpandedArrayHeader
  95. {
  96. /* Standard header for expanded objects */
  97. ExpandedObjectHeader hdr;
  98. /* Magic value identifying an expanded array (for debugging only) */
  99. int ea_magic;
  100. /* Dimensionality info (always valid) */
  101. int ndims; /* # of dimensions */
  102. int *dims; /* array dimensions */
  103. int *lbound; /* index lower bounds for each dimension */
  104. /* Element type info (always valid) */
  105. Oid element_type; /* element type OID */
  106. int16 typlen; /* needed info about element datatype */
  107. bool typbyval;
  108. char typalign;
  109. /*
  110. * If we have a Datum-array representation of the array, it's kept here;
  111. * else dvalues/dnulls are NULL. The dvalues and dnulls arrays are always
  112. * palloc'd within the object private context, but may change size from
  113. * time to time. For pass-by-ref element types, dvalues entries might
  114. * point either into the fstartptr..fendptr area, or to separately
  115. * palloc'd chunks. Elements should always be fully detoasted, as they
  116. * are in the standard flat representation.
  117. *
  118. * Even when dvalues is valid, dnulls can be NULL if there are no null
  119. * elements.
  120. */
  121. Datum *dvalues; /* array of Datums */
  122. bool *dnulls; /* array of is-null flags for Datums */
  123. int dvalueslen; /* allocated length of above arrays */
  124. int nelems; /* number of valid entries in above arrays */
  125. /*
  126. * flat_size is the current space requirement for the flat equivalent of
  127. * the expanded array, if known; otherwise it's 0. We store this to make
  128. * consecutive calls of get_flat_size cheap.
  129. */
  130. Size flat_size;
  131. /*
  132. * fvalue points to the flat representation if it is valid, else it is
  133. * NULL. If we have or ever had a flat representation then
  134. * fstartptr/fendptr point to the start and end+1 of its data area; this
  135. * is so that we can tell which Datum pointers point into the flat
  136. * representation rather than being pointers to separately palloc'd data.
  137. */
  138. ArrayType *fvalue; /* must be a fully detoasted array */
  139. char *fstartptr; /* start of its data area */
  140. char *fendptr; /* end+1 of its data area */
  141. } ExpandedArrayHeader;
  142. /*
  143. * Functions that can handle either a "flat" varlena array or an expanded
  144. * array use this union to work with their input.
  145. */
  146. typedef union AnyArrayType
  147. {
  148. ArrayType flt;
  149. ExpandedArrayHeader xpn;
  150. } AnyArrayType;
  151. /*
  152. * working state for accumArrayResult() and friends
  153. * note that the input must be scalars (legal array elements)
  154. */
  155. typedef struct ArrayBuildState
  156. {
  157. MemoryContext mcontext; /* where all the temp stuff is kept */
  158. Datum *dvalues; /* array of accumulated Datums */
  159. bool *dnulls; /* array of is-null flags for Datums */
  160. int alen; /* allocated length of above arrays */
  161. int nelems; /* number of valid entries in above arrays */
  162. Oid element_type; /* data type of the Datums */
  163. int16 typlen; /* needed info about datatype */
  164. bool typbyval;
  165. char typalign;
  166. bool private_cxt; /* use private memory context */
  167. } ArrayBuildState;
  168. /*
  169. * working state for accumArrayResultArr() and friends
  170. * note that the input must be arrays, and the same array type is returned
  171. */
  172. typedef struct ArrayBuildStateArr
  173. {
  174. MemoryContext mcontext; /* where all the temp stuff is kept */
  175. char *data; /* accumulated data */
  176. bits8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */
  177. int abytes; /* allocated length of "data" */
  178. int nbytes; /* number of bytes used so far */
  179. int aitems; /* allocated length of bitmap (in elements) */
  180. int nitems; /* total number of elements in result */
  181. int ndims; /* current dimensions of result */
  182. int dims[MAXDIM];
  183. int lbs[MAXDIM];
  184. Oid array_type; /* data type of the arrays */
  185. Oid element_type; /* data type of the array elements */
  186. bool private_cxt; /* use private memory context */
  187. } ArrayBuildStateArr;
  188. /*
  189. * working state for accumArrayResultAny() and friends
  190. * these functions handle both cases
  191. */
  192. typedef struct ArrayBuildStateAny
  193. {
  194. /* Exactly one of these is not NULL: */
  195. ArrayBuildState *scalarstate;
  196. ArrayBuildStateArr *arraystate;
  197. } ArrayBuildStateAny;
  198. /*
  199. * structure to cache type metadata needed for array manipulation
  200. */
  201. typedef struct ArrayMetaState
  202. {
  203. Oid element_type;
  204. int16 typlen;
  205. bool typbyval;
  206. char typalign;
  207. char typdelim;
  208. Oid typioparam;
  209. Oid typiofunc;
  210. FmgrInfo proc;
  211. } ArrayMetaState;
  212. /*
  213. * private state needed by array_map (here because caller must provide it)
  214. */
  215. typedef struct ArrayMapState
  216. {
  217. ArrayMetaState inp_extra;
  218. ArrayMetaState ret_extra;
  219. } ArrayMapState;
  220. /* ArrayIteratorData is private in arrayfuncs.c */
  221. typedef struct ArrayIteratorData *ArrayIterator;
  222. /* fmgr macros for regular varlena array objects */
  223. #define DatumGetArrayTypeP(X) ((ArrayType *) PG_DETOAST_DATUM(X))
  224. #define DatumGetArrayTypePCopy(X) ((ArrayType *) PG_DETOAST_DATUM_COPY(X))
  225. #define PG_GETARG_ARRAYTYPE_P(n) DatumGetArrayTypeP(PG_GETARG_DATUM(n))
  226. #define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n))
  227. #define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x)
  228. /* fmgr macros for expanded array objects */
  229. #define PG_GETARG_EXPANDED_ARRAY(n) DatumGetExpandedArray(PG_GETARG_DATUM(n))
  230. #define PG_GETARG_EXPANDED_ARRAYX(n, metacache) \
  231. DatumGetExpandedArrayX(PG_GETARG_DATUM(n), metacache)
  232. #define PG_RETURN_EXPANDED_ARRAY(x) PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr))
  233. /* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */
  234. #define PG_GETARG_ANY_ARRAY(n) DatumGetAnyArray(PG_GETARG_DATUM(n))
  235. /*
  236. * Access macros for varlena array header fields.
  237. *
  238. * ARR_DIMS returns a pointer to an array of array dimensions (number of
  239. * elements along the various array axes).
  240. *
  241. * ARR_LBOUND returns a pointer to an array of array lower bounds.
  242. *
  243. * That is: if the third axis of an array has elements 5 through 8, then
  244. * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5.
  245. *
  246. * Unlike C, the default lower bound is 1.
  247. */
  248. #define ARR_SIZE(a) VARSIZE(a)
  249. #define ARR_NDIM(a) ((a)->ndim)
  250. #define ARR_HASNULL(a) ((a)->dataoffset != 0)
  251. #define ARR_ELEMTYPE(a) ((a)->elemtype)
  252. #define ARR_DIMS(a) \
  253. ((int *) (((char *) (a)) + sizeof(ArrayType)))
  254. #define ARR_LBOUND(a) \
  255. ((int *) (((char *) (a)) + sizeof(ArrayType) + \
  256. sizeof(int) * ARR_NDIM(a)))
  257. #define ARR_NULLBITMAP(a) \
  258. (ARR_HASNULL(a) ? \
  259. (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \
  260. 2 * sizeof(int) * ARR_NDIM(a)) \
  261. : (bits8 *) NULL)
  262. /*
  263. * The total array header size (in bytes) for an array with the specified
  264. * number of dimensions and total number of items.
  265. */
  266. #define ARR_OVERHEAD_NONULLS(ndims) \
  267. MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims))
  268. #define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \
  269. MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \
  270. ((nitems) + 7) / 8)
  271. #define ARR_DATA_OFFSET(a) \
  272. (ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a)))
  273. /*
  274. * Returns a pointer to the actual array data.
  275. */
  276. #define ARR_DATA_PTR(a) \
  277. (((char *) (a)) + ARR_DATA_OFFSET(a))
  278. /*
  279. * Macros for working with AnyArrayType inputs. Beware multiple references!
  280. */
  281. #define AARR_NDIM(a) \
  282. (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.ndims : ARR_NDIM(&(a)->flt))
  283. #define AARR_HASNULL(a) \
  284. (VARATT_IS_EXPANDED_HEADER(a) ? \
  285. ((a)->xpn.dvalues != NULL ? (a)->xpn.dnulls != NULL : ARR_HASNULL((a)->xpn.fvalue)) : \
  286. ARR_HASNULL(&(a)->flt))
  287. #define AARR_ELEMTYPE(a) \
  288. (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.element_type : ARR_ELEMTYPE(&(a)->flt))
  289. #define AARR_DIMS(a) \
  290. (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.dims : ARR_DIMS(&(a)->flt))
  291. #define AARR_LBOUND(a) \
  292. (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.lbound : ARR_LBOUND(&(a)->flt))
  293. /*
  294. * GUC parameter
  295. */
  296. extern bool Array_nulls;
  297. /*
  298. * prototypes for functions defined in arrayfuncs.c
  299. */
  300. extern Datum array_in(PG_FUNCTION_ARGS);
  301. extern Datum array_out(PG_FUNCTION_ARGS);
  302. extern Datum array_recv(PG_FUNCTION_ARGS);
  303. extern Datum array_send(PG_FUNCTION_ARGS);
  304. extern Datum array_eq(PG_FUNCTION_ARGS);
  305. extern Datum array_ne(PG_FUNCTION_ARGS);
  306. extern Datum array_lt(PG_FUNCTION_ARGS);
  307. extern Datum array_gt(PG_FUNCTION_ARGS);
  308. extern Datum array_le(PG_FUNCTION_ARGS);
  309. extern Datum array_ge(PG_FUNCTION_ARGS);
  310. extern Datum btarraycmp(PG_FUNCTION_ARGS);
  311. extern Datum hash_array(PG_FUNCTION_ARGS);
  312. extern Datum arrayoverlap(PG_FUNCTION_ARGS);
  313. extern Datum arraycontains(PG_FUNCTION_ARGS);
  314. extern Datum arraycontained(PG_FUNCTION_ARGS);
  315. extern Datum array_ndims(PG_FUNCTION_ARGS);
  316. extern Datum array_dims(PG_FUNCTION_ARGS);
  317. extern Datum array_lower(PG_FUNCTION_ARGS);
  318. extern Datum array_upper(PG_FUNCTION_ARGS);
  319. extern Datum array_length(PG_FUNCTION_ARGS);
  320. extern Datum array_cardinality(PG_FUNCTION_ARGS);
  321. extern Datum array_larger(PG_FUNCTION_ARGS);
  322. extern Datum array_smaller(PG_FUNCTION_ARGS);
  323. extern Datum generate_subscripts(PG_FUNCTION_ARGS);
  324. extern Datum generate_subscripts_nodir(PG_FUNCTION_ARGS);
  325. extern Datum array_fill(PG_FUNCTION_ARGS);
  326. extern Datum array_fill_with_lower_bounds(PG_FUNCTION_ARGS);
  327. extern Datum array_unnest(PG_FUNCTION_ARGS);
  328. extern Datum array_remove(PG_FUNCTION_ARGS);
  329. extern Datum array_replace(PG_FUNCTION_ARGS);
  330. extern Datum width_bucket_array(PG_FUNCTION_ARGS);
  331. extern void CopyArrayEls(ArrayType *array,
  332. Datum *values,
  333. bool *nulls,
  334. int nitems,
  335. int typlen,
  336. bool typbyval,
  337. char typalign,
  338. bool freedata);
  339. extern Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx,
  340. int arraytyplen, int elmlen, bool elmbyval, char elmalign,
  341. bool *isNull);
  342. extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx,
  343. Datum dataValue, bool isNull,
  344. int arraytyplen, int elmlen, bool elmbyval, char elmalign);
  345. extern Datum array_get_slice(Datum arraydatum, int nSubscripts,
  346. int *upperIndx, int *lowerIndx,
  347. bool *upperProvided, bool *lowerProvided,
  348. int arraytyplen, int elmlen, bool elmbyval, char elmalign);
  349. extern Datum array_set_slice(Datum arraydatum, int nSubscripts,
  350. int *upperIndx, int *lowerIndx,
  351. bool *upperProvided, bool *lowerProvided,
  352. Datum srcArrayDatum, bool isNull,
  353. int arraytyplen, int elmlen, bool elmbyval, char elmalign);
  354. extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx,
  355. int arraytyplen, int elmlen, bool elmbyval, char elmalign,
  356. bool *isNull);
  357. extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx,
  358. Datum dataValue, bool isNull,
  359. int arraytyplen, int elmlen, bool elmbyval, char elmalign);
  360. extern Datum array_map(FunctionCallInfo fcinfo, Oid retType,
  361. ArrayMapState *amstate);
  362. extern void array_bitmap_copy(bits8 *destbitmap, int destoffset,
  363. const bits8 *srcbitmap, int srcoffset,
  364. int nitems);
  365. extern ArrayType *construct_array(Datum *elems, int nelems,
  366. Oid elmtype,
  367. int elmlen, bool elmbyval, char elmalign);
  368. extern ArrayType *construct_md_array(Datum *elems,
  369. bool *nulls,
  370. int ndims,
  371. int *dims,
  372. int *lbs,
  373. Oid elmtype, int elmlen, bool elmbyval, char elmalign);
  374. extern ArrayType *construct_empty_array(Oid elmtype);
  375. extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type,
  376. MemoryContext parentcontext,
  377. ArrayMetaState *metacache);
  378. extern void deconstruct_array(ArrayType *array,
  379. Oid elmtype,
  380. int elmlen, bool elmbyval, char elmalign,
  381. Datum **elemsp, bool **nullsp, int *nelemsp);
  382. extern bool array_contains_nulls(ArrayType *array);
  383. extern ArrayBuildState *initArrayResult(Oid element_type,
  384. MemoryContext rcontext, bool subcontext);
  385. extern ArrayBuildState *accumArrayResult(ArrayBuildState *astate,
  386. Datum dvalue, bool disnull,
  387. Oid element_type,
  388. MemoryContext rcontext);
  389. extern Datum makeArrayResult(ArrayBuildState *astate,
  390. MemoryContext rcontext);
  391. extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims,
  392. int *dims, int *lbs, MemoryContext rcontext, bool release);
  393. extern ArrayBuildStateArr *initArrayResultArr(Oid array_type, Oid element_type,
  394. MemoryContext rcontext, bool subcontext);
  395. extern ArrayBuildStateArr *accumArrayResultArr(ArrayBuildStateArr *astate,
  396. Datum dvalue, bool disnull,
  397. Oid array_type,
  398. MemoryContext rcontext);
  399. extern Datum makeArrayResultArr(ArrayBuildStateArr *astate,
  400. MemoryContext rcontext, bool release);
  401. extern ArrayBuildStateAny *initArrayResultAny(Oid input_type,
  402. MemoryContext rcontext, bool subcontext);
  403. extern ArrayBuildStateAny *accumArrayResultAny(ArrayBuildStateAny *astate,
  404. Datum dvalue, bool disnull,
  405. Oid input_type,
  406. MemoryContext rcontext);
  407. extern Datum makeArrayResultAny(ArrayBuildStateAny *astate,
  408. MemoryContext rcontext, bool release);
  409. extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate);
  410. extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull);
  411. extern void array_free_iterator(ArrayIterator iterator);
  412. /*
  413. * prototypes for functions defined in arrayutils.c
  414. */
  415. extern int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx);
  416. extern int ArrayGetOffset0(int n, const int *tup, const int *scale);
  417. extern int ArrayGetNItems(int ndim, const int *dims);
  418. extern void mda_get_range(int n, int *span, const int *st, const int *endp);
  419. extern void mda_get_prod(int n, const int *range, int *prod);
  420. extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span);
  421. extern int mda_next_tuple(int n, int *curr, const int *span);
  422. extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n);
  423. /*
  424. * prototypes for functions defined in array_expanded.c
  425. */
  426. extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext,
  427. ArrayMetaState *metacache);
  428. extern ExpandedArrayHeader *DatumGetExpandedArray(Datum d);
  429. extern ExpandedArrayHeader *DatumGetExpandedArrayX(Datum d,
  430. ArrayMetaState *metacache);
  431. extern AnyArrayType *DatumGetAnyArray(Datum d);
  432. extern void deconstruct_expanded_array(ExpandedArrayHeader *eah);
  433. /*
  434. * prototypes for functions defined in array_userfuncs.c
  435. */
  436. extern Datum array_append(PG_FUNCTION_ARGS);
  437. extern Datum array_prepend(PG_FUNCTION_ARGS);
  438. extern Datum array_cat(PG_FUNCTION_ARGS);
  439. extern ArrayType *create_singleton_array(FunctionCallInfo fcinfo,
  440. Oid element_type,
  441. Datum element,
  442. bool isNull,
  443. int ndims);
  444. extern Datum array_agg_transfn(PG_FUNCTION_ARGS);
  445. extern Datum array_agg_finalfn(PG_FUNCTION_ARGS);
  446. extern Datum array_agg_array_transfn(PG_FUNCTION_ARGS);
  447. extern Datum array_agg_array_finalfn(PG_FUNCTION_ARGS);
  448. extern Datum array_position(PG_FUNCTION_ARGS);
  449. extern Datum array_position_start(PG_FUNCTION_ARGS);
  450. extern Datum array_positions(PG_FUNCTION_ARGS);
  451. /*
  452. * prototypes for functions defined in array_typanalyze.c
  453. */
  454. extern Datum array_typanalyze(PG_FUNCTION_ARGS);
  455. #endif /* ARRAY_H */