Commit b503cbe3 authored by Tom Lane's avatar Tom Lane

First pass at integrating BIT and BIT VARYING code from Adriaan Joubert.

Update functions to new-style fmgr, make BIT and VARBIT be binary-
equivalent, add entries to allow these types to be btree indexed,
correct a few bugs.  BIT/VARBIT are now toastable, too.
NOTE: initdb forced due to catalog updates.
parent d594eecd
This diff is collapsed.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: catversion.h,v 1.41 2000/08/08 15:42:33 tgl Exp $ * $Id: catversion.h,v 1.42 2000/08/21 04:48:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200008071 #define CATALOG_VERSION_NO 200008201
#endif #endif
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_amop.h,v 1.35 2000/07/30 22:13:59 tgl Exp $ * $Id: pg_amop.h,v 1.36 2000/08/21 04:48:51 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -259,7 +259,6 @@ DATA(insert OID = 0 ( 403 1114 1093 3 )); ...@@ -259,7 +259,6 @@ DATA(insert OID = 0 ( 403 1114 1093 3 ));
DATA(insert OID = 0 ( 403 1114 1098 4 )); DATA(insert OID = 0 ( 403 1114 1098 4 ));
DATA(insert OID = 0 ( 403 1114 1097 5 )); DATA(insert OID = 0 ( 403 1114 1097 5 ));
/* /*
* nbtree time_ops * nbtree time_ops
*/ */
...@@ -350,6 +349,26 @@ DATA(insert OID = 0 ( 403 1690 91 3 )); ...@@ -350,6 +349,26 @@ DATA(insert OID = 0 ( 403 1690 91 3 ));
DATA(insert OID = 0 ( 403 1690 1695 4 )); DATA(insert OID = 0 ( 403 1690 1695 4 ));
DATA(insert OID = 0 ( 403 1690 59 5 )); DATA(insert OID = 0 ( 403 1690 59 5 ));
/*
* nbtree bit
*/
DATA(insert OID = 0 ( 403 424 1786 1 ));
DATA(insert OID = 0 ( 403 424 1788 2 ));
DATA(insert OID = 0 ( 403 424 1784 3 ));
DATA(insert OID = 0 ( 403 424 1789 4 ));
DATA(insert OID = 0 ( 403 424 1787 5 ));
/*
* nbtree varbit
*/
DATA(insert OID = 0 ( 403 425 1806 1 ));
DATA(insert OID = 0 ( 403 425 1808 2 ));
DATA(insert OID = 0 ( 403 425 1804 3 ));
DATA(insert OID = 0 ( 403 425 1809 4 ));
DATA(insert OID = 0 ( 403 425 1807 5 ));
/* /*
* hash table _ops * hash table _ops
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_amproc.h,v 1.24 2000/07/30 22:13:59 tgl Exp $ * $Id: pg_amproc.h,v 1.25 2000/08/21 04:48:51 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -99,7 +99,8 @@ DATA(insert OID = 0 (403 652 926 1)); ...@@ -99,7 +99,8 @@ DATA(insert OID = 0 (403 652 926 1));
DATA(insert OID = 0 (403 1768 1769 1)); DATA(insert OID = 0 (403 1768 1769 1));
DATA(insert OID = 0 (403 1690 1693 1)); DATA(insert OID = 0 (403 1690 1693 1));
DATA(insert OID = 0 (403 1399 1358 1)); DATA(insert OID = 0 (403 1399 1358 1));
DATA(insert OID = 0 (403 424 1596 1));
DATA(insert OID = 0 (403 425 1672 1));
/* hash */ /* hash */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_opclass.h,v 1.35 2000/07/30 22:13:59 tgl Exp $ * $Id: pg_opclass.h,v 1.36 2000/08/21 04:48:51 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -119,5 +119,9 @@ DATA(insert OID = 1690 ( bool_ops 16 )); ...@@ -119,5 +119,9 @@ DATA(insert OID = 1690 ( bool_ops 16 ));
DESCR(""); DESCR("");
DATA(insert OID = 1399 ( timetz_ops 1266 )); DATA(insert OID = 1399 ( timetz_ops 1266 ));
DESCR(""); DESCR("");
DATA(insert OID = 424 ( bit_ops 1560 ));
DESCR("");
DATA(insert OID = 425 ( varbit_ops 1562 ));
DESCR("");
#endif /* PG_OPCLASS_H */ #endif /* PG_OPCLASS_H */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_operator.h,v 1.80 2000/08/12 05:15:22 tgl Exp $ * $Id: pg_operator.h,v 1.81 2000/08/21 04:48:51 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -306,8 +306,8 @@ DATA(insert OID = 622 ( "<" PGUID 0 b t f 700 700 16 623 625 0 0 float4lt ...@@ -306,8 +306,8 @@ DATA(insert OID = 622 ( "<" PGUID 0 b t f 700 700 16 623 625 0 0 float4lt
DATA(insert OID = 623 ( ">" PGUID 0 b t f 700 700 16 622 624 0 0 float4gt scalargtsel scalargtjoinsel )); DATA(insert OID = 623 ( ">" PGUID 0 b t f 700 700 16 622 624 0 0 float4gt scalargtsel scalargtjoinsel ));
DATA(insert OID = 624 ( "<=" PGUID 0 b t f 700 700 16 625 623 0 0 float4le scalarltsel scalarltjoinsel )); DATA(insert OID = 624 ( "<=" PGUID 0 b t f 700 700 16 625 623 0 0 float4le scalarltsel scalarltjoinsel ));
DATA(insert OID = 625 ( ">=" PGUID 0 b t f 700 700 16 624 622 0 0 float4ge scalargtsel scalargtjoinsel )); DATA(insert OID = 625 ( ">=" PGUID 0 b t f 700 700 16 624 622 0 0 float4ge scalargtsel scalargtjoinsel ));
DATA(insert OID = 626 ( "!!=" PGUID 0 b t f 23 19 16 0 0 0 0 int4notin - - )); DATA(insert OID = 626 ( "!!=" PGUID 0 b t f 23 25 16 0 0 0 0 int4notin - - ));
DATA(insert OID = 627 ( "!!=" PGUID 0 b t f 26 19 16 0 0 0 0 oidnotin - - )); DATA(insert OID = 627 ( "!!=" PGUID 0 b t f 26 25 16 0 0 0 0 oidnotin - - ));
DATA(insert OID = 630 ( "<>" PGUID 0 b t f 18 18 16 630 92 0 0 charne neqsel neqjoinsel )); DATA(insert OID = 630 ( "<>" PGUID 0 b t f 18 18 16 630 92 0 0 charne neqsel neqjoinsel ));
DATA(insert OID = 631 ( "<" PGUID 0 b t f 18 18 16 633 634 0 0 charlt scalarltsel scalarltjoinsel )); DATA(insert OID = 631 ( "<" PGUID 0 b t f 18 18 16 633 634 0 0 charlt scalarltsel scalarltjoinsel ));
...@@ -711,13 +711,12 @@ DATA(insert OID = 1786 ( "<" PGUID 0 b t f 1560 1560 16 1787 1789 0 0 bitlt ...@@ -711,13 +711,12 @@ DATA(insert OID = 1786 ( "<" PGUID 0 b t f 1560 1560 16 1787 1789 0 0 bitlt
DATA(insert OID = 1787 ( ">" PGUID 0 b t f 1560 1560 16 1786 1788 0 0 bitgt scalargtsel scalargtjoinsel )); DATA(insert OID = 1787 ( ">" PGUID 0 b t f 1560 1560 16 1786 1788 0 0 bitgt scalargtsel scalargtjoinsel ));
DATA(insert OID = 1788 ( "<=" PGUID 0 b t f 1560 1560 16 1789 1787 0 0 bitle scalarltsel scalarltjoinsel )); DATA(insert OID = 1788 ( "<=" PGUID 0 b t f 1560 1560 16 1789 1787 0 0 bitle scalarltsel scalarltjoinsel ));
DATA(insert OID = 1789 ( ">=" PGUID 0 b t f 1560 1560 16 1788 1786 0 0 bitge scalargtsel scalargtjoinsel )); DATA(insert OID = 1789 ( ">=" PGUID 0 b t f 1560 1560 16 1788 1786 0 0 bitge scalargtsel scalargtjoinsel ));
DATA(insert OID = 1790 ( "<=>" PGUID 0 b t f 1560 1560 23 0 0 0 0 bitcmp - - )); DATA(insert OID = 1791 ( "&" PGUID 0 b t f 1560 1560 1560 1791 0 0 0 bitand - - ));
DATA(insert OID = 1791 ( "&" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitand - - )); DATA(insert OID = 1792 ( "|" PGUID 0 b t f 1560 1560 1560 1792 0 0 0 bitor - - ));
DATA(insert OID = 1792 ( "|" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitor - - )); DATA(insert OID = 1793 ( "^" PGUID 0 b t f 1560 1560 1560 1793 0 0 0 bitxor - - ));
DATA(insert OID = 1793 ( "^" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitxor - - )); DATA(insert OID = 1794 ( "~" PGUID 0 l t f 0 1560 1560 0 0 0 0 bitnot - - ));
DATA(insert OID = 1794 ( "~" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitnot - - )); DATA(insert OID = 1795 ( "<<" PGUID 0 b t f 1560 23 1560 0 0 0 0 bitshiftleft - - ));
DATA(insert OID = 1795 ( "<<" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitshiftleft - - )); DATA(insert OID = 1796 ( ">>" PGUID 0 b t f 1560 23 1560 0 0 0 0 bitshiftright - - ));
DATA(insert OID = 1796 ( ">>" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitshiftright - - ));
DATA(insert OID = 1797 ( "||" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitcat - - )); DATA(insert OID = 1797 ( "||" PGUID 0 b t f 1560 1560 1560 0 0 0 0 bitcat - - ));
DATA(insert OID = 1804 ( "=" PGUID 0 b t f 1562 1562 16 1804 1805 1806 1806 varbiteq eqsel eqjoinsel )); DATA(insert OID = 1804 ( "=" PGUID 0 b t f 1562 1562 16 1804 1805 1806 1806 varbiteq eqsel eqjoinsel ));
...@@ -726,14 +725,6 @@ DATA(insert OID = 1806 ( "<" PGUID 0 b t f 1562 1562 16 1807 1809 0 0 varbit ...@@ -726,14 +725,6 @@ DATA(insert OID = 1806 ( "<" PGUID 0 b t f 1562 1562 16 1807 1809 0 0 varbit
DATA(insert OID = 1807 ( ">" PGUID 0 b t f 1562 1562 16 1806 1808 0 0 varbitgt scalargtsel scalargtjoinsel )); DATA(insert OID = 1807 ( ">" PGUID 0 b t f 1562 1562 16 1806 1808 0 0 varbitgt scalargtsel scalargtjoinsel ));
DATA(insert OID = 1808 ( "<=" PGUID 0 b t f 1562 1562 16 1809 1807 0 0 varbitle scalarltsel scalarltjoinsel )); DATA(insert OID = 1808 ( "<=" PGUID 0 b t f 1562 1562 16 1809 1807 0 0 varbitle scalarltsel scalarltjoinsel ));
DATA(insert OID = 1809 ( ">=" PGUID 0 b t f 1562 1562 16 1808 1806 0 0 varbitge scalargtsel scalargtjoinsel )); DATA(insert OID = 1809 ( ">=" PGUID 0 b t f 1562 1562 16 1808 1806 0 0 varbitge scalargtsel scalargtjoinsel ));
DATA(insert OID = 1810 ( "<=>" PGUID 0 b t f 1562 1562 23 0 0 0 0 varbitcmp - - ));
DATA(insert OID = 1811 ( "&" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitand - - ));
DATA(insert OID = 1812 ( "|" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitor - - ));
DATA(insert OID = 1813 ( "^" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitxor - - ));
DATA(insert OID = 1814 ( "~" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitnot - - ));
DATA(insert OID = 1815 ( "<<" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitshiftleft - - ));
DATA(insert OID = 1816 ( ">>" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitshiftright - - ));
DATA(insert OID = 1817 ( "||" PGUID 0 b t f 1562 1562 1562 0 0 0 0 varbitcat - - ));
DATA(insert OID = 1862 ( "=" PGUID 0 b t f 21 20 16 1868 1863 95 412 int28eq eqsel eqjoinsel )); DATA(insert OID = 1862 ( "=" PGUID 0 b t f 21 20 16 1868 1863 95 412 int28eq eqsel eqjoinsel ));
DATA(insert OID = 1863 ( "<>" PGUID 0 b t f 21 20 16 1869 1862 0 0 int28ne neqsel neqjoinsel )); DATA(insert OID = 1863 ( "<>" PGUID 0 b t f 21 20 16 1869 1862 0 0 int28ne neqsel neqjoinsel ));
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_type.h,v 1.96 2000/07/30 22:14:02 tgl Exp $ * $Id: pg_type.h,v 1.97 2000/08/21 04:48:52 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -399,12 +399,12 @@ DESCR("hh:mm:ss, ANSI SQL time"); ...@@ -399,12 +399,12 @@ DESCR("hh:mm:ss, ANSI SQL time");
DATA(insert OID = 1270 ( _timetz PGUID -1 -1 f b t \054 0 1266 array_in array_out array_in array_out d x _null_ )); DATA(insert OID = 1270 ( _timetz PGUID -1 -1 f b t \054 0 1266 array_in array_out array_in array_out d x _null_ ));
/* OIDS 1500 - 1599 */ /* OIDS 1500 - 1599 */
DATA(insert OID = 1560 ( bit PGUID -1 -1 f b t \054 0 0 zpbit_in zpbit_out zpbit_in zpbit_out i p _null_ )); DATA(insert OID = 1560 ( bit PGUID -1 -1 f b t \054 0 0 zpbit_in zpbit_out zpbit_in zpbit_out i x _null_ ));
DESCR("fixed-length bit string"); DESCR("fixed-length bit string");
#define ZPBITOID 1560 #define ZPBITOID 1560
DATA(insert OID = 1561 ( _bit PGUID -1 -1 f b t \054 0 1560 array_in array_out array_in array_out i x _null_ )); DATA(insert OID = 1561 ( _bit PGUID -1 -1 f b t \054 0 1560 array_in array_out array_in array_out i x _null_ ));
DATA(insert OID = 1562 ( varbit PGUID -1 -1 f b t \054 0 0 varbit_in varbit_out varbit_in varbit_out i p _null_ )); DATA(insert OID = 1562 ( varbit PGUID -1 -1 f b t \054 0 0 varbit_in varbit_out varbit_in varbit_out i x _null_ ));
DESCR("fixed-length bit string"); DESCR("variable-length bit string");
#define VARBITOID 1562 #define VARBITOID 1562
DATA(insert OID = 1563 ( _varbit PGUID -1 -1 f b t \054 0 1562 array_in array_out array_in array_out i x _null_ )); DATA(insert OID = 1563 ( _varbit PGUID -1 -1 f b t \054 0 1562 array_in array_out array_in array_out i x _null_ ));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_coerce.h,v 1.22 2000/04/12 17:16:45 momjian Exp $ * $Id: parse_coerce.h,v 1.23 2000/08/21 04:48:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -67,13 +67,16 @@ typedef enum CATEGORY ...@@ -67,13 +67,16 @@ typedef enum CATEGORY
|| ((t) == POLYGONOID) \ || ((t) == POLYGONOID) \
|| ((t) == CIRCLEOID) \ || ((t) == CIRCLEOID) \
|| ((t) == INETOID) \ || ((t) == INETOID) \
|| ((t) == CIDROID) ) || ((t) == CIDROID) \
|| ((t) == ZPBITOID) \
|| ((t) == VARBITOID) )
/* IS_BINARY_COMPATIBLE() /* IS_BINARY_COMPATIBLE()
* Check for types with the same underlying binary representation. * Check for types with the same underlying binary representation.
* This allows us to cheat and directly exchange values without * This allows us to cheat and directly exchange values without
* going through the trouble of calling a conversion function. * going through the trouble of calling a conversion function.
*
* Remove equivalencing of FLOAT8 and TIMESTAMP. They really are not * Remove equivalencing of FLOAT8 and TIMESTAMP. They really are not
* close enough in behavior, with the TIMESTAMP reserved values * close enough in behavior, with the TIMESTAMP reserved values
* and special formatting. - thomas 1999-01-24 * and special formatting. - thomas 1999-01-24
...@@ -96,7 +99,9 @@ typedef enum CATEGORY ...@@ -96,7 +99,9 @@ typedef enum CATEGORY
|| ((a) == RELTIMEOID && (b) == INT4OID) \ || ((a) == RELTIMEOID && (b) == INT4OID) \
|| ((a) == INT4OID && (b) == RELTIMEOID) \ || ((a) == INT4OID && (b) == RELTIMEOID) \
|| ((a) == INETOID && (b) == CIDROID) \ || ((a) == INETOID && (b) == CIDROID) \
|| ((a) == CIDROID && (b) == INETOID)) || ((a) == CIDROID && (b) == INETOID) \
|| ((a) == ZPBITOID && (b) == VARBITOID) \
|| ((a) == VARBITOID && (b) == ZPBITOID))
/* IS_HIGHER_TYPE() /* IS_HIGHER_TYPE()
* These types are the most general in each of the type categories. * These types are the most general in each of the type categories.
......
/*-------------------------------------------------------------------------
*
* varbit.h
* Functions for the SQL datatypes BIT() and BIT VARYING().
*
* Code originally contributed by Adriaan Joubert.
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: varbit.h,v 1.6 2000/08/21 04:48:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef VARBIT_H #ifndef VARBIT_H
#define VARBIT_H #define VARBIT_H
#include "postgres.h" #include "fmgr.h"
#include <math.h> /*
#include <limits.h> * Modeled on struct varlena from postgres.h, but data type is bits8.
*/
#include "utils/builtins.h" typedef struct
#define HEXDIG(z) ((z)<10 ? ((z)+'0') : ((z)-10+'A'))
/* Modeled on struct varlena from postgres.h, but data type is bits8 */
struct varbita
{ {
int32 vl_len; int32 vl_len; /* standard varlena header (total size in bytes) */
bits8 vl_dat[1]; int32 bit_len; /* number of valid bits */
}; bits8 bit_dat[1]; /* bit string, most sig. byte first */
} VarBit;
/*
* fmgr interface macros
*
* BIT and BIT VARYING are toastable varlena types. They are the same
* as far as representation goes, so we just have one set of macros.
*/
#define DatumGetVarBitP(X) ((VarBit *) PG_DETOAST_DATUM(X))
#define DatumGetVarBitPCopy(X) ((VarBit *) PG_DETOAST_DATUM_COPY(X))
#define VarBitPGetDatum(X) PointerGetDatum(X)
#define PG_GETARG_VARBIT_P(n) DatumGetVarBitP(PG_GETARG_DATUM(n))
#define PG_GETARG_VARBIT_P_COPY(n) DatumGetVarBitPCopy(PG_GETARG_DATUM(n))
#define PG_RETURN_VARBIT_P(x) return VarBitPGetDatum(x)
#define VARBITHDRSZ sizeof(int32) /* Header overhead *in addition to* VARHDRSZ */
#define VARBITHDRSZ sizeof(int32)
/* Number of bits in this bit string */ /* Number of bits in this bit string */
#define VARBITLEN(PTR) (((struct varbita *)VARDATA(PTR))->vl_len) #define VARBITLEN(PTR) (((VarBit *) (PTR))->bit_len)
/* Pointer tp the first byte containing bit string data */ /* Pointer to the first byte containing bit string data */
#define VARBITS(PTR) (((struct varbita *)VARDATA(PTR))->vl_dat) #define VARBITS(PTR) (((VarBit *) (PTR))->bit_dat)
/* Number of bytes in the data section of a bit string */ /* Number of bytes in the data section of a bit string */
#define VARBITBYTES(PTR) (VARSIZE(PTR) - VARHDRSZ - VARBITHDRSZ) #define VARBITBYTES(PTR) (VARSIZE(PTR) - VARHDRSZ - VARBITHDRSZ)
/* Padding of the bit string at the end */ /* Padding of the bit string at the end (in bits) */
#define VARBITPAD(PTR) (VARBITBYTES(PTR)*BITSPERBYTE - VARBITLEN(PTR)) #define VARBITPAD(PTR) (VARBITBYTES(PTR)*BITSPERBYTE - VARBITLEN(PTR))
/* Number of bytes needed to store a bit string of a given length */ /* Number of bytes needed to store a bit string of a given length */
#define VARBITDATALEN(BITLEN) ((BITLEN)/BITSPERBYTE + \ #define VARBITTOTALLEN(BITLEN) (((BITLEN) + BITSPERBYTE-1)/BITSPERBYTE + \
((BITLEN)%BITSPERBYTE > 0 ? 1 : 0) + \ VARHDRSZ + VARBITHDRSZ)
VARHDRSZ + VARBITHDRSZ)
/* pointer beyond the end of the bit string (like end() in STL containers) */ /* pointer beyond the end of the bit string (like end() in STL containers) */
#define VARBITEND(PTR) ((bits8 *) (PTR + VARSIZE(PTR))) #define VARBITEND(PTR) (((bits8 *) (PTR)) + VARSIZE(PTR))
/* Mask that will cover exactly one byte, i.e. BITSPERBYTE bits */ /* Mask that will cover exactly one byte, i.e. BITSPERBYTE bits */
#define BITMASK 0xFF #define BITMASK 0xFF
#define BITHIGH 0x80 #define BITHIGH 0x80
bits8 *zpbit_in(char *s, int dummy, int32 atttypmod); extern Datum zpbit_in(PG_FUNCTION_ARGS);
char *zpbit_out(bits8 *s); extern Datum zpbit_out(PG_FUNCTION_ARGS);
char *zpbits_out(bits8 *s); extern Datum varbit_in(PG_FUNCTION_ARGS);
bits8 *varbit_in(char *s, int dummy, int32 atttypmod); extern Datum varbit_out(PG_FUNCTION_ARGS);
char *varbit_out(bits8 *s); extern Datum zpbit(PG_FUNCTION_ARGS);
bool biteq(bits8 *arg1, bits8 *arg2); extern Datum _zpbit(PG_FUNCTION_ARGS);
bool bitne(bits8 *arg1, bits8 *arg2); extern Datum varbit(PG_FUNCTION_ARGS);
bool bitge(bits8 *arg1, bits8 *arg2); extern Datum _varbit(PG_FUNCTION_ARGS);
bool bitgt(bits8 *arg1, bits8 *arg2); extern Datum biteq(PG_FUNCTION_ARGS);
bool bitle(bits8 *arg1, bits8 *arg2); extern Datum bitne(PG_FUNCTION_ARGS);
bool bitlt(bits8 *arg1, bits8 *arg2); extern Datum bitlt(PG_FUNCTION_ARGS);
int bitcmp(bits8 *arg1, bits8 *arg2); extern Datum bitle(PG_FUNCTION_ARGS);
bits8 *bitand(bits8 *arg1, bits8 *arg2); extern Datum bitgt(PG_FUNCTION_ARGS);
bits8 *bitor(bits8 *arg1, bits8 *arg2); extern Datum bitge(PG_FUNCTION_ARGS);
bits8 *bitxor(bits8 *arg1, bits8 *arg2); extern Datum bitcmp(PG_FUNCTION_ARGS);
bits8 *bitnot(bits8 *arg); extern Datum bitand(PG_FUNCTION_ARGS);
bits8 *bitshiftright(bits8 *arg, int shft); extern Datum bitor(PG_FUNCTION_ARGS);
bits8 *bitshiftleft(bits8 *arg, int shft); extern Datum bitxor(PG_FUNCTION_ARGS);
bits8 *bitcat(bits8 *arg1, bits8 *arg2); extern Datum bitnot(PG_FUNCTION_ARGS);
bits8 *bitsubstr(bits8 *arg, int32 s, int32 l); extern Datum bitshiftleft(PG_FUNCTION_ARGS);
extern Datum bitshiftright(PG_FUNCTION_ARGS);
bool varbiteq(bits8 *arg1, bits8 *arg2); extern Datum bitcat(PG_FUNCTION_ARGS);
bool varbitne(bits8 *arg1, bits8 *arg2); extern Datum bitsubstr(PG_FUNCTION_ARGS);
bool varbitge(bits8 *arg1, bits8 *arg2); extern Datum bitlength(PG_FUNCTION_ARGS);
bool varbitgt(bits8 *arg1, bits8 *arg2); extern Datum bitoctetlength(PG_FUNCTION_ARGS);
bool varbitle(bits8 *arg1, bits8 *arg2); extern Datum bitfromint4(PG_FUNCTION_ARGS);
bool varbitlt(bits8 *arg1, bits8 *arg2); extern Datum bittoint4(PG_FUNCTION_ARGS);
int varbitcmp(bits8 *arg1, bits8 *arg2);
bits8 *varbitand(bits8 *arg1, bits8 *arg2);
bits8 *varbitor(bits8 *arg1, bits8 *arg2);
bits8 *varbitxor(bits8 *arg1, bits8 *arg2);
bits8 *varbitnot(bits8 *arg);
bits8 *varbitshiftright(bits8 *arg, int shft);
bits8 *varbitshiftleft(bits8 *arg, int shft);
bits8 *varbitcat(bits8 *arg1, bits8 *arg2);
bits8 *varbitsubstr(bits8 *arg, int32 s, int32 l);
#endif #endif
...@@ -97,7 +97,8 @@ WHERE p1.oid != p2.oid AND ...@@ -97,7 +97,8 @@ WHERE p1.oid != p2.oid AND
proargtypes | proargtypes proargtypes | proargtypes
-------------+------------- -------------+-------------
25 | 1043 25 | 1043
(1 row) 1560 | 1562
(2 rows)
SELECT DISTINCT p1.proargtypes[1], p2.proargtypes[1] SELECT DISTINCT p1.proargtypes[1], p2.proargtypes[1]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
...@@ -108,7 +109,8 @@ WHERE p1.oid != p2.oid AND ...@@ -108,7 +109,8 @@ WHERE p1.oid != p2.oid AND
(p1.proargtypes[1] < p2.proargtypes[1]); (p1.proargtypes[1] < p2.proargtypes[1]);
proargtypes | proargtypes proargtypes | proargtypes
-------------+------------- -------------+-------------
(0 rows) 1560 | 1562
(1 row)
SELECT DISTINCT p1.proargtypes[2], p2.proargtypes[2] SELECT DISTINCT p1.proargtypes[2], p2.proargtypes[2]
FROM pg_proc AS p1, pg_proc AS p2 FROM pg_proc AS p1, pg_proc AS p2
...@@ -480,8 +482,8 @@ WHERE p1.aggtransfn = p2.oid AND ...@@ -480,8 +482,8 @@ WHERE p1.aggtransfn = p2.oid AND
(p2.pronargs = 1 AND p1.aggbasetype = 0))); (p2.pronargs = 1 AND p1.aggbasetype = 0)));
oid | aggname | oid | proname oid | aggname | oid | proname
-------+---------+-----+------------- -------+---------+-----+-------------
16972 | max | 768 | int4larger 16984 | max | 768 | int4larger
16986 | min | 769 | int4smaller 16998 | min | 769 | int4smaller
(2 rows) (2 rows)
-- Cross-check finalfn (if present) against its entry in pg_proc. -- Cross-check finalfn (if present) against its entry in pg_proc.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment