diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c index 73e2a05845..d847611240 100644 --- a/src/backend/utils/adt/varbit.c +++ b/src/backend/utils/adt/varbit.c @@ -29,7 +29,9 @@ static VarBit *bitsubstring(VarBit *arg, int32 s, int32 l, static VarBit *bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl); -/* common code for bittypmodin and varbittypmodin */ +/* + * common code for bittypmodin and varbittypmodin + */ static int32 anybit_typmodin(ArrayType *ta, const char *typename) { @@ -64,7 +66,9 @@ anybit_typmodin(ArrayType *ta, const char *typename) return typmod; } -/* common code for bittypmodout and varbittypmodout */ +/* + * common code for bittypmodout and varbittypmodout + */ static char * anybit_typmodout(int32 typmod) { @@ -233,8 +237,10 @@ bit_out(PG_FUNCTION_ARGS) /* same as varbit output */ return varbit_out(fcinfo); #else -/* This is how one would print a hex string, in case someone wants to - write a formatting function. */ + /* + * This is how one would print a hex string, in case someone wants to + * write a formatting function. + */ VarBit *s = PG_GETARG_VARBIT_P(0); char *result, *r; @@ -330,7 +336,8 @@ bit_send(PG_FUNCTION_ARGS) return varbit_send(fcinfo); } -/* bit() +/* + * bit() * Converts a bit() type to a specific internal length. * len is the bitlength specified in the column definition. * @@ -523,7 +530,8 @@ varbit_in(PG_FUNCTION_ARGS) PG_RETURN_VARBIT_P(result); } -/* varbit_out - +/* + * varbit_out - * Prints the string as bits to preserve length accurately */ Datum @@ -636,7 +644,8 @@ varbit_send(PG_FUNCTION_ARGS) PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); } -/* varbit() +/* + * varbit() * Converts a varbit() type to a specific internal length. * len is the maximum bitlength specified in the column definition. * @@ -718,7 +727,8 @@ varbittypmodout(PG_FUNCTION_ARGS) * need to be so careful. */ -/* bit_cmp +/* + * bit_cmp * * Compares two bitstrings and returns <0, 0, >0 depending on whether the first * string is smaller, equal, or bigger than the second. All bits are considered @@ -871,7 +881,8 @@ bitcmp(PG_FUNCTION_ARGS) PG_RETURN_INT32(result); } -/* bitcat +/* + * bitcat * Concatenation of bit strings */ Datum @@ -931,7 +942,8 @@ bit_catenate(VarBit *arg1, VarBit *arg2) return result; } -/* bitsubstr +/* + * bitsubstr * retrieve a substring from the bit string. * Note, s is 1-based. * SQL draft 6.10 9) @@ -1105,7 +1117,8 @@ bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl) return result; } -/* bitlength, bitoctetlength +/* + * bitlength, bitoctetlength * Return the length of a bit string */ Datum @@ -1124,11 +1137,12 @@ bitoctetlength(PG_FUNCTION_ARGS) PG_RETURN_INT32(VARBITBYTES(arg)); } -/* bitand +/* + * bit_and * perform a logical AND on two bit strings. */ Datum -bitand(PG_FUNCTION_ARGS) +bit_and(PG_FUNCTION_ARGS) { VarBit *arg1 = PG_GETARG_VARBIT_P(0); VarBit *arg2 = PG_GETARG_VARBIT_P(1); @@ -1164,11 +1178,12 @@ bitand(PG_FUNCTION_ARGS) PG_RETURN_VARBIT_P(result); } -/* bitor +/* + * bit_or * perform a logical OR on two bit strings. */ Datum -bitor(PG_FUNCTION_ARGS) +bit_or(PG_FUNCTION_ARGS) { VarBit *arg1 = PG_GETARG_VARBIT_P(0); VarBit *arg2 = PG_GETARG_VARBIT_P(1); @@ -1210,7 +1225,8 @@ bitor(PG_FUNCTION_ARGS) PG_RETURN_VARBIT_P(result); } -/* bitxor +/* + * bitxor * perform a logical XOR on two bit strings. */ Datum @@ -1257,7 +1273,8 @@ bitxor(PG_FUNCTION_ARGS) PG_RETURN_VARBIT_P(result); } -/* bitnot +/* + * bitnot * perform a logical NOT on a bit string. */ Datum @@ -1289,7 +1306,8 @@ bitnot(PG_FUNCTION_ARGS) PG_RETURN_VARBIT_P(result); } -/* bitshiftleft +/* + * bitshiftleft * do a left shift (i.e. towards the beginning of the string) */ Datum @@ -1348,7 +1366,8 @@ bitshiftleft(PG_FUNCTION_ARGS) PG_RETURN_VARBIT_P(result); } -/* bitshiftright +/* + * bitshiftright * do a right shift (i.e. towards the end of the string) */ Datum @@ -1575,7 +1594,8 @@ bittoint8(PG_FUNCTION_ARGS) } -/* Determines the position of S2 in the bitstring S1 (1-based string). +/* + * Determines the position of S2 in the bitstring S1 (1-based string). * If S2 does not appear in S1 this function returns 0. * If S2 is of length 0 this function returns 1. * Compatible in usage with POSITION() functions for other data types. diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 1ebd7a2d27..ca1c3bd683 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201012161 +#define CATALOG_VERSION_NO 201012271 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 1e6e75f5c3..bc3fd71876 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2396,9 +2396,9 @@ DESCR("less than"); DATA(insert OID = 1672 ( varbitcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1562 1562" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); DESCR("compare"); -DATA(insert OID = 1673 ( bitand PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bitand _null_ _null_ _null_ )); +DATA(insert OID = 1673 ( bitand PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bit_and _null_ _null_ _null_ )); DESCR("bitwise and"); -DATA(insert OID = 1674 ( bitor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bitor _null_ _null_ _null_ )); +DATA(insert OID = 1674 ( bitor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bit_or _null_ _null_ _null_ )); DESCR("bitwise or"); DATA(insert OID = 1675 ( bitxor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bitxor _null_ _null_ _null_ )); DESCR("bitwise exclusive or"); diff --git a/src/include/utils/varbit.h b/src/include/utils/varbit.h index b6c6032907..3f35b090a6 100644 --- a/src/include/utils/varbit.h +++ b/src/include/utils/varbit.h @@ -80,8 +80,9 @@ extern Datum bitle(PG_FUNCTION_ARGS); extern Datum bitgt(PG_FUNCTION_ARGS); extern Datum bitge(PG_FUNCTION_ARGS); extern Datum bitcmp(PG_FUNCTION_ARGS); -extern Datum bitand(PG_FUNCTION_ARGS); -extern Datum bitor(PG_FUNCTION_ARGS); +/* avoid the names bitand and bitor, since they are C++ keywords */ +extern Datum bit_and(PG_FUNCTION_ARGS); +extern Datum bit_or(PG_FUNCTION_ARGS); extern Datum bitxor(PG_FUNCTION_ARGS); extern Datum bitnot(PG_FUNCTION_ARGS); extern Datum bitshiftleft(PG_FUNCTION_ARGS);