Commit 30f60948 authored by Tom Lane's avatar Tom Lane

Add binary I/O routines for a bunch more datatypes. Still a few to go,

but that was enough tedium for one day.  Along the way, move the few
support routines for types xid and cid into a more logical place.
parent b0283271
......@@ -4,7 +4,7 @@
# Makefile for access/transam
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/access/transam/Makefile,v 1.15 2001/08/25 18:52:41 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/access/transam/Makefile,v 1.16 2003/05/12 23:08:50 tgl Exp $
#
#-------------------------------------------------------------------------
......@@ -12,7 +12,7 @@ subdir = src/backend/access/transam
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
OBJS = clog.o transam.o varsup.o xact.o xid.o xlog.o xlogutils.o rmgr.o
OBJS = clog.o transam.o varsup.o xact.o xlog.o xlogutils.o rmgr.o
all: SUBSYS.o
......
......@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.116 2003/01/27 00:47:37 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.117 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -324,7 +324,7 @@ write_user_file(Relation urel)
if (isnull)
valuntil = pstrdup("");
else
valuntil = DatumGetCString(DirectFunctionCall1(nabstimeout, datum));
valuntil = DatumGetCString(DirectFunctionCall1(abstimeout, datum));
/*
* Check for illegal characters in the username and password.
......@@ -649,7 +649,7 @@ CreateUser(CreateUserStmt *stmt)
if (validUntil)
new_record[Anum_pg_shadow_valuntil - 1] =
DirectFunctionCall1(nabstimein, CStringGetDatum(validUntil));
DirectFunctionCall1(abstimein, CStringGetDatum(validUntil));
else
new_record_nulls[Anum_pg_shadow_valuntil - 1] = 'n';
......@@ -851,7 +851,7 @@ AlterUser(AlterUserStmt *stmt)
if (validUntil)
{
new_record[Anum_pg_shadow_valuntil - 1] =
DirectFunctionCall1(nabstimein, CStringGetDatum(validUntil));
DirectFunctionCall1(abstimein, CStringGetDatum(validUntil));
new_record_repl[Anum_pg_shadow_valuntil - 1] = 'r';
}
......
......@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/libpq/crypt.c,v 1.52 2003/04/17 22:26:01 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/crypt.c,v 1.53 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -145,7 +145,7 @@ md5_crypt_verify(const Port *port, const char *user, char *client_pass)
if (!valuntil)
vuntil = INVALID_ABSTIME;
else
vuntil = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,
vuntil = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
CStringGetDatum(valuntil)));
current = GetCurrentAbsoluteTime();
if (vuntil != INVALID_ABSTIME && vuntil < current)
......
#
# Makefile for utils/adt
#
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.54 2003/04/08 23:20:02 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.55 2003/05/12 23:08:50 tgl Exp $
#
subdir = src/backend/utils/adt
......@@ -21,7 +21,7 @@ OBJS = acl.o arrayfuncs.o array_userfuncs.o arrayutils.o bool.o \
misc.o nabstime.o name.o not_in.o numeric.o numutils.o \
oid.o oracle_compat.o pseudotypes.o \
regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
tid.o timestamp.o varbit.o varchar.o varlena.o version.o \
tid.o timestamp.o varbit.o varchar.o varlena.o version.o xid.o \
network.o mac.o inet_net_ntop.o inet_net_pton.o \
ri_triggers.o pg_lzcompress.o pg_locale.o formatting.o \
ascii.o quote.o pgstatfuncs.o encode.o
......
......@@ -8,13 +8,14 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.26 2002/06/20 20:29:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.27 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
/*****************************************************************************
......@@ -94,6 +95,36 @@ boolout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* boolrecv - converts external binary format to bool
*
* The external representation is one byte. Any nonzero value is taken
* as "true".
*/
Datum
boolrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
int ext;
ext = pq_getmsgbyte(buf);
PG_RETURN_BOOL((ext != 0) ? true : false);
}
/*
* boolsend - converts bool to binary format
*/
Datum
boolsend(PG_FUNCTION_ARGS)
{
bool arg1 = PG_GETARG_BOOL(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendbyte(&buf, arg1 ? 1 : 0);
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/*****************************************************************************
* PUBLIC ROUTINES *
......
/*-------------------------------------------------------------------------
*
* char.c
* Functions for the built-in type "char".
* Functions for the built-in type "cid" (what's that doing here?)
* Functions for the built-in type "char" (not to be confused with
* bpchar, which is the SQL CHAR(n) type).
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.34 2003/03/11 21:01:33 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.35 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
/*****************************************************************************
......@@ -52,6 +53,35 @@ charout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* charrecv - converts external binary format to char
*
* The external representation is one byte, with no character set
* conversion. This is somewhat dubious, perhaps, but in many
* cases people use char for a 1-byte binary type.
*/
Datum
charrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
PG_RETURN_CHAR(pq_getmsgbyte(buf));
}
/*
* charsend - converts char to binary format
*/
Datum
charsend(PG_FUNCTION_ARGS)
{
char arg1 = PG_GETARG_CHAR(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendbyte(&buf, arg1);
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/*****************************************************************************
* PUBLIC ROUTINES *
*****************************************************************************/
......@@ -196,51 +226,3 @@ char_text(PG_FUNCTION_ARGS)
PG_RETURN_TEXT_P(result);
}
/*****************************************************************************
* USER I/O ROUTINES *
*****************************************************************************/
/*
* cidin - converts CommandId to internal representation.
*/
Datum
cidin(PG_FUNCTION_ARGS)
{
char *s = PG_GETARG_CSTRING(0);
CommandId c;
c = atoi(s);
/* XXX assume that CommandId is 32 bits... */
PG_RETURN_INT32((int32) c);
}
/*
* cidout - converts a cid to external representation.
*/
Datum
cidout(PG_FUNCTION_ARGS)
{
/* XXX assume that CommandId is 32 bits... */
CommandId c = PG_GETARG_INT32(0);
char *result = (char *) palloc(16);
sprintf(result, "%u", (unsigned int) c);
PG_RETURN_CSTRING(result);
}
/*****************************************************************************
* PUBLIC ROUTINES *
*****************************************************************************/
Datum
cideq(PG_FUNCTION_ARGS)
{
/* XXX assume that CommandId is 32 bits... */
CommandId arg1 = PG_GETARG_INT32(0);
CommandId arg2 = PG_GETARG_INT32(1);
PG_RETURN_BOOL(arg1 == arg2);
}
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.81 2003/04/08 17:02:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.82 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -21,6 +21,7 @@
#include <float.h>
#include "access/hash.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/date.h"
......@@ -117,6 +118,32 @@ date_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* date_recv - converts external binary format to date
*/
Datum
date_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
PG_RETURN_DATEADT((DateADT) pq_getmsgint(buf, sizeof(DateADT)));
}
/*
* date_send - converts date to binary format
*/
Datum
date_send(PG_FUNCTION_ARGS)
{
DateADT date = PG_GETARG_DATEADT(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, date, sizeof(date));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
Datum
date_eq(PG_FUNCTION_ARGS)
{
......@@ -594,6 +621,43 @@ time_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* time_recv - converts external binary format to time
*
* We make no attempt to provide compatibility between int and float
* time representations ...
*/
Datum
time_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
#ifdef HAVE_INT64_TIMESTAMP
PG_RETURN_TIMEADT((TimeADT) pq_getmsgint64(buf));
#else
PG_RETURN_TIMEADT((TimeADT) pq_getmsgfloat8(buf));
#endif
}
/*
* time_send - converts time to binary format
*/
Datum
time_send(PG_FUNCTION_ARGS)
{
TimeADT time = PG_GETARG_TIMEADT(0);
StringInfoData buf;
pq_begintypsend(&buf);
#ifdef HAVE_INT64_TIMESTAMP
pq_sendint64(&buf, time);
#else
pq_sendfloat8(&buf, time);
#endif
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* time_scale()
* Adjust time type for specified scale factor.
* Used by PostgreSQL type system to stuff columns.
......@@ -1349,6 +1413,47 @@ timetz_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* timetz_recv - converts external binary format to timetz
*/
Datum
timetz_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
TimeTzADT *time;
time = (TimeTzADT *) palloc(sizeof(TimeTzADT));
#ifdef HAVE_INT64_TIMESTAMP
time->time = pq_getmsgint64(buf);
#else
time->time = pq_getmsgfloat8(buf);
#endif
time->zone = pq_getmsgint(buf, sizeof(time->zone));
PG_RETURN_TIMETZADT_P(time);
}
/*
* timetz_send - converts timetz to binary format
*/
Datum
timetz_send(PG_FUNCTION_ARGS)
{
TimeTzADT *time = PG_GETARG_TIMETZADT_P(0);
StringInfoData buf;
pq_begintypsend(&buf);
#ifdef HAVE_INT64_TIMESTAMP
pq_sendint64(&buf, time->time);
#else
pq_sendfloat8(&buf, time->time);
#endif
pq_sendint(&buf, time->zone, sizeof(time->zone));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* timetz2tm()
* Convert TIME WITH TIME ZONE data type to POSIX time structure.
*/
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.107 2003/05/04 04:30:15 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.108 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -23,6 +23,7 @@
#include <limits.h>
#include "access/xact.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "utils/builtins.h"
......@@ -347,11 +348,11 @@ tm2abstime(struct tm * tm, int tz)
}
/* nabstimein()
/* abstimein()
* Decode date/time string and return abstime.
*/
Datum
nabstimein(PG_FUNCTION_ARGS)
abstimein(PG_FUNCTION_ARGS)
{
char *str = PG_GETARG_CSTRING(0);
AbsoluteTime result;
......@@ -409,11 +410,11 @@ nabstimein(PG_FUNCTION_ARGS)
}
/* nabstimeout()
/* abstimeout()
* Given an AbsoluteTime return the English text version of the date
*/
Datum
nabstimeout(PG_FUNCTION_ARGS)
abstimeout(PG_FUNCTION_ARGS)
{
AbsoluteTime time = PG_GETARG_ABSOLUTETIME(0);
char *result;
......@@ -450,6 +451,31 @@ nabstimeout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* abstimerecv - converts external binary format to abstime
*/
Datum
abstimerecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
PG_RETURN_ABSOLUTETIME((AbsoluteTime) pq_getmsgint(buf, sizeof(AbsoluteTime)));
}
/*
* abstimesend - converts abstime to binary format
*/
Datum
abstimesend(PG_FUNCTION_ARGS)
{
AbsoluteTime time = PG_GETARG_ABSOLUTETIME(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, time, sizeof(time));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* abstime_finite()
*/
......@@ -751,7 +777,6 @@ reltimein(PG_FUNCTION_ARGS)
PG_RETURN_RELATIVETIME(result);
}
/*
* reltimeout - converts the internal format to a reltime string
*/
......@@ -771,6 +796,31 @@ reltimeout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* reltimerecv - converts external binary format to reltime
*/
Datum
reltimerecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
PG_RETURN_RELATIVETIME((RelativeTime) pq_getmsgint(buf, sizeof(RelativeTime)));
}
/*
* reltimesend - converts reltime to binary format
*/
Datum
reltimesend(PG_FUNCTION_ARGS)
{
RelativeTime time = PG_GETARG_RELATIVETIME(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, time, sizeof(time));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
static void
reltime2tm(RelativeTime time, struct tm * tm)
......@@ -817,7 +867,6 @@ tintervalin(PG_FUNCTION_ARGS)
/*
* tintervalout - converts an internal interval format to a string
*
*/
Datum
tintervalout(PG_FUNCTION_ARGS)
......@@ -832,12 +881,12 @@ tintervalout(PG_FUNCTION_ARGS)
strcat(i_str, INVALID_INTERVAL_STR);
else
{
p = DatumGetCString(DirectFunctionCall1(nabstimeout,
p = DatumGetCString(DirectFunctionCall1(abstimeout,
AbsoluteTimeGetDatum(interval->data[0])));
strcat(i_str, p);
pfree(p);
strcat(i_str, "\" \"");
p = DatumGetCString(DirectFunctionCall1(nabstimeout,
p = DatumGetCString(DirectFunctionCall1(abstimeout,
AbsoluteTimeGetDatum(interval->data[1])));
strcat(i_str, p);
pfree(p);
......@@ -846,6 +895,43 @@ tintervalout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(i_str);
}
/*
* tintervalrecv - converts external binary format to tinterval
*/
Datum
tintervalrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
TimeInterval interval;
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
interval->status = pq_getmsgint(buf, sizeof(interval->status));
if (!(interval->status == T_INTERVAL_INVAL ||
interval->status == T_INTERVAL_VALID))
elog(ERROR, "Invalid status in external tinterval");
interval->data[0] = pq_getmsgint(buf, sizeof(interval->data[0]));
interval->data[1] = pq_getmsgint(buf, sizeof(interval->data[1]));
PG_RETURN_TIMEINTERVAL(interval);
}
/*
* tintervalsend - converts tinterval to binary format
*/
Datum
tintervalsend(PG_FUNCTION_ARGS)
{
TimeInterval interval = PG_GETARG_TIMEINTERVAL(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, interval->status, sizeof(interval->status));
pq_sendint(&buf, interval->data[0], sizeof(interval->data[0]));
pq_sendint(&buf, interval->data[1], sizeof(interval->data[1]));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/*****************************************************************************
* PUBLIC ROUTINES *
......@@ -1558,7 +1644,7 @@ istinterval(char *i_string,
p1++;
}
/* get the first date */
*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,
*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
CStringGetDatum(p)));
/* rechange NULL at the end of the first date to a "'" */
*p1 = '"';
......@@ -1586,7 +1672,7 @@ istinterval(char *i_string,
p1++;
}
/* get the second date */
*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,
*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
CStringGetDatum(p)));
/* rechange NULL at the end of the first date to a ''' */
*p1 = '"';
......
......@@ -14,7 +14,7 @@
* Copyright (c) 1998-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.60 2003/04/21 00:22:24 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.61 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -28,6 +28,7 @@
#include <errno.h>
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/int8.h"
......@@ -370,6 +371,79 @@ numeric_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(str);
}
/*
* numeric_recv - converts external binary format to numeric
*
* External format is a sequence of int16's:
* ndigits, weight, sign, dscale, NumericDigits.
*/
Datum
numeric_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
NumericVar value;
Numeric res;
int len,
i;
init_var(&value);
len = (uint16) pq_getmsgint(buf, sizeof(uint16));
if (len < 0 || len > NUMERIC_MAX_PRECISION + NUMERIC_MAX_RESULT_SCALE)
elog(ERROR, "Invalid length in external numeric");
alloc_var(&value, len);
value.weight = (int16) pq_getmsgint(buf, sizeof(int16));
value.sign = (uint16) pq_getmsgint(buf, sizeof(uint16));
if (!(value.sign == NUMERIC_POS ||
value.sign == NUMERIC_NEG ||
value.sign == NUMERIC_NAN))
elog(ERROR, "Invalid sign in external numeric");
value.dscale = (uint16) pq_getmsgint(buf, sizeof(uint16));
for (i = 0; i < len; i++)
{
NumericDigit d = pq_getmsgint(buf, sizeof(NumericDigit));
if (d < 0 || d >= NBASE)
elog(ERROR, "Invalid digit in external numeric");
value.digits[i] = d;
}
res = make_result(&value);
free_var(&value);
PG_RETURN_NUMERIC(res);
}
/*
* numeric_send - converts numeric to binary format
*/
Datum
numeric_send(PG_FUNCTION_ARGS)
{
Numeric num = PG_GETARG_NUMERIC(0);
NumericVar x;
StringInfoData buf;
int i;
init_var(&x);
set_var_from_num(num, &x);
pq_begintypsend(&buf);
pq_sendint(&buf, x.ndigits, sizeof(int16));
pq_sendint(&buf, x.weight, sizeof(int16));
pq_sendint(&buf, x.sign, sizeof(int16));
pq_sendint(&buf, x.dscale, sizeof(int16));
for (i = 0; i < x.ndigits; i++)
pq_sendint(&buf, x.digits[i], sizeof(NumericDigit));
free_var(&x);
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/*
* numeric() -
......
......@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.76 2002/09/18 21:35:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.77 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -200,6 +200,26 @@ regprocout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* regprocrecv - converts external binary format to regproc
*/
Datum
regprocrecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidrecv, so share code */
return oidrecv(fcinfo);
}
/*
* regprocsend - converts regproc to binary format
*/
Datum
regprocsend(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidsend, so share code */
return oidsend(fcinfo);
}
/*
* regprocedurein - converts "proname(args)" to proc OID
......@@ -343,6 +363,26 @@ regprocedureout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* regprocedurerecv - converts external binary format to regprocedure
*/
Datum
regprocedurerecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidrecv, so share code */
return oidrecv(fcinfo);
}
/*
* regproceduresend - converts regprocedure to binary format
*/
Datum
regproceduresend(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidsend, so share code */
return oidsend(fcinfo);
}
/*
* regoperin - converts "oprname" to operator OID
......@@ -506,6 +546,26 @@ regoperout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* regoperrecv - converts external binary format to regoper
*/
Datum
regoperrecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidrecv, so share code */
return oidrecv(fcinfo);
}
/*
* regopersend - converts regoper to binary format
*/
Datum
regopersend(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidsend, so share code */
return oidsend(fcinfo);
}
/*
* regoperatorin - converts "oprname(args)" to operator OID
......@@ -666,6 +726,26 @@ regoperatorout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* regoperatorrecv - converts external binary format to regoperator
*/
Datum
regoperatorrecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidrecv, so share code */
return oidrecv(fcinfo);
}
/*
* regoperatorsend - converts regoperator to binary format
*/
Datum
regoperatorsend(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidsend, so share code */
return oidsend(fcinfo);
}
/*
* regclassin - converts "classname" to class OID
......@@ -804,6 +884,26 @@ regclassout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* regclassrecv - converts external binary format to regclass
*/
Datum
regclassrecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidrecv, so share code */
return oidrecv(fcinfo);
}
/*
* regclasssend - converts regclass to binary format
*/
Datum
regclasssend(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidsend, so share code */
return oidsend(fcinfo);
}
/*
* regtypein - converts "typename" to type OID
......@@ -936,6 +1036,26 @@ regtypeout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* regtyperecv - converts external binary format to regtype
*/
Datum
regtyperecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidrecv, so share code */
return oidrecv(fcinfo);
}
/*
* regtypesend - converts regtype to binary format
*/
Datum
regtypesend(PG_FUNCTION_ARGS)
{
/* Exactly the same as oidsend, so share code */
return oidsend(fcinfo);
}
/*
* Given a C string, parse it into a qualified-name list.
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.36 2002/09/04 20:31:29 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.37 2003/05/12 23:08:50 tgl Exp $
*
* NOTES
* input routine largely stolen from boxin().
......@@ -24,8 +24,10 @@
#include "access/heapam.h"
#include "catalog/namespace.h"
#include "utils/builtins.h"
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
#define DatumGetItemPointer(X) ((ItemPointer) DatumGetPointer(X))
#define ItemPointerGetDatum(X) PointerGetDatum(X)
......@@ -91,13 +93,11 @@ tidout(PG_FUNCTION_ARGS)
BlockNumber blockNumber;
OffsetNumber offsetNumber;
char buf[32];
static char *invalidTid = "()";
if (!ItemPointerIsValid(itemPtr))
PG_RETURN_CSTRING(pstrdup(invalidTid));
PG_RETURN_CSTRING(pstrdup("()"));
blockId = &(itemPtr->ip_blkid);
blockNumber = BlockIdGetBlockNumber(blockId);
offsetNumber = itemPtr->ip_posid;
......@@ -106,6 +106,49 @@ tidout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(pstrdup(buf));
}
/*
* tidrecv - converts external binary format to tid
*/
Datum
tidrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
ItemPointer result;
BlockNumber blockNumber;
OffsetNumber offsetNumber;
blockNumber = pq_getmsgint(buf, sizeof(blockNumber));
offsetNumber = pq_getmsgint(buf, sizeof(offsetNumber));
result = (ItemPointer) palloc(sizeof(ItemPointerData));
ItemPointerSet(result, blockNumber, offsetNumber);
PG_RETURN_ITEMPOINTER(result);
}
/*
* tidsend - converts tid to binary format
*/
Datum
tidsend(PG_FUNCTION_ARGS)
{
ItemPointer itemPtr = PG_GETARG_ITEMPOINTER(0);
BlockId blockId;
BlockNumber blockNumber;
OffsetNumber offsetNumber;
StringInfoData buf;
blockId = &(itemPtr->ip_blkid);
blockNumber = BlockIdGetBlockNumber(blockId);
offsetNumber = itemPtr->ip_posid;
pq_begintypsend(&buf);
pq_sendint(&buf, blockNumber, sizeof(blockNumber));
pq_sendint(&buf, offsetNumber, sizeof(offsetNumber));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/*****************************************************************************
* PUBLIC ROUTINES *
*****************************************************************************/
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.83 2003/04/07 15:04:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.84 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -24,6 +24,7 @@
#include "access/hash.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "utils/array.h"
#include "utils/builtins.h"
......@@ -142,6 +143,43 @@ timestamp_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* timestamp_recv - converts external binary format to timestamp
*
* We make no attempt to provide compatibility between int and float
* timestamp representations ...
*/
Datum
timestamp_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
#ifdef HAVE_INT64_TIMESTAMP
PG_RETURN_TIMESTAMP((Timestamp) pq_getmsgint64(buf));
#else
PG_RETURN_TIMESTAMP((Timestamp) pq_getmsgfloat8(buf));
#endif
}
/*
* timestamp_send - converts timestamp to binary format
*/
Datum
timestamp_send(PG_FUNCTION_ARGS)
{
Timestamp timestamp = PG_GETARG_TIMESTAMP(0);
StringInfoData buf;
pq_begintypsend(&buf);
#ifdef HAVE_INT64_TIMESTAMP
pq_sendint64(&buf, timestamp);
#else
pq_sendfloat8(&buf, timestamp);
#endif
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* timestamp_scale()
* Adjust time type for specified scale factor.
* Used by PostgreSQL type system to stuff columns.
......@@ -300,7 +338,7 @@ timestamptz_in(PG_FUNCTION_ARGS)
Datum
timestamptz_out(PG_FUNCTION_ARGS)
{
TimestampTz dt = PG_GETARG_TIMESTAMP(0);
TimestampTz dt = PG_GETARG_TIMESTAMPTZ(0);
char *result;
int tz;
struct tm tt,
......@@ -320,6 +358,43 @@ timestamptz_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* timestamptz_recv - converts external binary format to timestamptz
*
* We make no attempt to provide compatibility between int and float
* timestamp representations ...
*/
Datum
timestamptz_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
#ifdef HAVE_INT64_TIMESTAMP
PG_RETURN_TIMESTAMPTZ((TimestampTz) pq_getmsgint64(buf));
#else
PG_RETURN_TIMESTAMPTZ((TimestampTz) pq_getmsgfloat8(buf));
#endif
}
/*
* timestamptz_send - converts timestamptz to binary format
*/
Datum
timestamptz_send(PG_FUNCTION_ARGS)
{
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(0);
StringInfoData buf;
pq_begintypsend(&buf);
#ifdef HAVE_INT64_TIMESTAMP
pq_sendint64(&buf, timestamp);
#else
pq_sendfloat8(&buf, timestamp);
#endif
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* timestamptz_scale()
* Adjust time type for specified scale factor.
* Used by PostgreSQL type system to stuff columns.
......@@ -327,7 +402,7 @@ timestamptz_out(PG_FUNCTION_ARGS)
Datum
timestamptz_scale(PG_FUNCTION_ARGS)
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(0);
int32 typmod = PG_GETARG_INT32(1);
TimestampTz result;
......@@ -423,6 +498,47 @@ interval_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* interval_recv - converts external binary format to interval
*/
Datum
interval_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
Interval *interval;
interval = (Interval *) palloc(sizeof(Interval));
#ifdef HAVE_INT64_TIMESTAMP
interval->time = pq_getmsgint64(buf);
#else
interval->time = pq_getmsgfloat8(buf);
#endif
interval->month = pq_getmsgint(buf, sizeof(interval->month));
PG_RETURN_INTERVAL_P(interval);
}
/*
* interval_send - converts interval to binary format
*/
Datum
interval_send(PG_FUNCTION_ARGS)
{
Interval *interval = PG_GETARG_INTERVAL_P(0);
StringInfoData buf;
pq_begintypsend(&buf);
#ifdef HAVE_INT64_TIMESTAMP
pq_sendint64(&buf, interval->time);
#else
pq_sendfloat8(&buf, interval->time);
#endif
pq_sendint(&buf, interval->month, sizeof(interval->month));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* interval_scale()
* Adjust interval type for specified fields.
* Used by PostgreSQL type system to stuff columns.
......@@ -1594,7 +1710,7 @@ timestamp_mi_span(PG_FUNCTION_ARGS)
Datum
timestamptz_pl_span(PG_FUNCTION_ARGS)
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(0);
Interval *span = PG_GETARG_INTERVAL_P(1);
TimestampTz result;
int tz;
......@@ -1651,7 +1767,7 @@ timestamptz_pl_span(PG_FUNCTION_ARGS)
Datum
timestamptz_mi_span(PG_FUNCTION_ARGS)
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(0);
Interval *span = PG_GETARG_INTERVAL_P(1);
Interval tspan;
......@@ -2094,8 +2210,8 @@ timestamp_age(PG_FUNCTION_ARGS)
Datum
timestamptz_age(PG_FUNCTION_ARGS)
{
TimestampTz dt1 = PG_GETARG_TIMESTAMP(0);
TimestampTz dt2 = PG_GETARG_TIMESTAMP(1);
TimestampTz dt1 = PG_GETARG_TIMESTAMPTZ(0);
TimestampTz dt2 = PG_GETARG_TIMESTAMPTZ(1);
Interval *result;
fsec_t fsec,
fsec1,
......@@ -2463,7 +2579,7 @@ Datum
timestamptz_trunc(PG_FUNCTION_ARGS)
{
text *units = PG_GETARG_TEXT_P(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMP(1);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(1);
TimestampTz result;
int tz;
int type,
......@@ -2918,7 +3034,7 @@ Datum
timestamptz_part(PG_FUNCTION_ARGS)
{
text *units = PG_GETARG_TEXT_P(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMP(1);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(1);
float8 result;
int tz;
int type,
......@@ -3349,7 +3465,7 @@ timestamp_timestamptz(PG_FUNCTION_ARGS)
Datum
timestamptz_timestamp(PG_FUNCTION_ARGS)
{
TimestampTz timestamp = PG_GETARG_TIMESTAMP(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(0);
Timestamp result;
struct tm tt,
*tm = &tt;
......@@ -3379,7 +3495,7 @@ Datum
timestamptz_zone(PG_FUNCTION_ARGS)
{
text *zone = PG_GETARG_TEXT_P(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMP(1);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(1);
Timestamp result;
int tz;
......@@ -3428,7 +3544,7 @@ Datum
timestamptz_izone(PG_FUNCTION_ARGS)
{
Interval *zone = PG_GETARG_INTERVAL_P(0);
TimestampTz timestamp = PG_GETARG_TIMESTAMP(1);
TimestampTz timestamp = PG_GETARG_TIMESTAMPTZ(1);
Timestamp result;
int tz;
......
......@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.29 2002/11/13 00:39:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.30 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -17,6 +17,7 @@
#include "postgres.h"
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/fmgroids.h"
#include "utils/memutils.h"
......@@ -204,6 +205,26 @@ bit_out(PG_FUNCTION_ARGS)
#endif
}
/*
* bit_recv - converts external binary format to bit
*/
Datum
bit_recv(PG_FUNCTION_ARGS)
{
/* Exactly the same as varbit_recv, so share code */
return varbit_recv(fcinfo);
}
/*
* bit_send - converts bit to binary format
*/
Datum
bit_send(PG_FUNCTION_ARGS)
{
/* Exactly the same as varbit_send, so share code */
return varbit_send(fcinfo);
}
/* bit()
* Converts a bit() type to a specific internal length.
* len is the bitlength specified in the column definition.
......@@ -407,6 +428,58 @@ varbit_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* varbit_recv - converts external binary format to varbit
*
* External format is the bitlen as an int32, then the byte array.
*/
Datum
varbit_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
VarBit *result;
int len,
bitlen;
int ipad;
bits8 mask;
bitlen = pq_getmsgint(buf, sizeof(int32));
if (bitlen < 0)
elog(ERROR, "Invalid length in external bit string");
len = VARBITTOTALLEN(bitlen);
result = (VarBit *) palloc(len);
VARATT_SIZEP(result) = len;
VARBITLEN(result) = bitlen;
pq_copymsgbytes(buf, (char *) VARBITS(result), VARBITBYTES(result));
/* Make sure last byte is zero-padded if needed */
ipad = VARBITPAD(result);
if (ipad > 0)
{
mask = BITMASK << ipad;
*(VARBITS(result) + VARBITBYTES(result) - 1) &= mask;
}
PG_RETURN_VARBIT_P(result);
}
/*
* varbit_send - converts varbit to binary format
*/
Datum
varbit_send(PG_FUNCTION_ARGS)
{
VarBit *s = PG_GETARG_VARBIT_P(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, VARBITLEN(s), sizeof(int32));
pq_sendbytes(&buf, VARBITS(s), VARBITBYTES(s));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/* varbit()
* Converts a varbit() type to a specific internal length.
* len is the maximum bitlength specified in the column definition.
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.95 2002/09/18 21:35:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.96 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -163,6 +163,26 @@ bpcharout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* bpcharrecv - converts external binary format to bpchar
*/
Datum
bpcharrecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as textrecv, so share code */
return textrecv(fcinfo);
}
/*
* bpcharsend - converts bpchar to binary format
*/
Datum
bpcharsend(PG_FUNCTION_ARGS)
{
/* Exactly the same as textsend, so share code */
return textsend(fcinfo);
}
/*
* Converts a CHARACTER type to the specified size.
......@@ -405,6 +425,26 @@ varcharout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
/*
* varcharrecv - converts external binary format to varchar
*/
Datum
varcharrecv(PG_FUNCTION_ARGS)
{
/* Exactly the same as textrecv, so share code */
return textrecv(fcinfo);
}
/*
* varcharsend - converts varchar to binary format
*/
Datum
varcharsend(PG_FUNCTION_ARGS)
{
/* Exactly the same as textsend, so share code */
return textsend(fcinfo);
}
/*
* Converts a VARCHAR type to the specified size.
......
/*-------------------------------------------------------------------------
*
* xid.c
* POSTGRES transaction identifier datatype.
* POSTGRES transaction identifier and command identifier datatypes.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: xid.c,v 1.35 2002/06/20 20:29:25 momjian Exp $
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/xid.c,v 1.1 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <limits.h>
#include "access/xact.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
#define PG_GETARG_TRANSACTIONID(n) DatumGetTransactionId(PG_GETARG_DATUM(n))
#define PG_RETURN_TRANSACTIONID(x) return TransactionIdGetDatum(x)
#define PG_GETARG_COMMANDID(n) DatumGetCommandId(PG_GETARG_DATUM(n))
#define PG_RETURN_COMMANDID(x) return CommandIdGetDatum(x)
Datum
xidin(PG_FUNCTION_ARGS)
......@@ -43,6 +49,31 @@ xidout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(str);
}
/*
* xidrecv - converts external binary format to xid
*/
Datum
xidrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
PG_RETURN_TRANSACTIONID((TransactionId) pq_getmsgint(buf, sizeof(TransactionId)));
}
/*
* xidsend - converts xid to binary format
*/
Datum
xidsend(PG_FUNCTION_ARGS)
{
TransactionId arg1 = PG_GETARG_TRANSACTIONID(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, arg1, sizeof(arg1));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
/*
* xideq - are two xids equal?
*/
......@@ -70,3 +101,69 @@ xid_age(PG_FUNCTION_ARGS)
PG_RETURN_INT32((int32) (now - xid));
}
/*****************************************************************************
* COMMAND IDENTIFIER ROUTINES *
*****************************************************************************/
/*
* cidin - converts CommandId to internal representation.
*/
Datum
cidin(PG_FUNCTION_ARGS)
{
char *s = PG_GETARG_CSTRING(0);
CommandId c;
c = atoi(s);
PG_RETURN_COMMANDID(c);
}
/*
* cidout - converts a cid to external representation.
*/
Datum
cidout(PG_FUNCTION_ARGS)
{
CommandId c = PG_GETARG_COMMANDID(0);
char *result = (char *) palloc(16);
snprintf(result, 16, "%u", (unsigned int) c);
PG_RETURN_CSTRING(result);
}
/*
* cidrecv - converts external binary format to cid
*/
Datum
cidrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
PG_RETURN_COMMANDID((CommandId) pq_getmsgint(buf, sizeof(CommandId)));
}
/*
* cidsend - converts cid to binary format
*/
Datum
cidsend(PG_FUNCTION_ARGS)
{
CommandId arg1 = PG_GETARG_COMMANDID(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, arg1, sizeof(arg1));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
Datum
cideq(PG_FUNCTION_ARGS)
{
CommandId arg1 = PG_GETARG_COMMANDID(0);
CommandId arg2 = PG_GETARG_COMMANDID(1);
PG_RETURN_BOOL(arg1 == arg2);
}
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: xact.h,v 1.50 2003/04/26 20:22:59 tgl Exp $
* $Id: xact.h,v 1.51 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -140,10 +140,4 @@ extern void xact_redo(XLogRecPtr lsn, XLogRecord *record);
extern void xact_undo(XLogRecPtr lsn, XLogRecord *record);
extern void xact_desc(char *buf, uint8 xl_info, char *rec);
/* defined in xid.c */
extern Datum xidin(PG_FUNCTION_ARGS);
extern Datum xidout(PG_FUNCTION_ARGS);
extern Datum xideq(PG_FUNCTION_ARGS);
extern Datum xid_age(PG_FUNCTION_ARGS);
#endif /* XACT_H */
......@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catversion.h,v 1.190 2003/05/09 23:01:45 tgl Exp $
* $Id: catversion.h,v 1.191 2003/05/12 23:08:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200305093
#define CATALOG_VERSION_NO 200305121
#endif
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.297 2003/05/09 23:01:45 tgl Exp $
* $Id: pg_proc.h,v 1.298 2003/05/12 23:08:51 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
......@@ -500,9 +500,9 @@ DESCR("convert float4 to int2");
DATA(insert OID = 239 ( line_distance PGNSP PGUID 12 f f t f i 2 701 "628 628" line_distance - _null_ ));
DESCR("distance between");
DATA(insert OID = 240 ( nabstimein PGNSP PGUID 12 f f t f s 1 702 "2275" nabstimein - _null_ ));
DATA(insert OID = 240 ( abstimein PGNSP PGUID 12 f f t f s 1 702 "2275" abstimein - _null_ ));
DESCR("I/O");
DATA(insert OID = 241 ( nabstimeout PGNSP PGUID 12 f f t f s 1 2275 "702" nabstimeout - _null_ ));
DATA(insert OID = 241 ( abstimeout PGNSP PGUID 12 f f t f s 1 2275 "702" abstimeout - _null_ ));
DESCR("I/O");
DATA(insert OID = 242 ( reltimein PGNSP PGUID 12 f f t f s 1 703 "2275" reltimein - _null_ ));
DESCR("I/O");
......@@ -3213,6 +3213,106 @@ DATA(insert OID = 2428 ( point_recv PGNSP PGUID 12 f f t f i 1 600 "2281"
DESCR("I/O");
DATA(insert OID = 2429 ( point_send PGNSP PGUID 12 f f t f i 1 17 "600" point_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2430 ( bpcharrecv PGNSP PGUID 12 f f t f s 1 1042 "2281" bpcharrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2431 ( bpcharsend PGNSP PGUID 12 f f t f s 1 17 "1042" bpcharsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2432 ( varcharrecv PGNSP PGUID 12 f f t f s 1 1043 "2281" varcharrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2433 ( varcharsend PGNSP PGUID 12 f f t f s 1 17 "1043" varcharsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2434 ( charrecv PGNSP PGUID 12 f f t f i 1 18 "2281" charrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2435 ( charsend PGNSP PGUID 12 f f t f i 1 17 "18" charsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2436 ( boolrecv PGNSP PGUID 12 f f t f i 1 16 "2281" boolrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2437 ( boolsend PGNSP PGUID 12 f f t f i 1 17 "16" boolsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2438 ( tidrecv PGNSP PGUID 12 f f t f i 1 27 "2281" tidrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2439 ( tidsend PGNSP PGUID 12 f f t f i 1 17 "27" tidsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2440 ( xidrecv PGNSP PGUID 12 f f t f i 1 28 "2281" xidrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2441 ( xidsend PGNSP PGUID 12 f f t f i 1 17 "28" xidsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2442 ( cidrecv PGNSP PGUID 12 f f t f i 1 29 "2281" cidrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2443 ( cidsend PGNSP PGUID 12 f f t f i 1 17 "29" cidsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2444 ( regprocrecv PGNSP PGUID 12 f f t f i 1 24 "2281" regprocrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2445 ( regprocsend PGNSP PGUID 12 f f t f i 1 17 "24" regprocsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2446 ( regprocedurerecv PGNSP PGUID 12 f f t f i 1 2202 "2281" regprocedurerecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2447 ( regproceduresend PGNSP PGUID 12 f f t f i 1 17 "2202" regproceduresend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2448 ( regoperrecv PGNSP PGUID 12 f f t f i 1 2203 "2281" regoperrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2449 ( regopersend PGNSP PGUID 12 f f t f i 1 17 "2203" regopersend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2450 ( regoperatorrecv PGNSP PGUID 12 f f t f i 1 2204 "2281" regoperatorrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2451 ( regoperatorsend PGNSP PGUID 12 f f t f i 1 17 "2204" regoperatorsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2452 ( regclassrecv PGNSP PGUID 12 f f t f i 1 2205 "2281" regclassrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2453 ( regclasssend PGNSP PGUID 12 f f t f i 1 17 "2205" regclasssend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2454 ( regtyperecv PGNSP PGUID 12 f f t f i 1 2206 "2281" regtyperecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2455 ( regtypesend PGNSP PGUID 12 f f t f i 1 17 "2206" regtypesend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2456 ( bit_recv PGNSP PGUID 12 f f t f i 1 1560 "2281" bit_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2457 ( bit_send PGNSP PGUID 12 f f t f i 1 17 "1560" bit_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2458 ( varbit_recv PGNSP PGUID 12 f f t f i 1 1562 "2281" varbit_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2459 ( varbit_send PGNSP PGUID 12 f f t f i 1 17 "1562" varbit_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2460 ( numeric_recv PGNSP PGUID 12 f f t f i 1 1700 "2281" numeric_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2461 ( numeric_send PGNSP PGUID 12 f f t f i 1 17 "1700" numeric_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2462 ( abstimerecv PGNSP PGUID 12 f f t f i 1 702 "2281" abstimerecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2463 ( abstimesend PGNSP PGUID 12 f f t f i 1 17 "702" abstimesend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2464 ( reltimerecv PGNSP PGUID 12 f f t f i 1 703 "2281" reltimerecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2465 ( reltimesend PGNSP PGUID 12 f f t f i 1 17 "703" reltimesend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2466 ( tintervalrecv PGNSP PGUID 12 f f t f i 1 704 "2281" tintervalrecv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2467 ( tintervalsend PGNSP PGUID 12 f f t f i 1 17 "704" tintervalsend - _null_ ));
DESCR("I/O");
DATA(insert OID = 2468 ( date_recv PGNSP PGUID 12 f f t f i 1 1082 "2281" date_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2469 ( date_send PGNSP PGUID 12 f f t f i 1 17 "1082" date_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2470 ( time_recv PGNSP PGUID 12 f f t f i 1 1083 "2281" time_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2471 ( time_send PGNSP PGUID 12 f f t f i 1 17 "1083" time_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2472 ( timetz_recv PGNSP PGUID 12 f f t f i 1 1266 "2281" timetz_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2473 ( timetz_send PGNSP PGUID 12 f f t f i 1 17 "1266" timetz_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2474 ( timestamp_recv PGNSP PGUID 12 f f t f i 1 1114 "2281" timestamp_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2475 ( timestamp_send PGNSP PGUID 12 f f t f i 1 17 "1114" timestamp_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2476 ( timestamptz_recv PGNSP PGUID 12 f f t f i 1 1184 "2281" timestamptz_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2477 ( timestamptz_send PGNSP PGUID 12 f f t f i 1 17 "1184" timestamptz_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2478 ( interval_recv PGNSP PGUID 12 f f t f i 1 1186 "2281" interval_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2479 ( interval_send PGNSP PGUID 12 f f t f i 1 17 "1186" interval_send - _null_ ));
DESCR("I/O");
/*
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.214 2003/05/09 21:19:50 tgl Exp $
* $Id: builtins.h,v 1.215 2003/05/12 23:08:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -57,6 +57,8 @@ extern Datum has_schema_privilege_id(PG_FUNCTION_ARGS);
/* bool.c */
extern Datum boolin(PG_FUNCTION_ARGS);
extern Datum boolout(PG_FUNCTION_ARGS);
extern Datum boolrecv(PG_FUNCTION_ARGS);
extern Datum boolsend(PG_FUNCTION_ARGS);
extern Datum booleq(PG_FUNCTION_ARGS);
extern Datum boolne(PG_FUNCTION_ARGS);
extern Datum boollt(PG_FUNCTION_ARGS);
......@@ -71,6 +73,8 @@ extern Datum isnotfalse(PG_FUNCTION_ARGS);
/* char.c */
extern Datum charin(PG_FUNCTION_ARGS);
extern Datum charout(PG_FUNCTION_ARGS);
extern Datum charrecv(PG_FUNCTION_ARGS);
extern Datum charsend(PG_FUNCTION_ARGS);
extern Datum chareq(PG_FUNCTION_ARGS);
extern Datum charne(PG_FUNCTION_ARGS);
extern Datum charlt(PG_FUNCTION_ARGS);
......@@ -83,9 +87,6 @@ extern Datum charmul(PG_FUNCTION_ARGS);
extern Datum chardiv(PG_FUNCTION_ARGS);
extern Datum text_char(PG_FUNCTION_ARGS);
extern Datum char_text(PG_FUNCTION_ARGS);
extern Datum cidin(PG_FUNCTION_ARGS);
extern Datum cidout(PG_FUNCTION_ARGS);
extern Datum cideq(PG_FUNCTION_ARGS);
/* int.c */
extern Datum int2in(PG_FUNCTION_ARGS);
......@@ -400,16 +401,28 @@ extern const char *assign_regex_flavor(const char *value,
/* regproc.c */
extern Datum regprocin(PG_FUNCTION_ARGS);
extern Datum regprocout(PG_FUNCTION_ARGS);
extern Datum regprocrecv(PG_FUNCTION_ARGS);
extern Datum regprocsend(PG_FUNCTION_ARGS);
extern Datum regprocedurein(PG_FUNCTION_ARGS);
extern Datum regprocedureout(PG_FUNCTION_ARGS);
extern Datum regprocedurerecv(PG_FUNCTION_ARGS);
extern Datum regproceduresend(PG_FUNCTION_ARGS);
extern Datum regoperin(PG_FUNCTION_ARGS);
extern Datum regoperout(PG_FUNCTION_ARGS);
extern Datum regoperrecv(PG_FUNCTION_ARGS);
extern Datum regopersend(PG_FUNCTION_ARGS);
extern Datum regoperatorin(PG_FUNCTION_ARGS);
extern Datum regoperatorout(PG_FUNCTION_ARGS);
extern Datum regoperatorrecv(PG_FUNCTION_ARGS);
extern Datum regoperatorsend(PG_FUNCTION_ARGS);
extern Datum regclassin(PG_FUNCTION_ARGS);
extern Datum regclassout(PG_FUNCTION_ARGS);
extern Datum regclassrecv(PG_FUNCTION_ARGS);
extern Datum regclasssend(PG_FUNCTION_ARGS);
extern Datum regtypein(PG_FUNCTION_ARGS);
extern Datum regtypeout(PG_FUNCTION_ARGS);
extern Datum regtyperecv(PG_FUNCTION_ARGS);
extern Datum regtypesend(PG_FUNCTION_ARGS);
extern List *stringToQualifiedNameList(const char *string, const char *caller);
extern char *format_procedure(Oid procedure_oid);
extern char *format_operator(Oid operator_oid);
......@@ -437,16 +450,20 @@ extern char *quote_qualified_identifier(const char *namespace,
const char *ident);
/* tid.c */
extern void setLastTid(const ItemPointer tid);
extern Datum tidin(PG_FUNCTION_ARGS);
extern Datum tidout(PG_FUNCTION_ARGS);
extern Datum tidrecv(PG_FUNCTION_ARGS);
extern Datum tidsend(PG_FUNCTION_ARGS);
extern Datum tideq(PG_FUNCTION_ARGS);
extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
extern void setLastTid(const ItemPointer tid);
/* varchar.c */
extern Datum bpcharin(PG_FUNCTION_ARGS);
extern Datum bpcharout(PG_FUNCTION_ARGS);
extern Datum bpcharrecv(PG_FUNCTION_ARGS);
extern Datum bpcharsend(PG_FUNCTION_ARGS);
extern Datum bpchar(PG_FUNCTION_ARGS);
extern Datum char_bpchar(PG_FUNCTION_ARGS);
extern Datum name_bpchar(PG_FUNCTION_ARGS);
......@@ -464,6 +481,8 @@ extern Datum hashbpchar(PG_FUNCTION_ARGS);
extern Datum varcharin(PG_FUNCTION_ARGS);
extern Datum varcharout(PG_FUNCTION_ARGS);
extern Datum varcharrecv(PG_FUNCTION_ARGS);
extern Datum varcharsend(PG_FUNCTION_ARGS);
extern Datum varchar(PG_FUNCTION_ARGS);
extern Datum varchareq(PG_FUNCTION_ARGS);
extern Datum varcharne(PG_FUNCTION_ARGS);
......@@ -537,6 +556,19 @@ extern Datum bytea_substr_no_len(PG_FUNCTION_ARGS);
/* version.c */
extern Datum pgsql_version(PG_FUNCTION_ARGS);
/* xid.c */
extern Datum xidin(PG_FUNCTION_ARGS);
extern Datum xidout(PG_FUNCTION_ARGS);
extern Datum xidrecv(PG_FUNCTION_ARGS);
extern Datum xidsend(PG_FUNCTION_ARGS);
extern Datum xideq(PG_FUNCTION_ARGS);
extern Datum xid_age(PG_FUNCTION_ARGS);
extern Datum cidin(PG_FUNCTION_ARGS);
extern Datum cidout(PG_FUNCTION_ARGS);
extern Datum cidrecv(PG_FUNCTION_ARGS);
extern Datum cidsend(PG_FUNCTION_ARGS);
extern Datum cideq(PG_FUNCTION_ARGS);
/* like.c */
extern Datum namelike(PG_FUNCTION_ARGS);
extern Datum namenlike(PG_FUNCTION_ARGS);
......@@ -625,6 +657,8 @@ extern Datum hashmacaddr(PG_FUNCTION_ARGS);
/* numeric.c */
extern Datum numeric_in(PG_FUNCTION_ARGS);
extern Datum numeric_out(PG_FUNCTION_ARGS);
extern Datum numeric_recv(PG_FUNCTION_ARGS);
extern Datum numeric_send(PG_FUNCTION_ARGS);
extern Datum numeric(PG_FUNCTION_ARGS);
extern Datum numeric_abs(PG_FUNCTION_ARGS);
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: date.h,v 1.22 2003/01/29 01:08:42 tgl Exp $
* $Id: date.h,v 1.23 2003/05/12 23:08:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -70,6 +70,8 @@ typedef struct
/* date.c */
extern Datum date_in(PG_FUNCTION_ARGS);
extern Datum date_out(PG_FUNCTION_ARGS);
extern Datum date_recv(PG_FUNCTION_ARGS);
extern Datum date_send(PG_FUNCTION_ARGS);
extern Datum date_eq(PG_FUNCTION_ARGS);
extern Datum date_ne(PG_FUNCTION_ARGS);
extern Datum date_lt(PG_FUNCTION_ARGS);
......@@ -93,6 +95,8 @@ extern Datum date_text(PG_FUNCTION_ARGS);
extern Datum time_in(PG_FUNCTION_ARGS);
extern Datum time_out(PG_FUNCTION_ARGS);
extern Datum time_recv(PG_FUNCTION_ARGS);
extern Datum time_send(PG_FUNCTION_ARGS);
extern Datum time_scale(PG_FUNCTION_ARGS);
extern Datum time_eq(PG_FUNCTION_ARGS);
extern Datum time_ne(PG_FUNCTION_ARGS);
......@@ -118,6 +122,8 @@ extern Datum time_part(PG_FUNCTION_ARGS);
extern Datum timetz_in(PG_FUNCTION_ARGS);
extern Datum timetz_out(PG_FUNCTION_ARGS);
extern Datum timetz_recv(PG_FUNCTION_ARGS);
extern Datum timetz_send(PG_FUNCTION_ARGS);
extern Datum timetz_scale(PG_FUNCTION_ARGS);
extern Datum timetz_eq(PG_FUNCTION_ARGS);
extern Datum timetz_ne(PG_FUNCTION_ARGS);
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: nabstime.h,v 1.38 2003/04/04 04:50:44 tgl Exp $
* $Id: nabstime.h,v 1.39 2003/05/12 23:08:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -100,8 +100,10 @@ typedef TimeIntervalData *TimeInterval;
/*
* nabstime.c prototypes
*/
extern Datum nabstimein(PG_FUNCTION_ARGS);
extern Datum nabstimeout(PG_FUNCTION_ARGS);
extern Datum abstimein(PG_FUNCTION_ARGS);
extern Datum abstimeout(PG_FUNCTION_ARGS);
extern Datum abstimerecv(PG_FUNCTION_ARGS);
extern Datum abstimesend(PG_FUNCTION_ARGS);
extern Datum abstimeeq(PG_FUNCTION_ARGS);
extern Datum abstimene(PG_FUNCTION_ARGS);
......@@ -118,8 +120,12 @@ extern Datum abstime_timestamptz(PG_FUNCTION_ARGS);
extern Datum reltimein(PG_FUNCTION_ARGS);
extern Datum reltimeout(PG_FUNCTION_ARGS);
extern Datum reltimerecv(PG_FUNCTION_ARGS);
extern Datum reltimesend(PG_FUNCTION_ARGS);
extern Datum tintervalin(PG_FUNCTION_ARGS);
extern Datum tintervalout(PG_FUNCTION_ARGS);
extern Datum tintervalrecv(PG_FUNCTION_ARGS);
extern Datum tintervalsend(PG_FUNCTION_ARGS);
extern Datum interval_reltime(PG_FUNCTION_ARGS);
extern Datum reltime_interval(PG_FUNCTION_ARGS);
extern Datum mktinterval(PG_FUNCTION_ARGS);
......
......@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: timestamp.h,v 1.29 2002/09/04 20:31:46 momjian Exp $
* $Id: timestamp.h,v 1.30 2003/05/12 23:08:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -155,6 +155,8 @@ typedef double fsec_t;
extern Datum timestamp_in(PG_FUNCTION_ARGS);
extern Datum timestamp_out(PG_FUNCTION_ARGS);
extern Datum timestamp_recv(PG_FUNCTION_ARGS);
extern Datum timestamp_send(PG_FUNCTION_ARGS);
extern Datum timestamp_scale(PG_FUNCTION_ARGS);
extern Datum timestamp_eq(PG_FUNCTION_ARGS);
extern Datum timestamp_ne(PG_FUNCTION_ARGS);
......@@ -169,6 +171,8 @@ extern Datum timestamp_larger(PG_FUNCTION_ARGS);
extern Datum interval_in(PG_FUNCTION_ARGS);
extern Datum interval_out(PG_FUNCTION_ARGS);
extern Datum interval_recv(PG_FUNCTION_ARGS);
extern Datum interval_send(PG_FUNCTION_ARGS);
extern Datum interval_scale(PG_FUNCTION_ARGS);
extern Datum interval_eq(PG_FUNCTION_ARGS);
extern Datum interval_ne(PG_FUNCTION_ARGS);
......@@ -196,6 +200,8 @@ extern Datum timestamp_timestamptz(PG_FUNCTION_ARGS);
extern Datum timestamptz_in(PG_FUNCTION_ARGS);
extern Datum timestamptz_out(PG_FUNCTION_ARGS);
extern Datum timestamptz_recv(PG_FUNCTION_ARGS);
extern Datum timestamptz_send(PG_FUNCTION_ARGS);
extern Datum timestamptz_scale(PG_FUNCTION_ARGS);
extern Datum timestamptz_timestamp(PG_FUNCTION_ARGS);
extern Datum timestamptz_zone(PG_FUNCTION_ARGS);
......
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: varbit.h,v 1.16 2002/09/18 21:35:25 tgl Exp $
* $Id: varbit.h,v 1.17 2003/05/12 23:08:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -63,8 +63,12 @@ typedef struct
extern Datum bit_in(PG_FUNCTION_ARGS);
extern Datum bit_out(PG_FUNCTION_ARGS);
extern Datum bit_recv(PG_FUNCTION_ARGS);
extern Datum bit_send(PG_FUNCTION_ARGS);
extern Datum varbit_in(PG_FUNCTION_ARGS);
extern Datum varbit_out(PG_FUNCTION_ARGS);
extern Datum varbit_recv(PG_FUNCTION_ARGS);
extern Datum varbit_send(PG_FUNCTION_ARGS);
extern Datum bit(PG_FUNCTION_ARGS);
extern Datum varbit(PG_FUNCTION_ARGS);
extern Datum biteq(PG_FUNCTION_ARGS);
......
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