Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2001-06-07 00:09:32 +0000
committerBruce Momjian2001-06-07 00:09:32 +0000
commitba17165f55fefd342c0c79fee75b7cb1a830214b (patch)
treea79d1b988b98976c467c0470566c5160f90b15db /src/backend
parenta6697b361460da9e88d949aa404164183528b094 (diff)
This adds unary plus capability. No grammar changes, per Tom's request.
Marko Kreen
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/commands/command.c14
-rw-r--r--src/backend/utils/adt/float.c20
-rw-r--r--src/backend/utils/adt/int.c18
-rw-r--r--src/backend/utils/adt/int8.c10
-rw-r--r--src/backend/utils/adt/numeric.c15
5 files changed, 70 insertions, 7 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index b6e745c4656..e50b9407b7e 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.131 2001/05/30 13:00:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.132 2001/06/07 00:09:28 momjian Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
@@ -176,6 +176,12 @@ PerformPortalFetch(char *name,
if (!portal->atEnd)
{
ExecutorRun(queryDesc, estate, EXEC_FOR, (long) count);
+ /*
+ * I use CMD_UPDATE, because no CMD_MOVE or the like
+ * exists, and I would like to provide the same
+ * kind of info as CMD_UPDATE
+ */
+ UpdateCommandInfo(CMD_UPDATE, 0, estate->es_processed);
if (estate->es_processed > 0)
portal->atStart = false; /* OK to back up now */
if (count <= 0 || (int) estate->es_processed < count)
@@ -187,6 +193,12 @@ PerformPortalFetch(char *name,
if (!portal->atStart)
{
ExecutorRun(queryDesc, estate, EXEC_BACK, (long) count);
+ /*
+ * I use CMD_UPDATE, because no CMD_MOVE or the like
+ * exists, and I would like to provide the same
+ * kind of info as CMD_UPDATE
+ */
+ UpdateCommandInfo(CMD_UPDATE, 0, estate->es_processed);
if (estate->es_processed > 0)
portal->atEnd = false; /* OK to go forward now */
if (count <= 0 || (int) estate->es_processed < count)
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index da8ed2e29d4..8e5408af312 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,16 +8,16 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.73 2001/06/02 20:18:30 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.74 2001/06/07 00:09:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*----------
* OLD COMMENTS
* Basic float4 ops:
- * float4in, float4out, float4abs, float4um
+ * float4in, float4out, float4abs, float4um, float4up
* Basic float8 ops:
- * float8in, float8out, float8abs, float8um
+ * float8in, float8out, float8abs, float8um, float8up
* Arithmetic operators:
* float4pl, float4mi, float4mul, float4div
* float8pl, float8mi, float8mul, float8div
@@ -341,6 +341,13 @@ float4um(PG_FUNCTION_ARGS)
}
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);
@@ -400,6 +407,13 @@ float8um(PG_FUNCTION_ARGS)
}
Datum
+float8up(PG_FUNCTION_ARGS)
+{
+ float8 arg = PG_GETARG_FLOAT8(0);
+ PG_RETURN_FLOAT8(arg);
+}
+
+Datum
float8larger(PG_FUNCTION_ARGS)
{
float8 arg1 = PG_GETARG_FLOAT8(0);
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index 00c99805c9e..e04ae89cea0 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.46 2001/03/22 03:59:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.47 2001/06/07 00:09:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -564,6 +564,14 @@ int4um(PG_FUNCTION_ARGS)
}
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);
@@ -616,6 +624,14 @@ int2um(PG_FUNCTION_ARGS)
}
Datum
+int2up(PG_FUNCTION_ARGS)
+{
+ int16 arg = PG_GETARG_INT16(0);
+
+ PG_RETURN_INT16(arg);
+}
+
+Datum
int2pl(PG_FUNCTION_ARGS)
{
int16 arg1 = PG_GETARG_INT16(0);
diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c
index 3f286069b7d..055c8439fa4 100644
--- a/src/backend/utils/adt/int8.c
+++ b/src/backend/utils/adt/int8.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.29 2001/03/22 03:59:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.30 2001/06/07 00:09:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -413,6 +413,14 @@ int8um(PG_FUNCTION_ARGS)
}
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);
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 99df5331bf6..bb0e8b2b7ef 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -5,7 +5,7 @@
*
* 1998 Jan Wieck
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.41 2001/05/03 19:00:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.42 2001/06/07 00:09:29 momjian Exp $
*
* ----------
*/
@@ -406,6 +406,19 @@ numeric_uminus(PG_FUNCTION_ARGS)
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);