Lists: | Postg토토 핫SQL : |
---|
From: | Marko Kreen <marko(at)l-t(dot)ee> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | unary plus |
Date: | 2001-06-01 19:52:42 |
Message-ID: | 20010601215242.A26437@l-t.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | Postg토토 핫SQL : |
This is unary plus. One time somebody complained about it,
then some time later thought about it and implemented it.
--
marko
Index: src/backend/parser/gram.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.227
diff -c -r2.227 gram.y
*** src/backend/parser/gram.y 2001/05/27 09:59:29 2.227
--- src/backend/parser/gram.y 2001/06/01 19:30:43
***************
*** 93,98 ****
--- 93,99 ----
static bool exprIsNullConstant(Node *arg);
static Node *doNegate(Node *n);
static void doNegateFloat(Value *v);
+ static Node *doUnaryPlus(Node *n);
%}
***************
*** 4352,4358 ****
* also to b_expr and to the MathOp list above.
*/
| '+' a_expr %prec UMINUS
! { $$ = makeA_Expr(OP, "+", NULL, $2); }
| '-' a_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' a_expr
--- 4353,4359 ----
* also to b_expr and to the MathOp list above.
*/
| '+' a_expr %prec UMINUS
! { $$ = doUnaryPlus($2); }
| '-' a_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' a_expr
***************
*** 4600,4606 ****
| b_expr TYPECAST Typename
{ $$ = makeTypeCast($1, $3); }
| '+' b_expr %prec UMINUS
! { $$ = makeA_Expr(OP, "+", NULL, $2); }
| '-' b_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' b_expr
--- 4601,4607 ----
| b_expr TYPECAST Typename
{ $$ = makeTypeCast($1, $3); }
| '+' b_expr %prec UMINUS
! { $$ = doUnaryPlus($2); }
| '-' b_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' b_expr
***************
*** 6074,6076 ****
--- 6075,6093 ----
v->val.str = newval;
}
}
+
+ static Node *
+ doUnaryPlus(Node *n)
+ {
+ if (IsA(n, A_Const))
+ {
+ A_Const *con = (A_Const *)n;
+
+ if (con->val.type == T_Integer
+ || con->val.type == T_Float)
+ return n;
+ }
+ return makeA_Expr(OP, "+", NULL, n);
+ }
+
+
Index: src/backend/utils/adt/float.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.71
diff -c -r1.71 float.c
*** src/backend/utils/adt/float.c 2001/05/03 19:00:36 1.71
--- src/backend/utils/adt/float.c 2001/06/01 19:30:47
***************
*** 15,23 ****
/*----------
* OLD COMMENTS
* Basic float4 ops:
! * float4in, float4out, float4abs, float4um
* Basic float8 ops:
! * float8in, float8out, float8abs, float8um
* Arithmetic operators:
* float4pl, float4mi, float4mul, float4div
* float8pl, float8mi, float8mul, float8div
--- 15,23 ----
/*----------
* OLD COMMENTS
* Basic float4 ops:
! * float4in, float4out, float4abs, float4um, float4up
* Basic float8 ops:
! * float8in, float8out, float8abs, float8um, float8up
* Arithmetic operators:
* float4pl, float4mi, float4mul, float4div
* float8pl, float8mi, float8mul, float8div
***************
*** 324,329 ****
--- 324,336 ----
}
Datum
+ float4up(PG_FUNCTION_ARGS)
+ {
+ float4 arg = PG_GETARG_FLOAT4(0);
+ PG_RETURN_FLOAT4(arg);
+ }
+
+ Datum
float4larger(PG_FUNCTION_ARGS)
{
float4 arg1 = PG_GETARG_FLOAT4(0);
***************
*** 380,385 ****
--- 387,399 ----
CheckFloat8Val(result);
PG_RETURN_FLOAT8(result);
+ }
+
+ Datum
+ float8up(PG_FUNCTION_ARGS)
+ {
+ float8 arg = PG_GETARG_FLOAT8(0);
+ PG_RETURN_FLOAT8(arg);
}
Datum
Index: src/backend/utils/adt/int.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int.c,v
retrieving revision 1.46
diff -c -r1.46 int.c
*** src/backend/utils/adt/int.c 2001/03/22 03:59:51 1.46
--- src/backend/utils/adt/int.c 2001/06/01 19:30:47
***************
*** 564,569 ****
--- 564,577 ----
}
Datum
+ int4up(PG_FUNCTION_ARGS)
+ {
+ int32 arg = PG_GETARG_INT32(0);
+
+ PG_RETURN_INT32(arg);
+ }
+
+ Datum
int4pl(PG_FUNCTION_ARGS)
{
int32 arg1 = PG_GETARG_INT32(0);
***************
*** 613,618 ****
--- 621,634 ----
int16 arg = PG_GETARG_INT16(0);
PG_RETURN_INT16(-arg);
+ }
+
+ Datum
+ int2up(PG_FUNCTION_ARGS)
+ {
+ int16 arg = PG_GETARG_INT16(0);
+
+ PG_RETURN_INT16(arg);
}
Datum
Index: src/backend/utils/adt/int8.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int8.c,v
retrieving revision 1.29
diff -c -r1.29 int8.c
*** src/backend/utils/adt/int8.c 2001/03/22 03:59:51 1.29
--- src/backend/utils/adt/int8.c 2001/06/01 19:30:48
***************
*** 413,418 ****
--- 413,426 ----
}
Datum
+ int8up(PG_FUNCTION_ARGS)
+ {
+ int64 val = PG_GETARG_INT64(0);
+
+ PG_RETURN_INT64(val);
+ }
+
+ Datum
int8pl(PG_FUNCTION_ARGS)
{
int64 val1 = PG_GETARG_INT64(0);
Index: src/backend/utils/adt/numeric.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/numeric.c,v
retrieving revision 1.41
diff -c -r1.41 numeric.c
*** src/backend/utils/adt/numeric.c 2001/05/03 19:00:36 1.41
--- src/backend/utils/adt/numeric.c 2001/06/01 19:30:53
***************
*** 406,411 ****
--- 406,424 ----
Datum
+ numeric_uplus(PG_FUNCTION_ARGS)
+ {
+ Numeric num = PG_GETARG_NUMERIC(0);
+ Numeric res;
+
+ res = (Numeric) palloc(num->varlen);
+ memcpy(res, num, num->varlen);
+
+ PG_RETURN_NUMERIC(res);
+ }
+
+
+ Datum
numeric_sign(PG_FUNCTION_ARGS)
{
Numeric num = PG_GETARG_NUMERIC(0);
Index: src/include/catalog/pg_operator.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
retrieving revision 1.88
diff -c -r1.88 pg_operator.h
*** src/include/catalog/pg_operator.h 2001/03/22 04:00:39 1.88
--- src/include/catalog/pg_operator.h 2001/06/01 19:30:57
***************
*** 794,799 ****
--- 794,806 ----
DATA(insert OID = 1890 ( "<<" PGUID 0 b t f 20 23 20 0 0 0 0 int8shl - - ));
DATA(insert OID = 1891 ( ">>" PGUID 0 b t f 20 23 20 0 0 0 0 int8shr - - ));
+ DATA(insert OID = 1916 ( "+" PGUID 0 l t f 0 20 20 0 0 0 0 int8up - - ));
+ DATA(insert OID = 1917 ( "+" PGUID 0 l t f 0 21 21 0 0 0 0 int2up - - ));
+ DATA(insert OID = 1918 ( "+" PGUID 0 l t f 0 23 23 0 0 0 0 int4up - - ));
+ DATA(insert OID = 1919 ( "+" PGUID 0 l t f 0 700 700 0 0 0 0 float4up - - ));
+ DATA(insert OID = 1920 ( "+" PGUID 0 l t f 0 701 701 0 0 0 0 float8up - - ));
+ DATA(insert OID = 1921 ( "+" PGUID 0 l t f 0 1700 1700 0 0 0 0 numeric_uplus - - ));
+
/*
* function prototypes
*/
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.188
diff -c -r1.188 pg_proc.h
*** src/include/catalog/pg_proc.h 2001/05/24 09:29:29 1.188
--- src/include/catalog/pg_proc.h 2001/06/01 19:31:05
***************
*** 2614,2619 ****
--- 2614,2632 ----
DATA(insert OID = 1909 ( int8shr PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int8shr - ));
DESCR("binary shift right");
+ DATA(insert OID = 1910 ( int8up PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1911 ( int2up PGUID 12 f t t t 1 f 21 "21" 100 0 0 100 int2up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1912 ( int4up PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1913 ( float4up PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1914 ( float8up PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1915 ( numeric_uplus PGUID 12 f t t t 1 f 1700 "1700" 100 0 0 100 numeric_uplus - ));
+ DESCR("unary plus");
+
/*
* prototypes for functions pg_proc.c
*/
Index: src/include/utils/builtins.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/builtins.h,v
retrieving revision 1.148
diff -c -r1.148 builtins.h
*** src/include/utils/builtins.h 2001/03/22 04:01:11 1.148
--- src/include/utils/builtins.h 2001/06/01 19:31:06
***************
*** 96,101 ****
--- 96,102 ----
extern Datum int42gt(PG_FUNCTION_ARGS);
extern Datum int42ge(PG_FUNCTION_ARGS);
extern Datum int4um(PG_FUNCTION_ARGS);
+ extern Datum int4up(PG_FUNCTION_ARGS);
extern Datum int4pl(PG_FUNCTION_ARGS);
extern Datum int4mi(PG_FUNCTION_ARGS);
extern Datum int4mul(PG_FUNCTION_ARGS);
***************
*** 103,108 ****
--- 104,110 ----
extern Datum int4abs(PG_FUNCTION_ARGS);
extern Datum int4inc(PG_FUNCTION_ARGS);
extern Datum int2um(PG_FUNCTION_ARGS);
+ extern Datum int2up(PG_FUNCTION_ARGS);
extern Datum int2pl(PG_FUNCTION_ARGS);
extern Datum int2mi(PG_FUNCTION_ARGS);
extern Datum int2mul(PG_FUNCTION_ARGS);
***************
*** 184,193 ****
--- 186,197 ----
extern Datum float8out(PG_FUNCTION_ARGS);
extern Datum float4abs(PG_FUNCTION_ARGS);
extern Datum float4um(PG_FUNCTION_ARGS);
+ extern Datum float4up(PG_FUNCTION_ARGS);
extern Datum float4larger(PG_FUNCTION_ARGS);
extern Datum float4smaller(PG_FUNCTION_ARGS);
extern Datum float8abs(PG_FUNCTION_ARGS);
extern Datum float8um(PG_FUNCTION_ARGS);
+ extern Datum float8up(PG_FUNCTION_ARGS);
extern Datum float8larger(PG_FUNCTION_ARGS);
extern Datum float8smaller(PG_FUNCTION_ARGS);
extern Datum float4pl(PG_FUNCTION_ARGS);
***************
*** 532,537 ****
--- 536,542 ----
extern Datum numeric(PG_FUNCTION_ARGS);
extern Datum numeric_abs(PG_FUNCTION_ARGS);
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
+ extern Datum numeric_uplus(PG_FUNCTION_ARGS);
extern Datum numeric_sign(PG_FUNCTION_ARGS);
extern Datum numeric_round(PG_FUNCTION_ARGS);
extern Datum numeric_trunc(PG_FUNCTION_ARGS);
Index: src/include/utils/int8.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/int8.h,v
retrieving revision 1.25
diff -c -r1.25 int8.h
*** src/include/utils/int8.h 2001/01/24 19:43:28 1.25
--- src/include/utils/int8.h 2001/06/01 19:31:07
***************
*** 66,71 ****
--- 66,72 ----
extern Datum int28ge(PG_FUNCTION_ARGS);
extern Datum int8um(PG_FUNCTION_ARGS);
+ extern Datum int8up(PG_FUNCTION_ARGS);
extern Datum int8pl(PG_FUNCTION_ARGS);
extern Datum int8mi(PG_FUNCTION_ARGS);
extern Datum int8mul(PG_FUNCTION_ARGS);
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Marko Kreen <marko(at)l-t(dot)ee> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: unary plus |
Date: | 2001-06-01 21:09:26 |
Message-ID: | 8294.991429766@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Marko Kreen <marko(at)l-t(dot)ee> writes:
> This is unary plus. One time somebody complained about it,
> then some time later thought about it and implemented it.
I'd vote against the gram.y part of this change (doUnaryPlus),
but the rest looks OK.
The reason we have doNegate is mainly so that MININT can be represented
without overflow (assuming that atoi gets it right, of course). There's
no corresponding issue with unary plus, and no good reason to hard-wire
assumptions about the operator's semantics into gram.y.
regards, tom lane
From: | Marko Kreen <marko(at)l-t(dot)ee> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: unary plus |
Date: | 2001-06-01 21:58:17 |
Message-ID: | 20010601235816.C29129@l-t.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
On Fri, Jun 01, 2001 at 05:09:26PM -0400, Tom Lane wrote:
> Marko Kreen <marko(at)l-t(dot)ee> writes:
> > This is unary plus. One time somebody complained about it,
> > then some time later thought about it and implemented it.
>
> I'd vote against the gram.y part of this change (doUnaryPlus),
> but the rest looks OK.
Ok, I ripped that part out.
--
marko
Index: src/backend/utils/adt/float.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.71
diff -c -r1.71 float.c
*** src/backend/utils/adt/float.c 2001/05/03 19:00:36 1.71
--- src/backend/utils/adt/float.c 2001/06/01 19:30:47
***************
*** 15,23 ****
/*----------
* OLD COMMENTS
* Basic float4 ops:
! * float4in, float4out, float4abs, float4um
* Basic float8 ops:
! * float8in, float8out, float8abs, float8um
* Arithmetic operators:
* float4pl, float4mi, float4mul, float4div
* float8pl, float8mi, float8mul, float8div
--- 15,23 ----
/*----------
* OLD COMMENTS
* Basic float4 ops:
! * float4in, float4out, float4abs, float4um, float4up
* Basic float8 ops:
! * float8in, float8out, float8abs, float8um, float8up
* Arithmetic operators:
* float4pl, float4mi, float4mul, float4div
* float8pl, float8mi, float8mul, float8div
***************
*** 324,329 ****
--- 324,336 ----
}
Datum
+ float4up(PG_FUNCTION_ARGS)
+ {
+ float4 arg = PG_GETARG_FLOAT4(0);
+ PG_RETURN_FLOAT4(arg);
+ }
+
+ Datum
float4larger(PG_FUNCTION_ARGS)
{
float4 arg1 = PG_GETARG_FLOAT4(0);
***************
*** 380,385 ****
--- 387,399 ----
CheckFloat8Val(result);
PG_RETURN_FLOAT8(result);
+ }
+
+ Datum
+ float8up(PG_FUNCTION_ARGS)
+ {
+ float8 arg = PG_GETARG_FLOAT8(0);
+ PG_RETURN_FLOAT8(arg);
}
Datum
Index: src/backend/utils/adt/int.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int.c,v
retrieving revision 1.46
diff -c -r1.46 int.c
*** src/backend/utils/adt/int.c 2001/03/22 03:59:51 1.46
--- src/backend/utils/adt/int.c 2001/06/01 19:30:47
***************
*** 564,569 ****
--- 564,577 ----
}
Datum
+ int4up(PG_FUNCTION_ARGS)
+ {
+ int32 arg = PG_GETARG_INT32(0);
+
+ PG_RETURN_INT32(arg);
+ }
+
+ Datum
int4pl(PG_FUNCTION_ARGS)
{
int32 arg1 = PG_GETARG_INT32(0);
***************
*** 613,618 ****
--- 621,634 ----
int16 arg = PG_GETARG_INT16(0);
PG_RETURN_INT16(-arg);
+ }
+
+ Datum
+ int2up(PG_FUNCTION_ARGS)
+ {
+ int16 arg = PG_GETARG_INT16(0);
+
+ PG_RETURN_INT16(arg);
}
Datum
Index: src/backend/utils/adt/int8.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int8.c,v
retrieving revision 1.29
diff -c -r1.29 int8.c
*** src/backend/utils/adt/int8.c 2001/03/22 03:59:51 1.29
--- src/backend/utils/adt/int8.c 2001/06/01 19:30:48
***************
*** 413,418 ****
--- 413,426 ----
}
Datum
+ int8up(PG_FUNCTION_ARGS)
+ {
+ int64 val = PG_GETARG_INT64(0);
+
+ PG_RETURN_INT64(val);
+ }
+
+ Datum
int8pl(PG_FUNCTION_ARGS)
{
int64 val1 = PG_GETARG_INT64(0);
Index: src/backend/utils/adt/numeric.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/numeric.c,v
retrieving revision 1.41
diff -c -r1.41 numeric.c
*** src/backend/utils/adt/numeric.c 2001/05/03 19:00:36 1.41
--- src/backend/utils/adt/numeric.c 2001/06/01 19:30:53
***************
*** 406,411 ****
--- 406,424 ----
Datum
+ numeric_uplus(PG_FUNCTION_ARGS)
+ {
+ Numeric num = PG_GETARG_NUMERIC(0);
+ Numeric res;
+
+ res = (Numeric) palloc(num->varlen);
+ memcpy(res, num, num->varlen);
+
+ PG_RETURN_NUMERIC(res);
+ }
+
+
+ Datum
numeric_sign(PG_FUNCTION_ARGS)
{
Numeric num = PG_GETARG_NUMERIC(0);
Index: src/include/catalog/pg_operator.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
retrieving revision 1.88
diff -c -r1.88 pg_operator.h
*** src/include/catalog/pg_operator.h 2001/03/22 04:00:39 1.88
--- src/include/catalog/pg_operator.h 2001/06/01 19:30:57
***************
*** 794,799 ****
--- 794,806 ----
DATA(insert OID = 1890 ( "<<" PGUID 0 b t f 20 23 20 0 0 0 0 int8shl - - ));
DATA(insert OID = 1891 ( ">>" PGUID 0 b t f 20 23 20 0 0 0 0 int8shr - - ));
+ DATA(insert OID = 1916 ( "+" PGUID 0 l t f 0 20 20 0 0 0 0 int8up - - ));
+ DATA(insert OID = 1917 ( "+" PGUID 0 l t f 0 21 21 0 0 0 0 int2up - - ));
+ DATA(insert OID = 1918 ( "+" PGUID 0 l t f 0 23 23 0 0 0 0 int4up - - ));
+ DATA(insert OID = 1919 ( "+" PGUID 0 l t f 0 700 700 0 0 0 0 float4up - - ));
+ DATA(insert OID = 1920 ( "+" PGUID 0 l t f 0 701 701 0 0 0 0 float8up - - ));
+ DATA(insert OID = 1921 ( "+" PGUID 0 l t f 0 1700 1700 0 0 0 0 numeric_uplus - - ));
+
/*
* function prototypes
*/
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.188
diff -c -r1.188 pg_proc.h
*** src/include/catalog/pg_proc.h 2001/05/24 09:29:29 1.188
--- src/include/catalog/pg_proc.h 2001/06/01 19:31:05
***************
*** 2614,2619 ****
--- 2614,2632 ----
DATA(insert OID = 1909 ( int8shr PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int8shr - ));
DESCR("binary shift right");
+ DATA(insert OID = 1910 ( int8up PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1911 ( int2up PGUID 12 f t t t 1 f 21 "21" 100 0 0 100 int2up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1912 ( int4up PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1913 ( float4up PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1914 ( float8up PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8up - ));
+ DESCR("unary plus");
+ DATA(insert OID = 1915 ( numeric_uplus PGUID 12 f t t t 1 f 1700 "1700" 100 0 0 100 numeric_uplus - ));
+ DESCR("unary plus");
+
/*
* prototypes for functions pg_proc.c
*/
Index: src/include/utils/builtins.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/builtins.h,v
retrieving revision 1.148
diff -c -r1.148 builtins.h
*** src/include/utils/builtins.h 2001/03/22 04:01:11 1.148
--- src/include/utils/builtins.h 2001/06/01 19:31:06
***************
*** 96,101 ****
--- 96,102 ----
extern Datum int42gt(PG_FUNCTION_ARGS);
extern Datum int42ge(PG_FUNCTION_ARGS);
extern Datum int4um(PG_FUNCTION_ARGS);
+ extern Datum int4up(PG_FUNCTION_ARGS);
extern Datum int4pl(PG_FUNCTION_ARGS);
extern Datum int4mi(PG_FUNCTION_ARGS);
extern Datum int4mul(PG_FUNCTION_ARGS);
***************
*** 103,108 ****
--- 104,110 ----
extern Datum int4abs(PG_FUNCTION_ARGS);
extern Datum int4inc(PG_FUNCTION_ARGS);
extern Datum int2um(PG_FUNCTION_ARGS);
+ extern Datum int2up(PG_FUNCTION_ARGS);
extern Datum int2pl(PG_FUNCTION_ARGS);
extern Datum int2mi(PG_FUNCTION_ARGS);
extern Datum int2mul(PG_FUNCTION_ARGS);
***************
*** 184,193 ****
--- 186,197 ----
extern Datum float8out(PG_FUNCTION_ARGS);
extern Datum float4abs(PG_FUNCTION_ARGS);
extern Datum float4um(PG_FUNCTION_ARGS);
+ extern Datum float4up(PG_FUNCTION_ARGS);
extern Datum float4larger(PG_FUNCTION_ARGS);
extern Datum float4smaller(PG_FUNCTION_ARGS);
extern Datum float8abs(PG_FUNCTION_ARGS);
extern Datum float8um(PG_FUNCTION_ARGS);
+ extern Datum float8up(PG_FUNCTION_ARGS);
extern Datum float8larger(PG_FUNCTION_ARGS);
extern Datum float8smaller(PG_FUNCTION_ARGS);
extern Datum float4pl(PG_FUNCTION_ARGS);
***************
*** 532,537 ****
--- 536,542 ----
extern Datum numeric(PG_FUNCTION_ARGS);
extern Datum numeric_abs(PG_FUNCTION_ARGS);
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
+ extern Datum numeric_uplus(PG_FUNCTION_ARGS);
extern Datum numeric_sign(PG_FUNCTION_ARGS);
extern Datum numeric_round(PG_FUNCTION_ARGS);
extern Datum numeric_trunc(PG_FUNCTION_ARGS);
Index: src/include/utils/int8.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/int8.h,v
retrieving revision 1.25
diff -c -r1.25 int8.h
*** src/include/utils/int8.h 2001/01/24 19:43:28 1.25
--- src/include/utils/int8.h 2001/06/01 19:31:07
***************
*** 66,71 ****
--- 66,72 ----
extern Datum int28ge(PG_FUNCTION_ARGS);
extern Datum int8um(PG_FUNCTION_ARGS);
+ extern Datum int8up(PG_FUNCTION_ARGS);
extern Datum int8pl(PG_FUNCTION_ARGS);
extern Datum int8mi(PG_FUNCTION_ARGS);
extern Datum int8mul(PG_FUNCTION_ARGS);
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Marko Kreen <marko(at)l-t(dot)ee> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: unary plus |
Date: | 2001-06-04 21:20:09 |
Message-ID: | 200106042120.f54LK9S12977@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Your patch has been added to the PostgreSQL unapplied patches list at:
http://candle.pha.pa.us/cgi-bin/pgpatches
I will try to apply it within the next 48 hours.
> On Fri, Jun 01, 2001 at 05:09:26PM -0400, Tom Lane wrote:
> > Marko Kreen <marko(at)l-t(dot)ee> writes:
> > > This is unary plus. One time somebody complained about it,
> > > then some time later thought about it and implemented it.
> >
> > I'd vote against the gram.y part of this change (doUnaryPlus),
> > but the rest looks OK.
>
> Ok, I ripped that part out.
>
> --
> marko
>
>
> Index: src/backend/utils/adt/float.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/float.c,v
> retrieving revision 1.71
> diff -c -r1.71 float.c
> *** src/backend/utils/adt/float.c 2001/05/03 19:00:36 1.71
> --- src/backend/utils/adt/float.c 2001/06/01 19:30:47
> ***************
> *** 15,23 ****
> /*----------
> * OLD COMMENTS
> * Basic float4 ops:
> ! * float4in, float4out, float4abs, float4um
> * Basic float8 ops:
> ! * float8in, float8out, float8abs, float8um
> * Arithmetic operators:
> * float4pl, float4mi, float4mul, float4div
> * float8pl, float8mi, float8mul, float8div
> --- 15,23 ----
> /*----------
> * OLD COMMENTS
> * Basic float4 ops:
> ! * float4in, float4out, float4abs, float4um, float4up
> * Basic float8 ops:
> ! * float8in, float8out, float8abs, float8um, float8up
> * Arithmetic operators:
> * float4pl, float4mi, float4mul, float4div
> * float8pl, float8mi, float8mul, float8div
> ***************
> *** 324,329 ****
> --- 324,336 ----
> }
>
> Datum
> + float4up(PG_FUNCTION_ARGS)
> + {
> + float4 arg = PG_GETARG_FLOAT4(0);
> + PG_RETURN_FLOAT4(arg);
> + }
> +
> + Datum
> float4larger(PG_FUNCTION_ARGS)
> {
> float4 arg1 = PG_GETARG_FLOAT4(0);
> ***************
> *** 380,385 ****
> --- 387,399 ----
>
> CheckFloat8Val(result);
> PG_RETURN_FLOAT8(result);
> + }
> +
> + Datum
> + float8up(PG_FUNCTION_ARGS)
> + {
> + float8 arg = PG_GETARG_FLOAT8(0);
> + PG_RETURN_FLOAT8(arg);
> }
>
> Datum
> Index: src/backend/utils/adt/int.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int.c,v
> retrieving revision 1.46
> diff -c -r1.46 int.c
> *** src/backend/utils/adt/int.c 2001/03/22 03:59:51 1.46
> --- src/backend/utils/adt/int.c 2001/06/01 19:30:47
> ***************
> *** 564,569 ****
> --- 564,577 ----
> }
>
> Datum
> + int4up(PG_FUNCTION_ARGS)
> + {
> + int32 arg = PG_GETARG_INT32(0);
> +
> + PG_RETURN_INT32(arg);
> + }
> +
> + Datum
> int4pl(PG_FUNCTION_ARGS)
> {
> int32 arg1 = PG_GETARG_INT32(0);
> ***************
> *** 613,618 ****
> --- 621,634 ----
> int16 arg = PG_GETARG_INT16(0);
>
> PG_RETURN_INT16(-arg);
> + }
> +
> + Datum
> + int2up(PG_FUNCTION_ARGS)
> + {
> + int16 arg = PG_GETARG_INT16(0);
> +
> + PG_RETURN_INT16(arg);
> }
>
> Datum
> Index: src/backend/utils/adt/int8.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int8.c,v
> retrieving revision 1.29
> diff -c -r1.29 int8.c
> *** src/backend/utils/adt/int8.c 2001/03/22 03:59:51 1.29
> --- src/backend/utils/adt/int8.c 2001/06/01 19:30:48
> ***************
> *** 413,418 ****
> --- 413,426 ----
> }
>
> Datum
> + int8up(PG_FUNCTION_ARGS)
> + {
> + int64 val = PG_GETARG_INT64(0);
> +
> + PG_RETURN_INT64(val);
> + }
> +
> + Datum
> int8pl(PG_FUNCTION_ARGS)
> {
> int64 val1 = PG_GETARG_INT64(0);
> Index: src/backend/utils/adt/numeric.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/numeric.c,v
> retrieving revision 1.41
> diff -c -r1.41 numeric.c
> *** src/backend/utils/adt/numeric.c 2001/05/03 19:00:36 1.41
> --- src/backend/utils/adt/numeric.c 2001/06/01 19:30:53
> ***************
> *** 406,411 ****
> --- 406,424 ----
>
>
> Datum
> + numeric_uplus(PG_FUNCTION_ARGS)
> + {
> + Numeric num = PG_GETARG_NUMERIC(0);
> + Numeric res;
> +
> + res = (Numeric) palloc(num->varlen);
> + memcpy(res, num, num->varlen);
> +
> + PG_RETURN_NUMERIC(res);
> + }
> +
> +
> + Datum
> numeric_sign(PG_FUNCTION_ARGS)
> {
> Numeric num = PG_GETARG_NUMERIC(0);
> Index: src/include/catalog/pg_operator.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
> retrieving revision 1.88
> diff -c -r1.88 pg_operator.h
> *** src/include/catalog/pg_operator.h 2001/03/22 04:00:39 1.88
> --- src/include/catalog/pg_operator.h 2001/06/01 19:30:57
> ***************
> *** 794,799 ****
> --- 794,806 ----
> DATA(insert OID = 1890 ( "<<" PGUID 0 b t f 20 23 20 0 0 0 0 int8shl - - ));
> DATA(insert OID = 1891 ( ">>" PGUID 0 b t f 20 23 20 0 0 0 0 int8shr - - ));
>
> + DATA(insert OID = 1916 ( "+" PGUID 0 l t f 0 20 20 0 0 0 0 int8up - - ));
> + DATA(insert OID = 1917 ( "+" PGUID 0 l t f 0 21 21 0 0 0 0 int2up - - ));
> + DATA(insert OID = 1918 ( "+" PGUID 0 l t f 0 23 23 0 0 0 0 int4up - - ));
> + DATA(insert OID = 1919 ( "+" PGUID 0 l t f 0 700 700 0 0 0 0 float4up - - ));
> + DATA(insert OID = 1920 ( "+" PGUID 0 l t f 0 701 701 0 0 0 0 float8up - - ));
> + DATA(insert OID = 1921 ( "+" PGUID 0 l t f 0 1700 1700 0 0 0 0 numeric_uplus - - ));
> +
> /*
> * function prototypes
> */
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
> retrieving revision 1.188
> diff -c -r1.188 pg_proc.h
> *** src/include/catalog/pg_proc.h 2001/05/24 09:29:29 1.188
> --- src/include/catalog/pg_proc.h 2001/06/01 19:31:05
> ***************
> *** 2614,2619 ****
> --- 2614,2632 ----
> DATA(insert OID = 1909 ( int8shr PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int8shr - ));
> DESCR("binary shift right");
>
> + DATA(insert OID = 1910 ( int8up PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1911 ( int2up PGUID 12 f t t t 1 f 21 "21" 100 0 0 100 int2up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1912 ( int4up PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1913 ( float4up PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1914 ( float8up PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1915 ( numeric_uplus PGUID 12 f t t t 1 f 1700 "1700" 100 0 0 100 numeric_uplus - ));
> + DESCR("unary plus");
> +
> /*
> * prototypes for functions pg_proc.c
> */
> Index: src/include/utils/builtins.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/builtins.h,v
> retrieving revision 1.148
> diff -c -r1.148 builtins.h
> *** src/include/utils/builtins.h 2001/03/22 04:01:11 1.148
> --- src/include/utils/builtins.h 2001/06/01 19:31:06
> ***************
> *** 96,101 ****
> --- 96,102 ----
> extern Datum int42gt(PG_FUNCTION_ARGS);
> extern Datum int42ge(PG_FUNCTION_ARGS);
> extern Datum int4um(PG_FUNCTION_ARGS);
> + extern Datum int4up(PG_FUNCTION_ARGS);
> extern Datum int4pl(PG_FUNCTION_ARGS);
> extern Datum int4mi(PG_FUNCTION_ARGS);
> extern Datum int4mul(PG_FUNCTION_ARGS);
> ***************
> *** 103,108 ****
> --- 104,110 ----
> extern Datum int4abs(PG_FUNCTION_ARGS);
> extern Datum int4inc(PG_FUNCTION_ARGS);
> extern Datum int2um(PG_FUNCTION_ARGS);
> + extern Datum int2up(PG_FUNCTION_ARGS);
> extern Datum int2pl(PG_FUNCTION_ARGS);
> extern Datum int2mi(PG_FUNCTION_ARGS);
> extern Datum int2mul(PG_FUNCTION_ARGS);
> ***************
> *** 184,193 ****
> --- 186,197 ----
> extern Datum float8out(PG_FUNCTION_ARGS);
> extern Datum float4abs(PG_FUNCTION_ARGS);
> extern Datum float4um(PG_FUNCTION_ARGS);
> + extern Datum float4up(PG_FUNCTION_ARGS);
> extern Datum float4larger(PG_FUNCTION_ARGS);
> extern Datum float4smaller(PG_FUNCTION_ARGS);
> extern Datum float8abs(PG_FUNCTION_ARGS);
> extern Datum float8um(PG_FUNCTION_ARGS);
> + extern Datum float8up(PG_FUNCTION_ARGS);
> extern Datum float8larger(PG_FUNCTION_ARGS);
> extern Datum float8smaller(PG_FUNCTION_ARGS);
> extern Datum float4pl(PG_FUNCTION_ARGS);
> ***************
> *** 532,537 ****
> --- 536,542 ----
> extern Datum numeric(PG_FUNCTION_ARGS);
> extern Datum numeric_abs(PG_FUNCTION_ARGS);
> extern Datum numeric_uminus(PG_FUNCTION_ARGS);
> + extern Datum numeric_uplus(PG_FUNCTION_ARGS);
> extern Datum numeric_sign(PG_FUNCTION_ARGS);
> extern Datum numeric_round(PG_FUNCTION_ARGS);
> extern Datum numeric_trunc(PG_FUNCTION_ARGS);
> Index: src/include/utils/int8.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/int8.h,v
> retrieving revision 1.25
> diff -c -r1.25 int8.h
> *** src/include/utils/int8.h 2001/01/24 19:43:28 1.25
> --- src/include/utils/int8.h 2001/06/01 19:31:07
> ***************
> *** 66,71 ****
> --- 66,72 ----
> extern Datum int28ge(PG_FUNCTION_ARGS);
>
> extern Datum int8um(PG_FUNCTION_ARGS);
> + extern Datum int8up(PG_FUNCTION_ARGS);
> extern Datum int8pl(PG_FUNCTION_ARGS);
> extern Datum int8mi(PG_FUNCTION_ARGS);
> extern Datum int8mul(PG_FUNCTION_ARGS);
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Marko Kreen <marko(at)l-t(dot)ee> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: unary plus |
Date: | 2001-06-07 00:09:16 |
Message-ID: | 200106070009.f5709GP28188@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Thanks. Patch applied.
> On Fri, Jun 01, 2001 at 05:09:26PM -0400, Tom Lane wrote:
> > Marko Kreen <marko(at)l-t(dot)ee> writes:
> > > This is unary plus. One time somebody complained about it,
> > > then some time later thought about it and implemented it.
> >
> > I'd vote against the gram.y part of this change (doUnaryPlus),
> > but the rest looks OK.
>
> Ok, I ripped that part out.
>
> --
> marko
>
>
> Index: src/backend/utils/adt/float.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/float.c,v
> retrieving revision 1.71
> diff -c -r1.71 float.c
> *** src/backend/utils/adt/float.c 2001/05/03 19:00:36 1.71
> --- src/backend/utils/adt/float.c 2001/06/01 19:30:47
> ***************
> *** 15,23 ****
> /*----------
> * OLD COMMENTS
> * Basic float4 ops:
> ! * float4in, float4out, float4abs, float4um
> * Basic float8 ops:
> ! * float8in, float8out, float8abs, float8um
> * Arithmetic operators:
> * float4pl, float4mi, float4mul, float4div
> * float8pl, float8mi, float8mul, float8div
> --- 15,23 ----
> /*----------
> * OLD COMMENTS
> * Basic float4 ops:
> ! * float4in, float4out, float4abs, float4um, float4up
> * Basic float8 ops:
> ! * float8in, float8out, float8abs, float8um, float8up
> * Arithmetic operators:
> * float4pl, float4mi, float4mul, float4div
> * float8pl, float8mi, float8mul, float8div
> ***************
> *** 324,329 ****
> --- 324,336 ----
> }
>
> Datum
> + float4up(PG_FUNCTION_ARGS)
> + {
> + float4 arg = PG_GETARG_FLOAT4(0);
> + PG_RETURN_FLOAT4(arg);
> + }
> +
> + Datum
> float4larger(PG_FUNCTION_ARGS)
> {
> float4 arg1 = PG_GETARG_FLOAT4(0);
> ***************
> *** 380,385 ****
> --- 387,399 ----
>
> CheckFloat8Val(result);
> PG_RETURN_FLOAT8(result);
> + }
> +
> + Datum
> + float8up(PG_FUNCTION_ARGS)
> + {
> + float8 arg = PG_GETARG_FLOAT8(0);
> + PG_RETURN_FLOAT8(arg);
> }
>
> Datum
> Index: src/backend/utils/adt/int.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int.c,v
> retrieving revision 1.46
> diff -c -r1.46 int.c
> *** src/backend/utils/adt/int.c 2001/03/22 03:59:51 1.46
> --- src/backend/utils/adt/int.c 2001/06/01 19:30:47
> ***************
> *** 564,569 ****
> --- 564,577 ----
> }
>
> Datum
> + int4up(PG_FUNCTION_ARGS)
> + {
> + int32 arg = PG_GETARG_INT32(0);
> +
> + PG_RETURN_INT32(arg);
> + }
> +
> + Datum
> int4pl(PG_FUNCTION_ARGS)
> {
> int32 arg1 = PG_GETARG_INT32(0);
> ***************
> *** 613,618 ****
> --- 621,634 ----
> int16 arg = PG_GETARG_INT16(0);
>
> PG_RETURN_INT16(-arg);
> + }
> +
> + Datum
> + int2up(PG_FUNCTION_ARGS)
> + {
> + int16 arg = PG_GETARG_INT16(0);
> +
> + PG_RETURN_INT16(arg);
> }
>
> Datum
> Index: src/backend/utils/adt/int8.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/int8.c,v
> retrieving revision 1.29
> diff -c -r1.29 int8.c
> *** src/backend/utils/adt/int8.c 2001/03/22 03:59:51 1.29
> --- src/backend/utils/adt/int8.c 2001/06/01 19:30:48
> ***************
> *** 413,418 ****
> --- 413,426 ----
> }
>
> Datum
> + int8up(PG_FUNCTION_ARGS)
> + {
> + int64 val = PG_GETARG_INT64(0);
> +
> + PG_RETURN_INT64(val);
> + }
> +
> + Datum
> int8pl(PG_FUNCTION_ARGS)
> {
> int64 val1 = PG_GETARG_INT64(0);
> Index: src/backend/utils/adt/numeric.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/numeric.c,v
> retrieving revision 1.41
> diff -c -r1.41 numeric.c
> *** src/backend/utils/adt/numeric.c 2001/05/03 19:00:36 1.41
> --- src/backend/utils/adt/numeric.c 2001/06/01 19:30:53
> ***************
> *** 406,411 ****
> --- 406,424 ----
>
>
> Datum
> + numeric_uplus(PG_FUNCTION_ARGS)
> + {
> + Numeric num = PG_GETARG_NUMERIC(0);
> + Numeric res;
> +
> + res = (Numeric) palloc(num->varlen);
> + memcpy(res, num, num->varlen);
> +
> + PG_RETURN_NUMERIC(res);
> + }
> +
> +
> + Datum
> numeric_sign(PG_FUNCTION_ARGS)
> {
> Numeric num = PG_GETARG_NUMERIC(0);
> Index: src/include/catalog/pg_operator.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
> retrieving revision 1.88
> diff -c -r1.88 pg_operator.h
> *** src/include/catalog/pg_operator.h 2001/03/22 04:00:39 1.88
> --- src/include/catalog/pg_operator.h 2001/06/01 19:30:57
> ***************
> *** 794,799 ****
> --- 794,806 ----
> DATA(insert OID = 1890 ( "<<" PGUID 0 b t f 20 23 20 0 0 0 0 int8shl - - ));
> DATA(insert OID = 1891 ( ">>" PGUID 0 b t f 20 23 20 0 0 0 0 int8shr - - ));
>
> + DATA(insert OID = 1916 ( "+" PGUID 0 l t f 0 20 20 0 0 0 0 int8up - - ));
> + DATA(insert OID = 1917 ( "+" PGUID 0 l t f 0 21 21 0 0 0 0 int2up - - ));
> + DATA(insert OID = 1918 ( "+" PGUID 0 l t f 0 23 23 0 0 0 0 int4up - - ));
> + DATA(insert OID = 1919 ( "+" PGUID 0 l t f 0 700 700 0 0 0 0 float4up - - ));
> + DATA(insert OID = 1920 ( "+" PGUID 0 l t f 0 701 701 0 0 0 0 float8up - - ));
> + DATA(insert OID = 1921 ( "+" PGUID 0 l t f 0 1700 1700 0 0 0 0 numeric_uplus - - ));
> +
> /*
> * function prototypes
> */
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
> retrieving revision 1.188
> diff -c -r1.188 pg_proc.h
> *** src/include/catalog/pg_proc.h 2001/05/24 09:29:29 1.188
> --- src/include/catalog/pg_proc.h 2001/06/01 19:31:05
> ***************
> *** 2614,2619 ****
> --- 2614,2632 ----
> DATA(insert OID = 1909 ( int8shr PGUID 12 f t t t 2 f 20 "20 23" 100 0 0 100 int8shr - ));
> DESCR("binary shift right");
>
> + DATA(insert OID = 1910 ( int8up PGUID 12 f t t t 1 f 20 "20" 100 0 0 100 int8up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1911 ( int2up PGUID 12 f t t t 1 f 21 "21" 100 0 0 100 int2up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1912 ( int4up PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1913 ( float4up PGUID 12 f t t t 1 f 700 "700" 100 0 0 100 float4up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1914 ( float8up PGUID 12 f t t t 1 f 701 "701" 100 0 0 100 float8up - ));
> + DESCR("unary plus");
> + DATA(insert OID = 1915 ( numeric_uplus PGUID 12 f t t t 1 f 1700 "1700" 100 0 0 100 numeric_uplus - ));
> + DESCR("unary plus");
> +
> /*
> * prototypes for functions pg_proc.c
> */
> Index: src/include/utils/builtins.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/builtins.h,v
> retrieving revision 1.148
> diff -c -r1.148 builtins.h
> *** src/include/utils/builtins.h 2001/03/22 04:01:11 1.148
> --- src/include/utils/builtins.h 2001/06/01 19:31:06
> ***************
> *** 96,101 ****
> --- 96,102 ----
> extern Datum int42gt(PG_FUNCTION_ARGS);
> extern Datum int42ge(PG_FUNCTION_ARGS);
> extern Datum int4um(PG_FUNCTION_ARGS);
> + extern Datum int4up(PG_FUNCTION_ARGS);
> extern Datum int4pl(PG_FUNCTION_ARGS);
> extern Datum int4mi(PG_FUNCTION_ARGS);
> extern Datum int4mul(PG_FUNCTION_ARGS);
> ***************
> *** 103,108 ****
> --- 104,110 ----
> extern Datum int4abs(PG_FUNCTION_ARGS);
> extern Datum int4inc(PG_FUNCTION_ARGS);
> extern Datum int2um(PG_FUNCTION_ARGS);
> + extern Datum int2up(PG_FUNCTION_ARGS);
> extern Datum int2pl(PG_FUNCTION_ARGS);
> extern Datum int2mi(PG_FUNCTION_ARGS);
> extern Datum int2mul(PG_FUNCTION_ARGS);
> ***************
> *** 184,193 ****
> --- 186,197 ----
> extern Datum float8out(PG_FUNCTION_ARGS);
> extern Datum float4abs(PG_FUNCTION_ARGS);
> extern Datum float4um(PG_FUNCTION_ARGS);
> + extern Datum float4up(PG_FUNCTION_ARGS);
> extern Datum float4larger(PG_FUNCTION_ARGS);
> extern Datum float4smaller(PG_FUNCTION_ARGS);
> extern Datum float8abs(PG_FUNCTION_ARGS);
> extern Datum float8um(PG_FUNCTION_ARGS);
> + extern Datum float8up(PG_FUNCTION_ARGS);
> extern Datum float8larger(PG_FUNCTION_ARGS);
> extern Datum float8smaller(PG_FUNCTION_ARGS);
> extern Datum float4pl(PG_FUNCTION_ARGS);
> ***************
> *** 532,537 ****
> --- 536,542 ----
> extern Datum numeric(PG_FUNCTION_ARGS);
> extern Datum numeric_abs(PG_FUNCTION_ARGS);
> extern Datum numeric_uminus(PG_FUNCTION_ARGS);
> + extern Datum numeric_uplus(PG_FUNCTION_ARGS);
> extern Datum numeric_sign(PG_FUNCTION_ARGS);
> extern Datum numeric_round(PG_FUNCTION_ARGS);
> extern Datum numeric_trunc(PG_FUNCTION_ARGS);
> Index: src/include/utils/int8.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/utils/int8.h,v
> retrieving revision 1.25
> diff -c -r1.25 int8.h
> *** src/include/utils/int8.h 2001/01/24 19:43:28 1.25
> --- src/include/utils/int8.h 2001/06/01 19:31:07
> ***************
> *** 66,71 ****
> --- 66,72 ----
> extern Datum int28ge(PG_FUNCTION_ARGS);
>
> extern Datum int8um(PG_FUNCTION_ARGS);
> + extern Datum int8up(PG_FUNCTION_ARGS);
> extern Datum int8pl(PG_FUNCTION_ARGS);
> extern Datum int8mi(PG_FUNCTION_ARGS);
> extern Datum int8mul(PG_FUNCTION_ARGS);
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026