File tree Expand file tree Collapse file tree 4 files changed +30
-7
lines changed
Expand file tree Collapse file tree 4 files changed +30
-7
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.153 2009/01/30 21:21:18 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.154 2009/04/05 22:28:59 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1668,6 +1668,28 @@ array_length(PG_FUNCTION_ARGS)
16681668 PG_RETURN_INT32 (result );
16691669}
16701670
1671+ /*
1672+ * array_cardinality :
1673+ * SQL-spec alias for array_length(v, 1)
1674+ */
1675+ Datum
1676+ array_cardinality (PG_FUNCTION_ARGS )
1677+ {
1678+ ArrayType * v = PG_GETARG_ARRAYTYPE_P (0 );
1679+ int * dimv ;
1680+ int result ;
1681+
1682+ /* Sanity check: does it look like an array at all? */
1683+ if (ARR_NDIM (v ) <= 0 || ARR_NDIM (v ) > MAXDIM )
1684+ PG_RETURN_NULL ();
1685+
1686+ dimv = ARR_DIMS (v );
1687+
1688+ result = dimv [0 ];
1689+
1690+ PG_RETURN_INT32 (result );
1691+ }
1692+
16711693/*
16721694 * array_ref :
16731695 * This routine takes an array pointer and a subscript array and returns
Original file line number Diff line number Diff line change 3737 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
3838 * Portions Copyright (c) 1994, Regents of the University of California
3939 *
40- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.527 2009/03/31 17:59:56 tgl Exp $
40+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.528 2009/04/05 22:28:59 tgl Exp $
4141 *
4242 *-------------------------------------------------------------------------
4343 */
5353 */
5454
5555/* yyyymmddN */
56- #define CATALOG_VERSION_NO 200903311
56+ #define CATALOG_VERSION_NO 200904051
5757
5858#endif
Original file line number Diff line number Diff line change 77 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
10- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.539 2009/03/25 22:19:02 tgl Exp $
10+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.540 2009/04/05 22:28:59 tgl Exp $
1111 *
1212 * NOTES
1313 * The script catalog/genbki.sh reads this file and generates .bki
@@ -1005,8 +1005,8 @@ DATA(insert OID = 2092 ( array_upper PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23
10051005DESCR ("array upper dimension" );
10061006DATA (insert OID = 2176 ( array_length PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_length _null_ _null_ _null_ ));
10071007DESCR ("array length" );
1008- DATA (insert OID = 2179 ( cardinality PGNSP PGUID 14 1 0 0 f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ "select pg_catalog.array_length($1, 1)" _null_ _null_ _null_ ));
1009- DESCR ("array length " );
1008+ DATA (insert OID = 2179 ( cardinality PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ array_cardinality _null_ _null_ _null_ ));
1009+ DESCR ("array cardinality " );
10101010DATA (insert OID = 378 ( array_append PGNSP PGUID 12 1 0 0 f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ ));
10111011DESCR ("append element onto end of array" );
10121012DATA (insert OID = 379 ( array_prepend PGNSP PGUID 12 1 0 0 f f f f f i 2 0 2277 "2283 2277" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ ));
Original file line number Diff line number Diff line change 4949 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
5050 * Portions Copyright (c) 1994, Regents of the University of California
5151 *
52- * $PostgreSQL: pgsql/src/include/utils/array.h,v 1.74 2009/01/01 17:24:02 momjian Exp $
52+ * $PostgreSQL: pgsql/src/include/utils/array.h,v 1.75 2009/04/05 22:28:59 tgl Exp $
5353 *
5454 *-------------------------------------------------------------------------
5555 */
@@ -200,6 +200,7 @@ extern Datum array_dims(PG_FUNCTION_ARGS);
200200extern Datum array_lower (PG_FUNCTION_ARGS );
201201extern Datum array_upper (PG_FUNCTION_ARGS );
202202extern Datum array_length (PG_FUNCTION_ARGS );
203+ extern Datum array_cardinality (PG_FUNCTION_ARGS );
203204extern Datum array_larger (PG_FUNCTION_ARGS );
204205extern Datum array_smaller (PG_FUNCTION_ARGS );
205206extern Datum generate_subscripts (PG_FUNCTION_ARGS );
You can’t perform that action at this time.
0 commit comments