From: Thomas G. Lockhart Date: Tue, 8 Dec 1998 06:18:34 +0000 (+0000) Subject: Define routines and catalog entries for string min()/max() functions. X-Git-Tag: REL6_5~936 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9470ab03c93ce4959c86cf1b61feac49a7901099;p=postgresql Define routines and catalog entries for string min()/max() functions. Extend new type coersion techniques to aggregates. --- diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index a4acb012f8..e2f84d636b 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_aggregate.h,v 1.17 1998/09/01 04:34:45 momjian Exp $ + * $Id: pg_aggregate.h,v 1.18 1998/12/08 06:18:11 thomas Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -115,6 +115,7 @@ DATA(insert OID = 0 ( max PGUID float8larger - - 1084 1084 0 1084 _null_ _null_ DATA(insert OID = 0 ( max PGUID cashlarger - - 790 790 0 790 _null_ _null_ )); DATA(insert OID = 0 ( max PGUID datetime_larger - - 1184 1184 0 1184 _null_ _null_ )); DATA(insert OID = 0 ( max PGUID timespan_larger - - 1186 1186 0 1186 _null_ _null_ )); +DATA(insert OID = 0 ( max PGUID text_larger - - 25 25 0 25 _null_ _null_ )); DATA(insert OID = 0 ( min PGUID int8smaller - - 20 20 0 20 _null_ _null_ )); DATA(insert OID = 0 ( min PGUID int4smaller - - 23 23 0 23 _null_ _null_ )); @@ -127,6 +128,7 @@ DATA(insert OID = 0 ( min PGUID float8smaller - - 1084 1084 0 1084 _null_ _null DATA(insert OID = 0 ( min PGUID cashsmaller - - 790 790 0 790 _null_ _null_ )); DATA(insert OID = 0 ( min PGUID datetime_smaller - - 1184 1184 0 1184 _null_ _null_ )); DATA(insert OID = 0 ( min PGUID timespan_smaller - - 1186 1186 0 1186 _null_ _null_ )); +DATA(insert OID = 0 ( min PGUID text_smaller - - 25 25 0 25 _null_ _null_ )); DATA(insert OID = 0 ( count PGUID - int4inc - 0 0 23 23 _null_ 0 )); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index a53c2bc978..66cd7ec985 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_proc.h,v 1.84 1998/11/17 14:36:51 thomas Exp $ + * $Id: pg_proc.h,v 1.85 1998/12/08 06:18:11 thomas Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -435,11 +435,11 @@ DESCR("subtract"); DATA(insert OID = 207 ( float4abs PGUID 11 f t f 1 f 700 "700 700" 100 0 0 100 foo bar )); DESCR("absolute value"); DATA(insert OID = 208 ( float4inc PGUID 11 f t f 1 f 700 "700" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("increment"); DATA(insert OID = 209 ( float4larger PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("larger of two"); DATA(insert OID = 211 ( float4smaller PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("smaller of two"); DATA(insert OID = 212 ( int4um PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); DESCR("subtract"); @@ -463,11 +463,11 @@ DESCR("subtract"); DATA(insert OID = 221 ( float8abs PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); DESCR("absolute value"); DATA(insert OID = 222 ( float8inc PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("increment"); DATA(insert OID = 223 ( float8larger PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("larger of two"); DATA(insert OID = 224 ( float8smaller PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("smaller of two"); DATA(insert OID = 225 ( lseg_center PGUID 11 f t f 1 f 600 "601" 100 0 0 100 foo bar )); DESCR("center of"); @@ -827,14 +827,18 @@ DATA(insert OID = 452 ( hashfloat8 PGUID 11 f t f 2 f 23 "701 701" 100 0 0 DESCR("hash"); DATA(insert OID = 453 ( hashoid PGUID 11 f t f 2 f 23 "26 26" 100 0 0 100 foo bar )); DESCR("hash"); -DATA(insert OID = 457 ( hashoid8 PGUID 11 f t f 2 f 23 "30 30" 100 0 0 100 foo bar )); -DESCR("hash"); DATA(insert OID = 454 ( hashchar PGUID 11 f t f 2 f 23 "18 18" 100 0 0 100 foo bar )); DESCR("hash"); DATA(insert OID = 455 ( hashname PGUID 11 f t f 2 f 23 "19 19" 100 0 0 100 foo bar )); DESCR("hash"); DATA(insert OID = 456 ( hashtext PGUID 11 f t f 2 f 23 "25 25" 100 0 0 100 foo bar )); DESCR("hash"); +DATA(insert OID = 457 ( hashoid8 PGUID 11 f t f 2 f 23 "30 30" 100 0 0 100 foo bar )); +DESCR("hash"); +DATA(insert OID = 458 ( text_larger PGUID 11 f t f 2 f 25 "25 25" 100 0 0 100 foo bar )); +DESCR("larger of two"); +DATA(insert OID = 459 ( text_smaller PGUID 11 f t f 2 f 25 "25 25" 100 0 0 100 foo bar )); +DESCR("smaller of two"); DATA(insert OID = 460 ( int8in PGUID 11 f t f 1 f 20 "0" 100 0 0 100 foo bar )); DESCR("(internal)"); @@ -1011,9 +1015,9 @@ DATA(insert OID = 765 ( lo_export PGUID 11 f t f 2 f 23 "26 25" 100 0 0 100 DESCR("large object export"); DATA(insert OID = 766 ( int4inc PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("increment"); DATA(insert OID = 767 ( int2inc PGUID 11 f t f 1 f 21 "21" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("increment"); DATA(insert OID = 768 ( int4larger PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); DESCR("larger of two"); DATA(insert OID = 769 ( int4smaller PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); @@ -1153,9 +1157,9 @@ DESCR("multiply"); DATA(insert OID = 897 ( cash_div_flt8 PGUID 11 f t f 2 f 790 "790 701" 100 0 0 100 foo bar )); DESCR("divide"); DATA(insert OID = 898 ( cashlarger PGUID 11 f t f 2 f 790 "790 790" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("larger of two"); DATA(insert OID = 899 ( cashsmaller PGUID 11 f t f 2 f 790 "790 790" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("smaller of two"); DATA(insert OID = 919 ( flt8_mul_cash PGUID 11 f t f 2 f 790 "701 790" 100 0 0 100 foo bar )); DESCR("multiply"); @@ -1352,9 +1356,9 @@ DESCR("not equal"); DATA(insert OID = 1107 ( time_cmp PGUID 11 f t f 2 f 23 "1083 1083" 100 0 0 100 foo bar )); DESCR("less-equal-greater"); DATA(insert OID = 1138 ( date_larger PGUID 11 f t f 2 f 1082 "1082 1082" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("larger of two"); DATA(insert OID = 1139 ( date_smaller PGUID 11 f t f 2 f 1082 "1082 1082" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("smaller of two"); DATA(insert OID = 1140 ( date_mi PGUID 11 f t f 2 f 23 "1082 1082" 100 0 0 100 foo bar )); DESCR("subtract"); DATA(insert OID = 1141 ( date_pli PGUID 11 f t f 2 f 1082 "1082 23" 100 0 0 100 foo bar )); @@ -1457,13 +1461,13 @@ DESCR("convert"); DATA(insert OID = 1194 ( timespan_reltime PGUID 11 f t f 1 f 703 "1186" 100 0 0 100 foo bar )); DESCR("convert"); DATA(insert OID = 1195 ( datetime_smaller PGUID 11 f t f 2 f 1184 "1184 1184" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("smaller of two"); DATA(insert OID = 1196 ( datetime_larger PGUID 11 f t f 2 f 1184 "1184 1184" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("larger of two"); DATA(insert OID = 1197 ( timespan_smaller PGUID 11 f t f 2 f 1186 "1186 1186" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("smaller of two"); DATA(insert OID = 1198 ( timespan_larger PGUID 11 f t f 2 f 1186 "1186 1186" 100 0 0 100 foo bar )); -DESCR(""); +DESCR("larger of two"); DATA(insert OID = 1199 ( datetime_age PGUID 11 f t f 2 f 1186 "1184 1184" 100 0 0 100 foo bar )); DESCR("date difference preserving months and years"); diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index a4933426be..e5cf03d6b3 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -1,12 +1,12 @@ /*------------------------------------------------------------------------- * - * catalog_utils.h-- + * parse_func.h-- * * * * Copyright (c) 1994, Regents of the University of California * - * $Id: parse_func.h,v 1.12 1998/10/08 18:30:38 momjian Exp $ + * $Id: parse_func.h,v 1.13 1998/12/08 06:18:27 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,14 @@ typedef struct _CandidateList struct _CandidateList *next; } *CandidateList; -extern Node *ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, +extern Node * +ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int *curr_resno, int precedence); -extern Node *ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, +extern Node * +ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, int *curr_resno, int precedence); extern void - func_error(char *caller, char *funcname, int nargs, Oid *argtypes, char *msg); +func_error(char *caller, char *funcname, int nargs, Oid *argtypes, char *msg); #endif /* PARSE_FUNC_H */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index f92cce6696..a87c0c9c86 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: builtins.h,v 1.70 1998/11/17 14:36:37 thomas Exp $ + * $Id: builtins.h,v 1.71 1998/12/08 06:18:34 thomas Exp $ * * NOTES * This should normally only be included by fmgr.h. @@ -447,6 +447,8 @@ extern bool text_lt(text *arg1, text *arg2); extern bool text_le(text *arg1, text *arg2); extern bool text_gt(text *arg1, text *arg2); extern bool text_ge(text *arg1, text *arg2); +extern text *text_larger(text *arg1, text *arg2); +extern text *text_smaller(text *arg1, text *arg2); extern int32 textlen(text *arg); extern int32 textoctetlen(text *arg); extern int32 textpos(text *arg1, text *arg2);