Header And Logo

PostgreSQL
| The world's most advanced open source database.

pg_aggregate.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * pg_aggregate.h
00004  *    definition of the system "aggregate" relation (pg_aggregate)
00005  *    along with the relation's initial contents.
00006  *
00007  *
00008  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00009  * Portions Copyright (c) 1994, Regents of the University of California
00010  *
00011  * src/include/catalog/pg_aggregate.h
00012  *
00013  * NOTES
00014  *    the genbki.pl script reads this file and generates .bki
00015  *    information from the DATA() statements.
00016  *
00017  *-------------------------------------------------------------------------
00018  */
00019 #ifndef PG_AGGREGATE_H
00020 #define PG_AGGREGATE_H
00021 
00022 #include "catalog/genbki.h"
00023 #include "nodes/pg_list.h"
00024 
00025 /* ----------------------------------------------------------------
00026  *      pg_aggregate definition.
00027  *
00028  *      cpp turns this into typedef struct FormData_pg_aggregate
00029  *
00030  *  aggfnoid            pg_proc OID of the aggregate itself
00031  *  aggtransfn          transition function
00032  *  aggfinalfn          final function (0 if none)
00033  *  aggsortop           associated sort operator (0 if none)
00034  *  aggtranstype        type of aggregate's transition (state) data
00035  *  agginitval          initial value for transition state (can be NULL)
00036  * ----------------------------------------------------------------
00037  */
00038 #define AggregateRelationId  2600
00039 
00040 CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS
00041 {
00042     regproc     aggfnoid;
00043     regproc     aggtransfn;
00044     regproc     aggfinalfn;
00045     Oid         aggsortop;
00046     Oid         aggtranstype;
00047 
00048 #ifdef CATALOG_VARLEN           /* variable-length fields start here */
00049     text        agginitval;
00050 #endif
00051 } FormData_pg_aggregate;
00052 
00053 /* ----------------
00054  *      Form_pg_aggregate corresponds to a pointer to a tuple with
00055  *      the format of pg_aggregate relation.
00056  * ----------------
00057  */
00058 typedef FormData_pg_aggregate *Form_pg_aggregate;
00059 
00060 /* ----------------
00061  *      compiler constants for pg_aggregate
00062  * ----------------
00063  */
00064 
00065 #define Natts_pg_aggregate              6
00066 #define Anum_pg_aggregate_aggfnoid      1
00067 #define Anum_pg_aggregate_aggtransfn    2
00068 #define Anum_pg_aggregate_aggfinalfn    3
00069 #define Anum_pg_aggregate_aggsortop     4
00070 #define Anum_pg_aggregate_aggtranstype  5
00071 #define Anum_pg_aggregate_agginitval    6
00072 
00073 
00074 /* ----------------
00075  * initial contents of pg_aggregate
00076  * ---------------
00077  */
00078 
00079 /* avg */
00080 DATA(insert ( 2100  int8_avg_accum  numeric_avg     0   1231    "{0,0}" ));
00081 DATA(insert ( 2101  int4_avg_accum  int8_avg        0   1016    "{0,0}" ));
00082 DATA(insert ( 2102  int2_avg_accum  int8_avg        0   1016    "{0,0}" ));
00083 DATA(insert ( 2103  numeric_avg_accum   numeric_avg     0   1231    "{0,0}" ));
00084 DATA(insert ( 2104  float4_accum    float8_avg      0   1022    "{0,0,0}" ));
00085 DATA(insert ( 2105  float8_accum    float8_avg      0   1022    "{0,0,0}" ));
00086 DATA(insert ( 2106  interval_accum  interval_avg    0   1187    "{0 second,0 second}" ));
00087 
00088 /* sum */
00089 DATA(insert ( 2107  int8_sum        -               0   1700    _null_ ));
00090 DATA(insert ( 2108  int4_sum        -               0   20      _null_ ));
00091 DATA(insert ( 2109  int2_sum        -               0   20      _null_ ));
00092 DATA(insert ( 2110  float4pl        -               0   700     _null_ ));
00093 DATA(insert ( 2111  float8pl        -               0   701     _null_ ));
00094 DATA(insert ( 2112  cash_pl         -               0   790     _null_ ));
00095 DATA(insert ( 2113  interval_pl     -               0   1186    _null_ ));
00096 DATA(insert ( 2114  numeric_add     -               0   1700    _null_ ));
00097 
00098 /* max */
00099 DATA(insert ( 2115  int8larger      -               413     20      _null_ ));
00100 DATA(insert ( 2116  int4larger      -               521     23      _null_ ));
00101 DATA(insert ( 2117  int2larger      -               520     21      _null_ ));
00102 DATA(insert ( 2118  oidlarger       -               610     26      _null_ ));
00103 DATA(insert ( 2119  float4larger    -               623     700     _null_ ));
00104 DATA(insert ( 2120  float8larger    -               674     701     _null_ ));
00105 DATA(insert ( 2121  int4larger      -               563     702     _null_ ));
00106 DATA(insert ( 2122  date_larger     -               1097    1082    _null_ ));
00107 DATA(insert ( 2123  time_larger     -               1112    1083    _null_ ));
00108 DATA(insert ( 2124  timetz_larger   -               1554    1266    _null_ ));
00109 DATA(insert ( 2125  cashlarger      -               903     790     _null_ ));
00110 DATA(insert ( 2126  timestamp_larger    -           2064    1114    _null_ ));
00111 DATA(insert ( 2127  timestamptz_larger  -           1324    1184    _null_ ));
00112 DATA(insert ( 2128  interval_larger -               1334    1186    _null_ ));
00113 DATA(insert ( 2129  text_larger     -               666     25      _null_ ));
00114 DATA(insert ( 2130  numeric_larger  -               1756    1700    _null_ ));
00115 DATA(insert ( 2050  array_larger    -               1073    2277    _null_ ));
00116 DATA(insert ( 2244  bpchar_larger   -               1060    1042    _null_ ));
00117 DATA(insert ( 2797  tidlarger       -               2800    27      _null_ ));
00118 DATA(insert ( 3526  enum_larger     -               3519    3500    _null_ ));
00119 
00120 /* min */
00121 DATA(insert ( 2131  int8smaller     -               412     20      _null_ ));
00122 DATA(insert ( 2132  int4smaller     -               97      23      _null_ ));
00123 DATA(insert ( 2133  int2smaller     -               95      21      _null_ ));
00124 DATA(insert ( 2134  oidsmaller      -               609     26      _null_ ));
00125 DATA(insert ( 2135  float4smaller   -               622     700     _null_ ));
00126 DATA(insert ( 2136  float8smaller   -               672     701     _null_ ));
00127 DATA(insert ( 2137  int4smaller     -               562     702     _null_ ));
00128 DATA(insert ( 2138  date_smaller    -               1095    1082    _null_ ));
00129 DATA(insert ( 2139  time_smaller    -               1110    1083    _null_ ));
00130 DATA(insert ( 2140  timetz_smaller  -               1552    1266    _null_ ));
00131 DATA(insert ( 2141  cashsmaller     -               902     790     _null_ ));
00132 DATA(insert ( 2142  timestamp_smaller   -           2062    1114    _null_ ));
00133 DATA(insert ( 2143  timestamptz_smaller -           1322    1184    _null_ ));
00134 DATA(insert ( 2144  interval_smaller    -           1332    1186    _null_ ));
00135 DATA(insert ( 2145  text_smaller    -               664     25      _null_ ));
00136 DATA(insert ( 2146  numeric_smaller -               1754    1700    _null_ ));
00137 DATA(insert ( 2051  array_smaller   -               1072    2277    _null_ ));
00138 DATA(insert ( 2245  bpchar_smaller  -               1058    1042    _null_ ));
00139 DATA(insert ( 2798  tidsmaller      -               2799    27      _null_ ));
00140 DATA(insert ( 3527  enum_smaller    -               3518    3500    _null_ ));
00141 
00142 /* count */
00143 DATA(insert ( 2147  int8inc_any     -               0       20      "0" ));
00144 DATA(insert ( 2803  int8inc         -               0       20      "0" ));
00145 
00146 /* var_pop */
00147 DATA(insert ( 2718  int8_accum  numeric_var_pop 0   1231    "{0,0,0}" ));
00148 DATA(insert ( 2719  int4_accum  numeric_var_pop 0   1231    "{0,0,0}" ));
00149 DATA(insert ( 2720  int2_accum  numeric_var_pop 0   1231    "{0,0,0}" ));
00150 DATA(insert ( 2721  float4_accum    float8_var_pop 0    1022    "{0,0,0}" ));
00151 DATA(insert ( 2722  float8_accum    float8_var_pop 0    1022    "{0,0,0}" ));
00152 DATA(insert ( 2723  numeric_accum  numeric_var_pop 0    1231    "{0,0,0}" ));
00153 
00154 /* var_samp */
00155 DATA(insert ( 2641  int8_accum  numeric_var_samp    0   1231    "{0,0,0}" ));
00156 DATA(insert ( 2642  int4_accum  numeric_var_samp    0   1231    "{0,0,0}" ));
00157 DATA(insert ( 2643  int2_accum  numeric_var_samp    0   1231    "{0,0,0}" ));
00158 DATA(insert ( 2644  float4_accum    float8_var_samp 0   1022    "{0,0,0}" ));
00159 DATA(insert ( 2645  float8_accum    float8_var_samp 0   1022    "{0,0,0}" ));
00160 DATA(insert ( 2646  numeric_accum  numeric_var_samp 0   1231    "{0,0,0}" ));
00161 
00162 /* variance: historical Postgres syntax for var_samp */
00163 DATA(insert ( 2148  int8_accum  numeric_var_samp    0   1231    "{0,0,0}" ));
00164 DATA(insert ( 2149  int4_accum  numeric_var_samp    0   1231    "{0,0,0}" ));
00165 DATA(insert ( 2150  int2_accum  numeric_var_samp    0   1231    "{0,0,0}" ));
00166 DATA(insert ( 2151  float4_accum    float8_var_samp 0   1022    "{0,0,0}" ));
00167 DATA(insert ( 2152  float8_accum    float8_var_samp 0   1022    "{0,0,0}" ));
00168 DATA(insert ( 2153  numeric_accum  numeric_var_samp 0   1231    "{0,0,0}" ));
00169 
00170 /* stddev_pop */
00171 DATA(insert ( 2724  int8_accum  numeric_stddev_pop      0   1231    "{0,0,0}" ));
00172 DATA(insert ( 2725  int4_accum  numeric_stddev_pop      0   1231    "{0,0,0}" ));
00173 DATA(insert ( 2726  int2_accum  numeric_stddev_pop      0   1231    "{0,0,0}" ));
00174 DATA(insert ( 2727  float4_accum    float8_stddev_pop   0   1022    "{0,0,0}" ));
00175 DATA(insert ( 2728  float8_accum    float8_stddev_pop   0   1022    "{0,0,0}" ));
00176 DATA(insert ( 2729  numeric_accum   numeric_stddev_pop  0   1231    "{0,0,0}" ));
00177 
00178 /* stddev_samp */
00179 DATA(insert ( 2712  int8_accum  numeric_stddev_samp     0   1231    "{0,0,0}" ));
00180 DATA(insert ( 2713  int4_accum  numeric_stddev_samp     0   1231    "{0,0,0}" ));
00181 DATA(insert ( 2714  int2_accum  numeric_stddev_samp     0   1231    "{0,0,0}" ));
00182 DATA(insert ( 2715  float4_accum    float8_stddev_samp  0   1022    "{0,0,0}" ));
00183 DATA(insert ( 2716  float8_accum    float8_stddev_samp  0   1022    "{0,0,0}" ));
00184 DATA(insert ( 2717  numeric_accum   numeric_stddev_samp 0   1231    "{0,0,0}" ));
00185 
00186 /* stddev: historical Postgres syntax for stddev_samp */
00187 DATA(insert ( 2154  int8_accum  numeric_stddev_samp     0   1231    "{0,0,0}" ));
00188 DATA(insert ( 2155  int4_accum  numeric_stddev_samp     0   1231    "{0,0,0}" ));
00189 DATA(insert ( 2156  int2_accum  numeric_stddev_samp     0   1231    "{0,0,0}" ));
00190 DATA(insert ( 2157  float4_accum    float8_stddev_samp  0   1022    "{0,0,0}" ));
00191 DATA(insert ( 2158  float8_accum    float8_stddev_samp  0   1022    "{0,0,0}" ));
00192 DATA(insert ( 2159  numeric_accum   numeric_stddev_samp 0   1231    "{0,0,0}" ));
00193 
00194 /* SQL2003 binary regression aggregates */
00195 DATA(insert ( 2818  int8inc_float8_float8       -               0   20      "0" ));
00196 DATA(insert ( 2819  float8_regr_accum   float8_regr_sxx         0   1022    "{0,0,0,0,0,0}" ));
00197 DATA(insert ( 2820  float8_regr_accum   float8_regr_syy         0   1022    "{0,0,0,0,0,0}" ));
00198 DATA(insert ( 2821  float8_regr_accum   float8_regr_sxy         0   1022    "{0,0,0,0,0,0}" ));
00199 DATA(insert ( 2822  float8_regr_accum   float8_regr_avgx        0   1022    "{0,0,0,0,0,0}" ));
00200 DATA(insert ( 2823  float8_regr_accum   float8_regr_avgy        0   1022    "{0,0,0,0,0,0}" ));
00201 DATA(insert ( 2824  float8_regr_accum   float8_regr_r2          0   1022    "{0,0,0,0,0,0}" ));
00202 DATA(insert ( 2825  float8_regr_accum   float8_regr_slope       0   1022    "{0,0,0,0,0,0}" ));
00203 DATA(insert ( 2826  float8_regr_accum   float8_regr_intercept   0   1022    "{0,0,0,0,0,0}" ));
00204 DATA(insert ( 2827  float8_regr_accum   float8_covar_pop        0   1022    "{0,0,0,0,0,0}" ));
00205 DATA(insert ( 2828  float8_regr_accum   float8_covar_samp       0   1022    "{0,0,0,0,0,0}" ));
00206 DATA(insert ( 2829  float8_regr_accum   float8_corr             0   1022    "{0,0,0,0,0,0}" ));
00207 
00208 /* boolean-and and boolean-or */
00209 DATA(insert ( 2517  booland_statefunc   -           58  16      _null_ ));
00210 DATA(insert ( 2518  boolor_statefunc    -           59  16      _null_ ));
00211 DATA(insert ( 2519  booland_statefunc   -           58  16      _null_ ));
00212 
00213 /* bitwise integer */
00214 DATA(insert ( 2236 int2and        -                 0   21      _null_ ));
00215 DATA(insert ( 2237 int2or         -                 0   21      _null_ ));
00216 DATA(insert ( 2238 int4and        -                 0   23      _null_ ));
00217 DATA(insert ( 2239 int4or         -                 0   23      _null_ ));
00218 DATA(insert ( 2240 int8and        -                 0   20      _null_ ));
00219 DATA(insert ( 2241 int8or         -                 0   20      _null_ ));
00220 DATA(insert ( 2242 bitand         -                 0   1560    _null_ ));
00221 DATA(insert ( 2243 bitor          -                 0   1560    _null_ ));
00222 
00223 /* xml */
00224 DATA(insert ( 2901 xmlconcat2     -                 0   142     _null_ ));
00225 
00226 /* array */
00227 DATA(insert ( 2335  array_agg_transfn   array_agg_finalfn       0   2281    _null_ ));
00228 
00229 /* text */
00230 DATA(insert ( 3538  string_agg_transfn  string_agg_finalfn      0   2281    _null_ ));
00231 
00232 /* bytea */
00233 DATA(insert ( 3545  bytea_string_agg_transfn    bytea_string_agg_finalfn        0   2281    _null_ ));
00234 
00235 /* json */
00236 DATA(insert ( 3175  json_agg_transfn    json_agg_finalfn        0   2281    _null_ ));
00237 
00238 /*
00239  * prototypes for functions in pg_aggregate.c
00240  */
00241 extern Oid AggregateCreate(const char *aggName,
00242                 Oid aggNamespace,
00243                 Oid *aggArgTypes,
00244                 int numArgs,
00245                 List *aggtransfnName,
00246                 List *aggfinalfnName,
00247                 List *aggsortopName,
00248                 Oid aggTransType,
00249                 const char *agginitval);
00250 
00251 #endif   /* PG_AGGREGATE_H */