mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
pgindent run over code.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.35 1999/05/12 12:47:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.36 1999/05/25 16:11:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ static char *aclparse(char *s, AclItem *aip, unsigned *modechg);
|
||||
/*
|
||||
* getid
|
||||
* Consumes the first alphanumeric string (identifier) found in string
|
||||
* 's', ignoring any leading white space. If it finds a double quote
|
||||
* 's', ignoring any leading white space. If it finds a double quote
|
||||
* it returns the word inside the quotes.
|
||||
*
|
||||
* RETURNS:
|
||||
@@ -48,7 +48,7 @@ getid(char *s, char *n)
|
||||
{
|
||||
unsigned len;
|
||||
char *id;
|
||||
int in_quotes = 0;
|
||||
int in_quotes = 0;
|
||||
|
||||
Assert(s && n);
|
||||
|
||||
@@ -63,7 +63,7 @@ getid(char *s, char *n)
|
||||
|
||||
for (id = s, len = 0; isalnum(*s) || *s == '_' || in_quotes; ++len, ++s)
|
||||
{
|
||||
if (in_quotes && *s == '"')
|
||||
if (in_quotes && *s == '"')
|
||||
{
|
||||
len--;
|
||||
in_quotes = 0;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.42 1999/05/10 00:45:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.43 1999/05/25 16:11:50 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -200,7 +200,7 @@ array_in(char *string, /* input array in external form */
|
||||
/* array not a large object */
|
||||
dataPtr = (char *) _ReadArrayStr(p, nitems, ndim, dim, &inputproc, typelem,
|
||||
typmod, typdelim, typlen, typbyval, typalign,
|
||||
&nbytes);
|
||||
&nbytes);
|
||||
nbytes += ARR_OVERHEAD(ndim);
|
||||
retval = (ArrayType *) palloc(nbytes);
|
||||
MemSet(retval, 0, nbytes);
|
||||
@@ -246,7 +246,7 @@ array_in(char *string, /* input array in external form */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* _ArrayCount
|
||||
* _ArrayCount
|
||||
* Counts the number of dimensions and the *dim array for an array string.
|
||||
* The syntax for array input is C-like nested curly braces
|
||||
*-----------------------------------------------------------------------------
|
||||
@@ -1284,19 +1284,19 @@ array_assgn(ArrayType *array,
|
||||
* Map an arbitrary function to an array and return a new array with
|
||||
* same dimensions and the source elements transformed by fn().
|
||||
*/
|
||||
ArrayType *
|
||||
ArrayType *
|
||||
array_map(ArrayType *v,
|
||||
Oid type,
|
||||
char * (*fn)(),
|
||||
char *(*fn) (),
|
||||
Oid retType,
|
||||
int nargs,
|
||||
...)
|
||||
{
|
||||
ArrayType *result;
|
||||
void *args[4];
|
||||
char **values;
|
||||
char *elt;
|
||||
int *dim;
|
||||
ArrayType *result;
|
||||
void *args[4];
|
||||
char **values;
|
||||
char *elt;
|
||||
int *dim;
|
||||
int ndim;
|
||||
int nitems;
|
||||
int i;
|
||||
@@ -1308,26 +1308,23 @@ array_map(ArrayType *v,
|
||||
char typdelim;
|
||||
Oid typelem;
|
||||
Oid proc;
|
||||
char typalign;
|
||||
char *s;
|
||||
char *p;
|
||||
char typalign;
|
||||
char *s;
|
||||
char *p;
|
||||
va_list ap;
|
||||
|
||||
/* Large objects not yet supported */
|
||||
if (ARR_IS_LO(v) == true) {
|
||||
if (ARR_IS_LO(v) == true)
|
||||
elog(ERROR, "array_map: large objects not supported");
|
||||
}
|
||||
|
||||
/* Check nargs */
|
||||
if ((nargs < 0) || (nargs > 4)) {
|
||||
if ((nargs < 0) || (nargs > 4))
|
||||
elog(ERROR, "array_map: invalid nargs: %d", nargs);
|
||||
}
|
||||
|
||||
/* Copy extra args to local variable */
|
||||
va_start(ap, nargs);
|
||||
for (i=0; i<nargs; i++) {
|
||||
for (i = 0; i < nargs; i++)
|
||||
args[i] = (void *) va_arg(ap, char *);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
/* Lookup source and result types. Unneeded variables are reused. */
|
||||
@@ -1336,14 +1333,13 @@ array_map(ArrayType *v,
|
||||
system_cache_lookup(retType, false, &typlen, &typbyval,
|
||||
&typdelim, &typelem, &proc, &typalign);
|
||||
|
||||
ndim = ARR_NDIM(v);
|
||||
dim = ARR_DIMS(v);
|
||||
ndim = ARR_NDIM(v);
|
||||
dim = ARR_DIMS(v);
|
||||
nitems = getNitems(ndim, dim);
|
||||
|
||||
/* Check for empty array */
|
||||
if (nitems <= 0) {
|
||||
if (nitems <= 0)
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Allocate temporary array for new values */
|
||||
values = (char **) palloc(nitems * sizeof(char *));
|
||||
@@ -1351,64 +1347,74 @@ array_map(ArrayType *v,
|
||||
|
||||
/* Loop over source data */
|
||||
s = (char *) ARR_DATA_PTR(v);
|
||||
for (i=0; i<nitems; i++) {
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
/* Get source element */
|
||||
if (inp_typbyval) {
|
||||
switch (inp_typlen) {
|
||||
case 1:
|
||||
elt = (char *) ((int) (*(char *) s));
|
||||
break;
|
||||
case 2:
|
||||
elt = (char *) ((int) (*(int16 *) s));
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
default:
|
||||
elt = (char *) (*(int32 *) s);
|
||||
break;
|
||||
if (inp_typbyval)
|
||||
{
|
||||
switch (inp_typlen)
|
||||
{
|
||||
case 1:
|
||||
elt = (char *) ((int) (*(char *) s));
|
||||
break;
|
||||
case 2:
|
||||
elt = (char *) ((int) (*(int16 *) s));
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
default:
|
||||
elt = (char *) (*(int32 *) s);
|
||||
break;
|
||||
}
|
||||
s += inp_typlen;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
elt = s;
|
||||
if (inp_typlen > 0) {
|
||||
if (inp_typlen > 0)
|
||||
s += inp_typlen;
|
||||
} else {
|
||||
else
|
||||
s += INTALIGN(*(int32 *) s);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply the given function to source elt and extra args.
|
||||
* nargs is the number of extra args taken by fn().
|
||||
* Apply the given function to source elt and extra args. nargs is
|
||||
* the number of extra args taken by fn().
|
||||
*/
|
||||
switch (nargs) {
|
||||
case 0:
|
||||
p = (char *) (*fn) (elt);
|
||||
break;
|
||||
case 1:
|
||||
p = (char *) (*fn) (elt, args[0]);
|
||||
break;
|
||||
case 2:
|
||||
p = (char *) (*fn) (elt, args[0], args[1]);
|
||||
break;
|
||||
case 3:
|
||||
p = (char *) (*fn) (elt, args[0], args[1], args[2]);
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
p = (char *) (*fn) (elt, args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
switch (nargs)
|
||||
{
|
||||
case 0:
|
||||
p = (char *) (*fn) (elt);
|
||||
break;
|
||||
case 1:
|
||||
p = (char *) (*fn) (elt, args[0]);
|
||||
break;
|
||||
case 2:
|
||||
p = (char *) (*fn) (elt, args[0], args[1]);
|
||||
break;
|
||||
case 3:
|
||||
p = (char *) (*fn) (elt, args[0], args[1], args[2]);
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
p = (char *) (*fn) (elt, args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update values and total result size */
|
||||
if (typbyval) {
|
||||
if (typbyval)
|
||||
{
|
||||
values[i] = (char *) p;
|
||||
nbytes += typlen;
|
||||
} else {
|
||||
int len;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
|
||||
len = ((typlen > 0) ? typlen : INTALIGN(*(int32 *) p));
|
||||
/* Needed because _CopyArrayEls tries to pfree items */
|
||||
if (p == elt) {
|
||||
if (p == elt)
|
||||
{
|
||||
p = (char *) palloc(len);
|
||||
memcpy(p, elt, len);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* workings can be found in the book "Software Solutions in C" by
|
||||
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.27 1998/10/12 04:07:44 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.28 1999/05/25 16:11:52 momjian Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -681,8 +681,8 @@ cash_words_out(Cash *value)
|
||||
Cash m1;
|
||||
Cash m2;
|
||||
Cash m3;
|
||||
text *result;
|
||||
|
||||
text *result;
|
||||
|
||||
/* work with positive numbers */
|
||||
if (*value < 0)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.21 1999/02/13 23:19:05 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.22 1999/05/25 16:11:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -163,10 +163,10 @@ text_char(text *arg1)
|
||||
text *
|
||||
char_text(int8 arg1)
|
||||
{
|
||||
text *result;
|
||||
text *result;
|
||||
|
||||
result = palloc(VARHDRSZ+1);
|
||||
VARSIZE(result) = VARHDRSZ+1;
|
||||
result = palloc(VARHDRSZ + 1);
|
||||
VARSIZE(result) = VARHDRSZ + 1;
|
||||
*(VARDATA(result)) = arg1;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.19 1999/02/13 23:19:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.20 1999/05/25 16:11:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -115,7 +115,7 @@ _ChunkArray(int fd,
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* GetChunkSize
|
||||
* GetChunkSize
|
||||
* given an access pattern and array dimensionality etc, this program
|
||||
* returns the dimensions of the chunk in "d"
|
||||
*-----------------------------------------------------------------------
|
||||
@@ -160,7 +160,7 @@ GetChunkSize(FILE *fd,
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* _FindBestChunk
|
||||
* _FindBestChunk
|
||||
* This routine does most of the number crunching to compute the
|
||||
* optimal chunk shape.
|
||||
* Called by GetChunkSize
|
||||
@@ -213,7 +213,7 @@ _FindBestChunk(int size,
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* get_next
|
||||
* get_next
|
||||
* Called by _GetBestChunk to get the next tuple in the lexicographic order
|
||||
*---------------------------------------------------------------------
|
||||
*/
|
||||
@@ -420,7 +420,7 @@ seek_and_read(int pos, int size, char *buff, int fp, int from)
|
||||
#endif /* LOARRAY */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* _ReadChunkArray
|
||||
* _ReadChunkArray
|
||||
* returns the subarray specified bu the range indices "st" and "endp"
|
||||
* from the chunked array stored in file "fp"
|
||||
*---------------------------------------------------------------------------
|
||||
@@ -620,7 +620,7 @@ _ReadChunkArray(int *st,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
* _ReadChunkArray1El
|
||||
* _ReadChunkArray1El
|
||||
* returns one element of the chunked array as specified by the index "st"
|
||||
* the chunked file descriptor is "fp"
|
||||
*-------------------------------------------------------------------------
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.31 1999/03/14 16:44:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.32 1999/05/25 16:11:56 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This code is actually (almost) unused.
|
||||
@@ -988,6 +988,7 @@ isreltime(char *str)
|
||||
|
||||
return 0;
|
||||
} /* isreltime() */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.32 1999/04/26 04:42:48 ishii Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.33 1999/05/25 16:11:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -311,7 +311,7 @@ abstime_date(AbsoluteTime abstime)
|
||||
* and then convert again to try to get the time zones correct.
|
||||
*/
|
||||
static int
|
||||
date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn)
|
||||
date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
|
||||
{
|
||||
struct tm *tx;
|
||||
time_t utime;
|
||||
@@ -358,7 +358,7 @@ date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn)
|
||||
/* tm_gmtoff is Sun/DEC-ism */
|
||||
*tzp = -(tm->tm_gmtoff);
|
||||
if (tzn != NULL)
|
||||
*tzn = (char *)tm->tm_zone;
|
||||
*tzn = (char *) tm->tm_zone;
|
||||
#elif defined(HAVE_INT_TIMEZONE)
|
||||
#ifdef __CYGWIN__
|
||||
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
|
||||
@@ -393,13 +393,13 @@ date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn)
|
||||
|
||||
#ifdef DATEDEBUG
|
||||
#if defined(HAVE_TM_ZONE)
|
||||
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s) dst=%d\n",
|
||||
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
|
||||
*tzp, tm->tm_zone, tm->tm_isdst);
|
||||
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s) dst=%d\n",
|
||||
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
|
||||
*tzp, tm->tm_zone, tm->tm_isdst);
|
||||
#elif defined(HAVE_INT_TIMEZONE)
|
||||
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s %s) dst=%d\n",
|
||||
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
|
||||
*tzp, tzname[0], tzname[1], tm->tm_isdst);
|
||||
printf("date2tm- %d.%02d.%02d %02d:%02d:%02.0f (%d %s %s) dst=%d\n",
|
||||
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, (double) tm->tm_sec,
|
||||
*tzp, tzname[0], tzname[1], tm->tm_isdst);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.70 1999/05/01 17:14:56 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.71 1999/05/25 16:12:00 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
|
||||
static int DecodeNumber(int flen, char *field,
|
||||
int fmask, int *tmask, struct tm * tm, double *fsec, int *is2digits);
|
||||
int fmask, int *tmask, struct tm * tm, double *fsec, int *is2digits);
|
||||
static int DecodeNumberField(int len, char *str,
|
||||
int fmask, int *tmask, struct tm * tm, double *fsec, int *is2digits);
|
||||
int fmask, int *tmask, struct tm * tm, double *fsec, int *is2digits);
|
||||
static int DecodeSpecial(int field, char *lowtoken, int *val);
|
||||
static int DecodeTime(char *str, int fmask, int *tmask,
|
||||
struct tm * tm, double *fsec);
|
||||
@@ -55,9 +55,9 @@ static int tm2timespan(struct tm * tm, double fsec, TimeSpan *span);
|
||||
#define USE_DATE_CACHE 1
|
||||
#define ROUND_ALL 0
|
||||
|
||||
int day_tab[2][13] = {
|
||||
int day_tab[2][13] = {
|
||||
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0},
|
||||
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}};
|
||||
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}};
|
||||
|
||||
|
||||
char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
@@ -2090,7 +2090,7 @@ static datetkn datetktbl[] = {
|
||||
{"idlw", TZ, NEG(72)}, /* Intl. Date Line, West */
|
||||
{LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
|
||||
{INVALID, RESERV, DTK_INVALID},
|
||||
/* "invalid" reserved for invalid time */
|
||||
/* "invalid" reserved for invalid time */
|
||||
{"ist", TZ, 12}, /* Israel */
|
||||
{"it", TZ, 21}, /* Iran Time */
|
||||
{"jan", MONTH, 1},
|
||||
@@ -2438,7 +2438,7 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
|
||||
|
||||
*tzp = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
|
||||
if (tzn != NULL)
|
||||
*tzn = (char *)tm->tm_zone;
|
||||
*tzn = (char *) tm->tm_zone;
|
||||
#elif defined(HAVE_INT_TIMEZONE)
|
||||
#ifdef __CYGWIN__
|
||||
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
|
||||
@@ -2833,8 +2833,10 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
case DTK_NUMBER:
|
||||
flen = strlen(field[i]);
|
||||
|
||||
/* long numeric string and either no date or no time read yet?
|
||||
* then interpret as a concatenated date or time... */
|
||||
/*
|
||||
* long numeric string and either no date or no time read
|
||||
* yet? then interpret as a concatenated date or time...
|
||||
*/
|
||||
if ((flen > 4) && !((fmask & DTK_DATE_M) && (fmask & DTK_TIME_M)))
|
||||
{
|
||||
if (DecodeNumberField(flen, field[i], fmask, &tmask, tm, fsec, &is2digits) != 0)
|
||||
@@ -2926,10 +2928,14 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
#ifdef DATEDEBUG
|
||||
printf("DecodeDateTime- month field %s value is %d\n", field[i], val);
|
||||
#endif
|
||||
/* already have a (numeric) month? then see if we can substitute... */
|
||||
if ((fmask & DTK_M(MONTH)) && (! haveTextMonth)
|
||||
&& (!(fmask & DTK_M(DAY)))
|
||||
&& ((tm->tm_mon >= 1) && (tm->tm_mon <= 31)))
|
||||
|
||||
/*
|
||||
* already have a (numeric) month? then see if we
|
||||
* can substitute...
|
||||
*/
|
||||
if ((fmask & DTK_M(MONTH)) && (!haveTextMonth)
|
||||
&& (!(fmask & DTK_M(DAY)))
|
||||
&& ((tm->tm_mon >= 1) && (tm->tm_mon <= 31)))
|
||||
{
|
||||
tm->tm_mday = tm->tm_mon;
|
||||
tmask = DTK_M(DAY);
|
||||
@@ -2942,7 +2948,11 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
break;
|
||||
|
||||
case DTZMOD:
|
||||
/* daylight savings time modifier (solves "MET DST" syntax) */
|
||||
|
||||
/*
|
||||
* daylight savings time modifier (solves "MET
|
||||
* DST" syntax)
|
||||
*/
|
||||
tmask |= DTK_M(DTZ);
|
||||
tm->tm_isdst = 1;
|
||||
if (tzp == NULL)
|
||||
@@ -3010,7 +3020,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
if (tm->tm_year > 0)
|
||||
tm->tm_year = -(tm->tm_year - 1);
|
||||
else
|
||||
elog(ERROR,"Inconsistant use of year %04d and 'BC'", tm->tm_year);
|
||||
elog(ERROR, "Inconsistant use of year %04d and 'BC'", tm->tm_year);
|
||||
}
|
||||
else if (is2digits)
|
||||
{
|
||||
@@ -3039,18 +3049,22 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
if ((fmask & DTK_DATE_M) != DTK_DATE_M)
|
||||
return ((fmask & DTK_TIME_M) == DTK_TIME_M) ? 1 : -1;
|
||||
|
||||
/* check for valid day of month, now that we know for sure the month and year... */
|
||||
/*
|
||||
* check for valid day of month, now that we know for sure the
|
||||
* month and year...
|
||||
*/
|
||||
if ((tm->tm_mday < 1)
|
||||
|| (tm->tm_mday > day_tab[isleap(tm->tm_year)][tm->tm_mon - 1]))
|
||||
return -1;
|
||||
|
||||
/* timezone not specified? then find local timezone if possible */
|
||||
if (((fmask & DTK_DATE_M) == DTK_DATE_M)
|
||||
&& (tzp != NULL) && (!(fmask & DTK_M(TZ))))
|
||||
&& (tzp != NULL) && (!(fmask & DTK_M(TZ))))
|
||||
{
|
||||
|
||||
/*
|
||||
* daylight savings time modifier but no standard timezone? then
|
||||
* error
|
||||
* daylight savings time modifier but no standard timezone?
|
||||
* then error
|
||||
*/
|
||||
if (fmask & DTK_M(DTZMOD))
|
||||
return -1;
|
||||
@@ -3066,7 +3080,8 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
tm->tm_mon += 1;
|
||||
|
||||
#if defined(HAVE_TM_ZONE)
|
||||
*tzp = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
|
||||
*tzp = -(tm->tm_gmtoff); /* tm_gmtoff is
|
||||
* Sun/DEC-ism */
|
||||
#elif defined(HAVE_INT_TIMEZONE)
|
||||
#ifdef __CYGWIN__
|
||||
*tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
|
||||
@@ -3077,7 +3092,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
||||
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
|
||||
#endif
|
||||
|
||||
#else /* !USE_POSIX_TIME */
|
||||
#else /* !USE_POSIX_TIME */
|
||||
*tzp = CTimeZone;
|
||||
#endif
|
||||
}
|
||||
@@ -3214,8 +3229,8 @@ DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct tm * tm, dou
|
||||
tm->tm_hour += 12;
|
||||
|
||||
if (((tm->tm_hour < 0) || (tm->tm_hour > 23))
|
||||
|| ((tm->tm_min < 0) || (tm->tm_min > 59))
|
||||
|| ((tm->tm_sec < 0) || ((tm->tm_sec + *fsec) >= 60)))
|
||||
|| ((tm->tm_min < 0) || (tm->tm_min > 59))
|
||||
|| ((tm->tm_sec < 0) || ((tm->tm_sec + *fsec) >= 60)))
|
||||
return -1;
|
||||
|
||||
if ((fmask & DTK_TIME_M) != DTK_TIME_M)
|
||||
@@ -3344,7 +3359,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
|
||||
if (tm->tm_year > 0)
|
||||
tm->tm_year = -(tm->tm_year - 1);
|
||||
else
|
||||
elog(ERROR,"Inconsistant use of year %04d and 'BC'", tm->tm_year);
|
||||
elog(ERROR, "Inconsistant use of year %04d and 'BC'", tm->tm_year);
|
||||
}
|
||||
else if (is2digits)
|
||||
{
|
||||
@@ -3449,11 +3464,12 @@ DecodeNumber(int flen, char *str, int fmask,
|
||||
&tm->tm_year, &tm->tm_mon, &tm->tm_mday);
|
||||
|
||||
}
|
||||
/* Enough digits to be unequivocal year?
|
||||
* Used to test for 4 digits or more,
|
||||
* but we now test first for a three-digit doy
|
||||
* so anything bigger than two digits had better be
|
||||
* an explicit year. - thomas 1999-01-09
|
||||
|
||||
/*
|
||||
* Enough digits to be unequivocal year? Used to test for 4 digits or
|
||||
* more, but we now test first for a three-digit doy so anything
|
||||
* bigger than two digits had better be an explicit year. - thomas
|
||||
* 1999-01-09
|
||||
*/
|
||||
else if (flen > 2)
|
||||
{
|
||||
@@ -3464,7 +3480,7 @@ DecodeNumber(int flen, char *str, int fmask,
|
||||
|
||||
/* already have a year? then see if we can substitute... */
|
||||
if ((fmask & DTK_M(YEAR)) && (!(fmask & DTK_M(DAY)))
|
||||
&& ((tm->tm_year >= 1) && (tm->tm_year <= 31)))
|
||||
&& ((tm->tm_year >= 1) && (tm->tm_year <= 31)))
|
||||
{
|
||||
tm->tm_mday = tm->tm_year;
|
||||
*tmask = DTK_M(DAY);
|
||||
@@ -3543,7 +3559,7 @@ DecodeNumber(int flen, char *str, int fmask,
|
||||
*/
|
||||
static int
|
||||
DecodeNumberField(int len, char *str, int fmask,
|
||||
int *tmask, struct tm * tm, double *fsec, int *is2digits)
|
||||
int *tmask, struct tm * tm, double *fsec, int *is2digits)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.41 1999/04/20 00:26:32 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.42 1999/05/25 16:12:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -955,12 +955,12 @@ i2tof(int16 num)
|
||||
text *
|
||||
float8_text(float64 num)
|
||||
{
|
||||
text *result;
|
||||
int len;
|
||||
char *str;
|
||||
text *result;
|
||||
int len;
|
||||
char *str;
|
||||
|
||||
str = float8out(num);
|
||||
len = (strlen(str)+VARHDRSZ);
|
||||
len = (strlen(str) + VARHDRSZ);
|
||||
|
||||
result = palloc(len);
|
||||
|
||||
@@ -978,9 +978,9 @@ float8_text(float64 num)
|
||||
float64
|
||||
text_float8(text *string)
|
||||
{
|
||||
float64 result;
|
||||
int len;
|
||||
char *str;
|
||||
float64 result;
|
||||
int len;
|
||||
char *str;
|
||||
|
||||
len = (VARSIZE(string) - VARHDRSZ);
|
||||
str = palloc(len + 1);
|
||||
@@ -1000,12 +1000,12 @@ text_float8(text *string)
|
||||
text *
|
||||
float4_text(float32 num)
|
||||
{
|
||||
text *result;
|
||||
int len;
|
||||
char *str;
|
||||
text *result;
|
||||
int len;
|
||||
char *str;
|
||||
|
||||
str = float4out(num);
|
||||
len = (strlen(str)+VARHDRSZ);
|
||||
len = (strlen(str) + VARHDRSZ);
|
||||
|
||||
result = palloc(len);
|
||||
|
||||
@@ -1023,9 +1023,9 @@ float4_text(float32 num)
|
||||
float32
|
||||
text_float4(text *string)
|
||||
{
|
||||
float32 result;
|
||||
int len;
|
||||
char *str;
|
||||
float32 result;
|
||||
int len;
|
||||
char *str;
|
||||
|
||||
len = (VARSIZE(string) - VARHDRSZ);
|
||||
str = palloc(len + 1);
|
||||
@@ -1154,7 +1154,8 @@ dpow(float64 arg1, float64 arg2)
|
||||
#endif
|
||||
*result = (float64data) pow(tmp1, tmp2);
|
||||
#ifndef finite
|
||||
if (errno != 0) /* on some machines both EDOM & ERANGE can occur */
|
||||
if (errno != 0) /* on some machines both EDOM & ERANGE can
|
||||
* occur */
|
||||
#else
|
||||
if (!finite(*result))
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 1999/05/25 05:29:38 momjian Exp $";
|
||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.6 1999/05/25 16:12:04 momjian Exp $";
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,9 +40,9 @@ static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 1999/05/25 05:29:38 momj
|
||||
#endif
|
||||
|
||||
static char *inet_net_ntop_ipv4(const u_char *src, int bits,
|
||||
char *dst, size_t size);
|
||||
char *dst, size_t size);
|
||||
static char *inet_cidr_ntop_ipv4(const u_char *src, int bits,
|
||||
char *dst, size_t size);
|
||||
char *dst, size_t size);
|
||||
|
||||
/*
|
||||
* char *
|
||||
@@ -59,7 +59,7 @@ inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET:
|
||||
case AF_INET:
|
||||
return (inet_cidr_ntop_ipv4(src, bits, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
@@ -162,7 +162,7 @@ inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET:
|
||||
case AF_INET:
|
||||
return (inet_net_ntop_ipv4(src, bits, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
@@ -186,10 +186,11 @@ inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
|
||||
static char *
|
||||
inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
|
||||
{
|
||||
char *odst = dst;
|
||||
char *t;
|
||||
size_t len = 4;
|
||||
int b, tb;
|
||||
char *odst = dst;
|
||||
char *t;
|
||||
size_t len = 4;
|
||||
int b,
|
||||
tb;
|
||||
|
||||
if (bits < 0 || bits > 32)
|
||||
{
|
||||
@@ -218,7 +219,7 @@ inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - t);
|
||||
size -= (size_t) (dst - t);
|
||||
}
|
||||
|
||||
/* don't print masklen if 32 bits */
|
||||
@@ -232,7 +233,7 @@ inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
|
||||
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7 1999/02/03 21:17:27 momjian Exp $";
|
||||
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.8 1999/05/25 16:12:05 momjian Exp $";
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,8 +58,8 @@ static int inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size);
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*
|
||||
* Changes:
|
||||
* I added the inet_cidr_pton function (also from Paul) and changed
|
||||
* the names to reflect their current use.
|
||||
* I added the inet_cidr_pton function (also from Paul) and changed
|
||||
* the names to reflect their current use.
|
||||
*
|
||||
*/
|
||||
int
|
||||
@@ -67,10 +67,10 @@ inet_net_pton(int af, const char *src, void *dst, size_t size)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET:
|
||||
case AF_INET:
|
||||
return size == -1 ?
|
||||
inet_net_pton_ipv4(src, dst) :
|
||||
inet_cidr_pton_ipv4(src, dst, size);
|
||||
inet_net_pton_ipv4(src, dst) :
|
||||
inet_cidr_pton_ipv4(src, dst, size);
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
@@ -108,14 +108,16 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
|
||||
|
||||
ch = *src++;
|
||||
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
|
||||
&& isascii(src[1]) && isxdigit(src[1])) {
|
||||
&& isascii(src[1]) && isxdigit(src[1]))
|
||||
{
|
||||
/* Hexadecimal: Eat nybble string. */
|
||||
if (size <= 0)
|
||||
goto emsgsize;
|
||||
dirty = 0;
|
||||
tmp = 0;
|
||||
src++; /* skip x or X. */
|
||||
while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
|
||||
src++; /* skip x or X. */
|
||||
while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch))
|
||||
{
|
||||
if (isupper(ch))
|
||||
ch = tolower(ch);
|
||||
n = strchr(xdigits, ch) - xdigits;
|
||||
@@ -124,14 +126,16 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
|
||||
tmp = n;
|
||||
else
|
||||
tmp = (tmp << 4) | n;
|
||||
if (++dirty == 2) {
|
||||
if (++dirty == 2)
|
||||
{
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = (u_char) tmp;
|
||||
dirty = 0;
|
||||
}
|
||||
}
|
||||
if (dirty) { /* Odd trailing nybble? */
|
||||
if (dirty)
|
||||
{ /* Odd trailing nybble? */
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = (u_char) (tmp << 4);
|
||||
@@ -234,27 +238,30 @@ emsgsize:
|
||||
/*
|
||||
* int
|
||||
* inet_net_pton(af, src, dst, *bits)
|
||||
* convert network address from presentation to network format.
|
||||
* accepts inet_pton()'s input for this "af" plus trailing "/CIDR".
|
||||
* "dst" is assumed large enough for its "af". "bits" is set to the
|
||||
* /CIDR prefix length, which can have defaults (like /32 for IPv4).
|
||||
* convert network address from presentation to network format.
|
||||
* accepts inet_pton()'s input for this "af" plus trailing "/CIDR".
|
||||
* "dst" is assumed large enough for its "af". "bits" is set to the
|
||||
* /CIDR prefix length, which can have defaults (like /32 for IPv4).
|
||||
* return:
|
||||
* -1 if an error occurred (inspect errno; ENOENT means bad format).
|
||||
* 0 if successful conversion occurred.
|
||||
* note:
|
||||
* 192.5.5.1/28 has a nonzero host part, which means it isn't a network
|
||||
* as called for by inet_cidr_pton() but it can be a host address with
|
||||
* an included netmask.
|
||||
* -1 if an error occurred (inspect errno; ENOENT means bad format).
|
||||
* 0 if successful conversion occurred.
|
||||
* note:
|
||||
* 192.5.5.1/28 has a nonzero host part, which means it isn't a network
|
||||
* as called for by inet_cidr_pton() but it can be a host address with
|
||||
* an included netmask.
|
||||
* author:
|
||||
* Paul Vixie (ISC), October 1998
|
||||
* Paul Vixie (ISC), October 1998
|
||||
*/
|
||||
static int
|
||||
inet_net_pton_ipv4(const char *src, u_char *dst)
|
||||
{
|
||||
static const char digits[] = "0123456789";
|
||||
const u_char *odst = dst;
|
||||
int n, ch, tmp, bits;
|
||||
size_t size = 4;
|
||||
int n,
|
||||
ch,
|
||||
tmp,
|
||||
bits;
|
||||
size_t size = 4;
|
||||
|
||||
/* Get the mantissa. */
|
||||
while (ch = *src++, (isascii(ch) && isdigit(ch)))
|
||||
@@ -283,7 +290,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
|
||||
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst)
|
||||
{
|
||||
/* CIDR width specifier. Nothing can follow it. */
|
||||
ch = *src++; /* Skip over the /. */
|
||||
ch = *src++; /* Skip over the /. */
|
||||
bits = 0;
|
||||
do
|
||||
{
|
||||
@@ -325,11 +332,11 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
|
||||
|
||||
return bits;
|
||||
|
||||
enoent:
|
||||
enoent:
|
||||
errno = ENOENT;
|
||||
return (-1);
|
||||
|
||||
emsgsize:
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -44,21 +44,22 @@ int8in(char *str)
|
||||
if (!PointerIsValid(str))
|
||||
elog(ERROR, "Bad (null) int8 external representation", NULL);
|
||||
|
||||
/* Do our own scan, rather than relying on sscanf which might be
|
||||
/*
|
||||
* Do our own scan, rather than relying on sscanf which might be
|
||||
* broken for long long. NOTE: this will not detect int64 overflow...
|
||||
* but sscanf doesn't either...
|
||||
*/
|
||||
while (*ptr && isspace(*ptr)) /* skip leading spaces */
|
||||
while (*ptr && isspace(*ptr)) /* skip leading spaces */
|
||||
ptr++;
|
||||
if (*ptr == '-') /* handle sign */
|
||||
if (*ptr == '-') /* handle sign */
|
||||
sign = -1, ptr++;
|
||||
else if (*ptr == '+')
|
||||
ptr++;
|
||||
if (! isdigit(*ptr)) /* require at least one digit */
|
||||
if (!isdigit(*ptr)) /* require at least one digit */
|
||||
elog(ERROR, "Bad int8 external representation '%s'", str);
|
||||
while (*ptr && isdigit(*ptr)) /* process digits */
|
||||
while (*ptr && isdigit(*ptr)) /* process digits */
|
||||
tmp = tmp * 10 + (*ptr++ - '0');
|
||||
if (*ptr) /* trailing junk? */
|
||||
if (*ptr) /* trailing junk? */
|
||||
elog(ERROR, "Bad int8 external representation '%s'", str);
|
||||
|
||||
*result = (sign < 0) ? -tmp : tmp;
|
||||
@@ -70,7 +71,7 @@ int8in(char *str)
|
||||
/* int8out()
|
||||
*/
|
||||
char *
|
||||
int8out(int64 *val)
|
||||
int8out(int64 * val)
|
||||
{
|
||||
char *result;
|
||||
|
||||
@@ -99,37 +100,37 @@ int8out(int64 *val)
|
||||
* Is val1 relop val2?
|
||||
*/
|
||||
bool
|
||||
int8eq(int64 *val1, int64 *val2)
|
||||
int8eq(int64 * val1, int64 * val2)
|
||||
{
|
||||
return *val1 == *val2;
|
||||
} /* int8eq() */
|
||||
|
||||
bool
|
||||
int8ne(int64 *val1, int64 *val2)
|
||||
int8ne(int64 * val1, int64 * val2)
|
||||
{
|
||||
return *val1 != *val2;
|
||||
} /* int8ne() */
|
||||
|
||||
bool
|
||||
int8lt(int64 *val1, int64 *val2)
|
||||
int8lt(int64 * val1, int64 * val2)
|
||||
{
|
||||
return *val1 < *val2;
|
||||
} /* int8lt() */
|
||||
|
||||
bool
|
||||
int8gt(int64 *val1, int64 *val2)
|
||||
int8gt(int64 * val1, int64 * val2)
|
||||
{
|
||||
return *val1 > *val2;
|
||||
} /* int8gt() */
|
||||
|
||||
bool
|
||||
int8le(int64 *val1, int64 *val2)
|
||||
int8le(int64 * val1, int64 * val2)
|
||||
{
|
||||
return *val1 <= *val2;
|
||||
} /* int8le() */
|
||||
|
||||
bool
|
||||
int8ge(int64 *val1, int64 *val2)
|
||||
int8ge(int64 * val1, int64 * val2)
|
||||
{
|
||||
return *val1 >= *val2;
|
||||
} /* int8ge() */
|
||||
@@ -139,37 +140,37 @@ int8ge(int64 *val1, int64 *val2)
|
||||
* Is 64-bit val1 relop 32-bit val2?
|
||||
*/
|
||||
bool
|
||||
int84eq(int64 *val1, int32 val2)
|
||||
int84eq(int64 * val1, int32 val2)
|
||||
{
|
||||
return *val1 == val2;
|
||||
} /* int84eq() */
|
||||
|
||||
bool
|
||||
int84ne(int64 *val1, int32 val2)
|
||||
int84ne(int64 * val1, int32 val2)
|
||||
{
|
||||
return *val1 != val2;
|
||||
} /* int84ne() */
|
||||
|
||||
bool
|
||||
int84lt(int64 *val1, int32 val2)
|
||||
int84lt(int64 * val1, int32 val2)
|
||||
{
|
||||
return *val1 < val2;
|
||||
} /* int84lt() */
|
||||
|
||||
bool
|
||||
int84gt(int64 *val1, int32 val2)
|
||||
int84gt(int64 * val1, int32 val2)
|
||||
{
|
||||
return *val1 > val2;
|
||||
} /* int84gt() */
|
||||
|
||||
bool
|
||||
int84le(int64 *val1, int32 val2)
|
||||
int84le(int64 * val1, int32 val2)
|
||||
{
|
||||
return *val1 <= val2;
|
||||
} /* int84le() */
|
||||
|
||||
bool
|
||||
int84ge(int64 *val1, int32 val2)
|
||||
int84ge(int64 * val1, int32 val2)
|
||||
{
|
||||
return *val1 >= val2;
|
||||
} /* int84ge() */
|
||||
@@ -179,37 +180,37 @@ int84ge(int64 *val1, int32 val2)
|
||||
* Is 32-bit val1 relop 64-bit val2?
|
||||
*/
|
||||
bool
|
||||
int48eq(int32 val1, int64 *val2)
|
||||
int48eq(int32 val1, int64 * val2)
|
||||
{
|
||||
return val1 == *val2;
|
||||
} /* int48eq() */
|
||||
|
||||
bool
|
||||
int48ne(int32 val1, int64 *val2)
|
||||
int48ne(int32 val1, int64 * val2)
|
||||
{
|
||||
return val1 != *val2;
|
||||
} /* int48ne() */
|
||||
|
||||
bool
|
||||
int48lt(int32 val1, int64 *val2)
|
||||
int48lt(int32 val1, int64 * val2)
|
||||
{
|
||||
return val1 < *val2;
|
||||
} /* int48lt() */
|
||||
|
||||
bool
|
||||
int48gt(int32 val1, int64 *val2)
|
||||
int48gt(int32 val1, int64 * val2)
|
||||
{
|
||||
return val1 > *val2;
|
||||
} /* int48gt() */
|
||||
|
||||
bool
|
||||
int48le(int32 val1, int64 *val2)
|
||||
int48le(int32 val1, int64 * val2)
|
||||
{
|
||||
return val1 <= *val2;
|
||||
} /* int48le() */
|
||||
|
||||
bool
|
||||
int48ge(int32 val1, int64 *val2)
|
||||
int48ge(int32 val1, int64 * val2)
|
||||
{
|
||||
return val1 >= *val2;
|
||||
} /* int48ge() */
|
||||
@@ -220,7 +221,7 @@ int48ge(int32 val1, int64 *val2)
|
||||
*---------------------------------------------------------*/
|
||||
|
||||
int64 *
|
||||
int8um(int64 *val)
|
||||
int8um(int64 * val)
|
||||
{
|
||||
int64 temp = 0;
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
@@ -235,7 +236,7 @@ int8um(int64 *val)
|
||||
|
||||
|
||||
int64 *
|
||||
int8pl(int64 *val1, int64 *val2)
|
||||
int8pl(int64 * val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -248,7 +249,7 @@ int8pl(int64 *val1, int64 *val2)
|
||||
} /* int8pl() */
|
||||
|
||||
int64 *
|
||||
int8mi(int64 *val1, int64 *val2)
|
||||
int8mi(int64 * val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -261,7 +262,7 @@ int8mi(int64 *val1, int64 *val2)
|
||||
} /* int8mi() */
|
||||
|
||||
int64 *
|
||||
int8mul(int64 *val1, int64 *val2)
|
||||
int8mul(int64 * val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -274,7 +275,7 @@ int8mul(int64 *val1, int64 *val2)
|
||||
} /* int8mul() */
|
||||
|
||||
int64 *
|
||||
int8div(int64 *val1, int64 *val2)
|
||||
int8div(int64 * val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -287,7 +288,7 @@ int8div(int64 *val1, int64 *val2)
|
||||
} /* int8div() */
|
||||
|
||||
int64 *
|
||||
int8larger(int64 *val1, int64 *val2)
|
||||
int8larger(int64 * val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -300,7 +301,7 @@ int8larger(int64 *val1, int64 *val2)
|
||||
} /* int8larger() */
|
||||
|
||||
int64 *
|
||||
int8smaller(int64 *val1, int64 *val2)
|
||||
int8smaller(int64 * val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -314,7 +315,7 @@ int8smaller(int64 *val1, int64 *val2)
|
||||
|
||||
|
||||
int64 *
|
||||
int84pl(int64 *val1, int32 val2)
|
||||
int84pl(int64 * val1, int32 val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -327,7 +328,7 @@ int84pl(int64 *val1, int32 val2)
|
||||
} /* int84pl() */
|
||||
|
||||
int64 *
|
||||
int84mi(int64 *val1, int32 val2)
|
||||
int84mi(int64 * val1, int32 val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -340,7 +341,7 @@ int84mi(int64 *val1, int32 val2)
|
||||
} /* int84mi() */
|
||||
|
||||
int64 *
|
||||
int84mul(int64 *val1, int32 val2)
|
||||
int84mul(int64 * val1, int32 val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -353,7 +354,7 @@ int84mul(int64 *val1, int32 val2)
|
||||
} /* int84mul() */
|
||||
|
||||
int64 *
|
||||
int84div(int64 *val1, int32 val2)
|
||||
int84div(int64 * val1, int32 val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -367,7 +368,7 @@ int84div(int64 *val1, int32 val2)
|
||||
|
||||
|
||||
int64 *
|
||||
int48pl(int32 val1, int64 *val2)
|
||||
int48pl(int32 val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -380,7 +381,7 @@ int48pl(int32 val1, int64 *val2)
|
||||
} /* int48pl() */
|
||||
|
||||
int64 *
|
||||
int48mi(int32 val1, int64 *val2)
|
||||
int48mi(int32 val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -393,7 +394,7 @@ int48mi(int32 val1, int64 *val2)
|
||||
} /* int48mi() */
|
||||
|
||||
int64 *
|
||||
int48mul(int32 val1, int64 *val2)
|
||||
int48mul(int32 val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -406,7 +407,7 @@ int48mul(int32 val1, int64 *val2)
|
||||
} /* int48mul() */
|
||||
|
||||
int64 *
|
||||
int48div(int32 val1, int64 *val2)
|
||||
int48div(int32 val1, int64 * val2)
|
||||
{
|
||||
int64 *result = palloc(sizeof(int64));
|
||||
|
||||
@@ -434,7 +435,7 @@ int48(int32 val)
|
||||
} /* int48() */
|
||||
|
||||
int32
|
||||
int84(int64 *val)
|
||||
int84(int64 * val)
|
||||
{
|
||||
int32 result;
|
||||
|
||||
@@ -442,6 +443,7 @@ int84(int64 *val)
|
||||
elog(ERROR, "Invalid (null) int64, can't convert int8 to int4", NULL);
|
||||
|
||||
#if NOT_USED
|
||||
|
||||
/*
|
||||
* Hmm. This conditional always tests true on my i686/linux box. It's
|
||||
* a gcc compiler bug, or I'm missing something obvious, which is more
|
||||
@@ -449,8 +451,8 @@ int84(int64 *val)
|
||||
*/
|
||||
if ((*val < INT_MIN) || (*val > INT_MAX))
|
||||
#endif
|
||||
if ((*val < (-pow(2, 31) + 1)) || (*val > (pow(2, 31) - 1)))
|
||||
elog(ERROR, "int8 conversion to int4 is out of range", NULL);
|
||||
if ((*val < (-pow(2, 31) + 1)) || (*val > (pow(2, 31) - 1)))
|
||||
elog(ERROR, "int8 conversion to int4 is out of range", NULL);
|
||||
|
||||
result = *val;
|
||||
|
||||
@@ -471,7 +473,7 @@ int28 (int16 val)
|
||||
} /* int28() */
|
||||
|
||||
int16
|
||||
int82(int64 *val)
|
||||
int82(int64 * val)
|
||||
{
|
||||
int16 result;
|
||||
|
||||
@@ -489,7 +491,7 @@ int82(int64 *val)
|
||||
#endif
|
||||
|
||||
float64
|
||||
i8tod(int64 *val)
|
||||
i8tod(int64 * val)
|
||||
{
|
||||
float64 result = palloc(sizeof(float64data));
|
||||
|
||||
@@ -533,9 +535,9 @@ text_int8(text *str)
|
||||
elog(ERROR, "Bad (null) int8 external representation", NULL);
|
||||
|
||||
len = (VARSIZE(str) - VARHDRSZ);
|
||||
s = palloc(len+1);
|
||||
s = palloc(len + 1);
|
||||
memmove(s, VARDATA(str), len);
|
||||
*(s+len) = '\0';
|
||||
*(s + len) = '\0';
|
||||
|
||||
return int8in(s);
|
||||
} /* text_int8() */
|
||||
@@ -544,7 +546,7 @@ text_int8(text *str)
|
||||
/* int8_text()
|
||||
*/
|
||||
text *
|
||||
int8_text(int64 *val)
|
||||
int8_text(int64 * val)
|
||||
{
|
||||
text *result;
|
||||
|
||||
@@ -564,4 +566,3 @@ int8_text(int64 *val)
|
||||
|
||||
return result;
|
||||
} /* int8out() */
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "utils/builtins.h" /* where the function declarations go */
|
||||
#include "mb/pg_wchar.h"
|
||||
|
||||
static int like(pg_wchar *text, pg_wchar *p);
|
||||
static int like(pg_wchar * text, pg_wchar * p);
|
||||
|
||||
/*
|
||||
* interface routines called by the function manager
|
||||
@@ -38,7 +38,7 @@ static int like(pg_wchar *text, pg_wchar *p);
|
||||
charlen - the length of the string
|
||||
*/
|
||||
static bool
|
||||
fixedlen_like(char *s, struct varlena *p, int charlen)
|
||||
fixedlen_like(char *s, struct varlena * p, int charlen)
|
||||
{
|
||||
pg_wchar *sterm,
|
||||
*pterm;
|
||||
@@ -83,7 +83,7 @@ fixedlen_like(char *s, struct varlena *p, int charlen)
|
||||
}
|
||||
|
||||
bool
|
||||
namelike(NameData *n, struct varlena *p)
|
||||
namelike(NameData *n, struct varlena * p)
|
||||
{
|
||||
if (!n)
|
||||
return FALSE;
|
||||
@@ -91,13 +91,13 @@ namelike(NameData *n, struct varlena *p)
|
||||
}
|
||||
|
||||
bool
|
||||
namenlike(NameData *s, struct varlena *p)
|
||||
namenlike(NameData *s, struct varlena * p)
|
||||
{
|
||||
return !namelike(s, p);
|
||||
}
|
||||
|
||||
bool
|
||||
textlike(struct varlena *s, struct varlena *p)
|
||||
textlike(struct varlena * s, struct varlena * p)
|
||||
{
|
||||
if (!s)
|
||||
return FALSE;
|
||||
@@ -105,13 +105,13 @@ textlike(struct varlena *s, struct varlena *p)
|
||||
}
|
||||
|
||||
bool
|
||||
textnlike(struct varlena *s, struct varlena *p)
|
||||
textnlike(struct varlena * s, struct varlena * p)
|
||||
{
|
||||
return !textlike(s, p);
|
||||
}
|
||||
|
||||
|
||||
/* $Revision: 1.23 $
|
||||
/* $Revision: 1.24 $
|
||||
** "like.c" A first attempt at a LIKE operator for Postgres95.
|
||||
**
|
||||
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
||||
@@ -146,11 +146,11 @@ textnlike(struct varlena *s, struct varlena *p)
|
||||
** Match text and p, return LIKE_TRUE, LIKE_FALSE, or LIKE_ABORT.
|
||||
*/
|
||||
static int
|
||||
DoMatch(pg_wchar *text, pg_wchar *p)
|
||||
DoMatch(pg_wchar * text, pg_wchar * p)
|
||||
{
|
||||
int matched;
|
||||
|
||||
for (; *p && *text; text++, p++)
|
||||
for (; *p && *text; text ++, p++)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ DoMatch(pg_wchar *text, pg_wchar *p)
|
||||
p++;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if (*text != *p)
|
||||
if (*text !=*p)
|
||||
return LIKE_FALSE;
|
||||
break;
|
||||
case '_':
|
||||
@@ -177,16 +177,16 @@ DoMatch(pg_wchar *text, pg_wchar *p)
|
||||
{
|
||||
/* Optimization to prevent most recursion */
|
||||
if ((*text == *p ||
|
||||
*p == '\\' || *p == '%' || *p == '_') &&
|
||||
*p == '\\' || *p == '%' || *p == '_') &&
|
||||
(matched = DoMatch(text, p)) != LIKE_FALSE)
|
||||
return matched;
|
||||
text++;
|
||||
text ++;
|
||||
}
|
||||
return LIKE_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
if (*text != '\0')
|
||||
if (*text !='\0')
|
||||
return LIKE_ABORT;
|
||||
else
|
||||
{
|
||||
@@ -203,7 +203,7 @@ DoMatch(pg_wchar *text, pg_wchar *p)
|
||||
** User-level routine. Returns TRUE or FALSE.
|
||||
*/
|
||||
static int
|
||||
like(pg_wchar *text, pg_wchar *p)
|
||||
like(pg_wchar * text, pg_wchar * p)
|
||||
{
|
||||
if (p[0] == '%' && p[1] == '\0')
|
||||
return TRUE;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PostgreSQL type definitions for MAC addresses.
|
||||
*
|
||||
* $Id: mac.c,v 1.7 1999/03/22 05:00:57 momjian Exp $
|
||||
* $Id: mac.c,v 1.8 1999/05/25 16:12:08 momjian Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -13,119 +13,119 @@
|
||||
#include <utils/inet.h>
|
||||
|
||||
manufacturer manufacturers[] = {
|
||||
{0x00, 0x00, 0x0C, "Cisco"},
|
||||
{0x00, 0x00, 0x0E, "Fujitsu"},
|
||||
{0x00, 0x00, 0x0F, "NeXT"},
|
||||
{0x00, 0x00, 0x10, "Sytek"},
|
||||
{0x00, 0x00, 0x1D, "Cabletron"},
|
||||
{0x00, 0x00, 0x20, "DIAB"},
|
||||
{0x00, 0x00, 0x22, "Visual Technology"},
|
||||
{0x00, 0x00, 0x2A, "TRW"},
|
||||
{0x00, 0x00, 0x32, "GPT Limited"},
|
||||
{0x00, 0x00, 0x5A, "S & Koch"},
|
||||
{0x00, 0x00, 0x5E, "IANA"},
|
||||
{0x00, 0x00, 0x65, "Network General"},
|
||||
{0x00, 0x00, 0x6B, "MIPS"},
|
||||
{0x00, 0x00, 0x77, "MIPS"},
|
||||
{0x00, 0x00, 0x7A, "Ardent"},
|
||||
{0x00, 0x00, 0x89, "Cayman Systems"},
|
||||
{0x00, 0x00, 0x93, "Proteon"},
|
||||
{0x00, 0x00, 0x9F, "Ameristar Technology"},
|
||||
{0x00, 0x00, 0xA2, "Wellfleet"},
|
||||
{0x00, 0x00, 0xA3, "Network Application Technology"},
|
||||
{0x00, 0x00, 0xA6, "Network General"},
|
||||
{0x00, 0x00, 0xA7, "NCD"},
|
||||
{0x00, 0x00, 0xA9, "Network Systems"},
|
||||
{0x00, 0x00, 0xAA, "Xerox"},
|
||||
{0x00, 0x00, 0xB3, "CIMLinc"},
|
||||
{0x00, 0x00, 0xB7, "Dove Fastnet"},
|
||||
{0x00, 0x00, 0xBC, "Allen-Bradley"},
|
||||
{0x00, 0x00, 0xC0, "Western Digital"},
|
||||
{0x00, 0x00, 0xC5, "Farallon"},
|
||||
{0x00, 0x00, 0xC6, "Hewlett-Packard"},
|
||||
{0x00, 0x00, 0xC8, "Altos"},
|
||||
{0x00, 0x00, 0xC9, "Emulex"},
|
||||
{0x00, 0x00, 0xD7, "Dartmouth College"},
|
||||
{0x00, 0x00, 0xD8, "3Com (?)"},
|
||||
{0x00, 0x00, 0xDD, "Gould"},
|
||||
{0x00, 0x00, 0xDE, "Unigraph"},
|
||||
{0x00, 0x00, 0xE2, "Acer Counterpoint"},
|
||||
{0x00, 0x00, 0xEF, "Alantec"},
|
||||
{0x00, 0x00, 0xFD, "High Level Hardware"},
|
||||
{0x00, 0x01, 0x02, "BBN internal usage"},
|
||||
{0x00, 0x20, 0xAF, "3Com"},
|
||||
{0x00, 0x17, 0x00, "Kabel"},
|
||||
{0x00, 0x80, 0x64, "Wyse Technology"},
|
||||
{0x00, 0x80, 0x2B, "IMAC (?)"},
|
||||
{0x00, 0x80, 0x2D, "Xylogics, Inc."},
|
||||
{0x00, 0x80, 0x8C, "Frontier Software Development"},
|
||||
{0x00, 0x80, 0xC2, "IEEE 802.1 Committee"},
|
||||
{0x00, 0x80, 0xD3, "Shiva"},
|
||||
{0x00, 0xAA, 0x00, "Intel"},
|
||||
{0x00, 0xDD, 0x00, "Ungermann-Bass"},
|
||||
{0x00, 0xDD, 0x01, "Ungermann-Bass"},
|
||||
{0x02, 0x07, 0x01, "Racal InterLan"},
|
||||
{0x02, 0x04, 0x06, "BBN internal usage"},
|
||||
{0x02, 0x60, 0x86, "Satelcom MegaPac"},
|
||||
{0x02, 0x60, 0x8C, "3Com"},
|
||||
{0x02, 0xCF, 0x1F, "CMC"},
|
||||
{0x08, 0x00, 0x02, "3Com"},
|
||||
{0x08, 0x00, 0x03, "ACC"},
|
||||
{0x08, 0x00, 0x05, "Symbolics"},
|
||||
{0x08, 0x00, 0x08, "BBN"},
|
||||
{0x08, 0x00, 0x09, "Hewlett-Packard"},
|
||||
{0x08, 0x00, 0x0A, "Nestar Systems"},
|
||||
{0x08, 0x00, 0x0B, "Unisys"},
|
||||
{0x08, 0x00, 0x11, "Tektronix"},
|
||||
{0x08, 0x00, 0x14, "Excelan"},
|
||||
{0x08, 0x00, 0x17, "NSC"},
|
||||
{0x08, 0x00, 0x1A, "Data General"},
|
||||
{0x08, 0x00, 0x1B, "Data General"},
|
||||
{0x08, 0x00, 0x1E, "Apollo"},
|
||||
{0x08, 0x00, 0x20, "Sun"},
|
||||
{0x08, 0x00, 0x22, "NBI"},
|
||||
{0x08, 0x00, 0x25, "CDC"},
|
||||
{0x08, 0x00, 0x26, "Norsk Data"},
|
||||
{0x08, 0x00, 0x27, "PCS Computer Systems GmbH"},
|
||||
{0x08, 0x00, 0x28, "Texas Instruments"},
|
||||
{0x08, 0x00, 0x2B, "DEC"},
|
||||
{0x08, 0x00, 0x2E, "Metaphor"},
|
||||
{0x08, 0x00, 0x2F, "Prime Computer"},
|
||||
{0x08, 0x00, 0x36, "Intergraph"},
|
||||
{0x08, 0x00, 0x37, "Fujitsu-Xerox"},
|
||||
{0x08, 0x00, 0x38, "Bull"},
|
||||
{0x08, 0x00, 0x39, "Spider Systems"},
|
||||
{0x08, 0x00, 0x41, "DCA Digital Comm. Assoc."},
|
||||
{0x08, 0x00, 0x45, "Xylogics (?)"},
|
||||
{0x08, 0x00, 0x46, "Sony"},
|
||||
{0x08, 0x00, 0x47, "Sequent"},
|
||||
{0x08, 0x00, 0x49, "Univation"},
|
||||
{0x08, 0x00, 0x4C, "Encore"},
|
||||
{0x08, 0x00, 0x4E, "BICC"},
|
||||
{0x08, 0x00, 0x56, "Stanford University"},
|
||||
{0x08, 0x00, 0x58, "DECsystem 20 (?)"},
|
||||
{0x08, 0x00, 0x5A, "IBM"},
|
||||
{0x08, 0x00, 0x67, "Comdesign"},
|
||||
{0x08, 0x00, 0x68, "Ridge"},
|
||||
{0x08, 0x00, 0x69, "Silicon Graphics"},
|
||||
{0x08, 0x00, 0x6E, "Concurrent"},
|
||||
{0x08, 0x00, 0x75, "DDE"},
|
||||
{0x08, 0x00, 0x7C, "Vitalink"},
|
||||
{0x08, 0x00, 0x80, "XIOS"},
|
||||
{0x08, 0x00, 0x86, "Imagen/QMS"},
|
||||
{0x08, 0x00, 0x87, "Xyplex"},
|
||||
{0x08, 0x00, 0x89, "Kinetics"},
|
||||
{0x08, 0x00, 0x8B, "Pyramid"},
|
||||
{0x08, 0x00, 0x8D, "XyVision"},
|
||||
{0x08, 0x00, 0x90, "Retix Inc"},
|
||||
{0x48, 0x44, 0x53, "HDS (?)"},
|
||||
{0x80, 0x00, 0x10, "AT&T"},
|
||||
{0xAA, 0x00, 0x00, "DEC"},
|
||||
{0xAA, 0x00, 0x01, "DEC"},
|
||||
{0xAA, 0x00, 0x02, "DEC"},
|
||||
{0xAA, 0x00, 0x03, "DEC"},
|
||||
{0xAA, 0x00, 0x04, "DEC"},
|
||||
{0x00, 0x00, 0x00, NULL}
|
||||
{0x00, 0x00, 0x0C, "Cisco"},
|
||||
{0x00, 0x00, 0x0E, "Fujitsu"},
|
||||
{0x00, 0x00, 0x0F, "NeXT"},
|
||||
{0x00, 0x00, 0x10, "Sytek"},
|
||||
{0x00, 0x00, 0x1D, "Cabletron"},
|
||||
{0x00, 0x00, 0x20, "DIAB"},
|
||||
{0x00, 0x00, 0x22, "Visual Technology"},
|
||||
{0x00, 0x00, 0x2A, "TRW"},
|
||||
{0x00, 0x00, 0x32, "GPT Limited"},
|
||||
{0x00, 0x00, 0x5A, "S & Koch"},
|
||||
{0x00, 0x00, 0x5E, "IANA"},
|
||||
{0x00, 0x00, 0x65, "Network General"},
|
||||
{0x00, 0x00, 0x6B, "MIPS"},
|
||||
{0x00, 0x00, 0x77, "MIPS"},
|
||||
{0x00, 0x00, 0x7A, "Ardent"},
|
||||
{0x00, 0x00, 0x89, "Cayman Systems"},
|
||||
{0x00, 0x00, 0x93, "Proteon"},
|
||||
{0x00, 0x00, 0x9F, "Ameristar Technology"},
|
||||
{0x00, 0x00, 0xA2, "Wellfleet"},
|
||||
{0x00, 0x00, 0xA3, "Network Application Technology"},
|
||||
{0x00, 0x00, 0xA6, "Network General"},
|
||||
{0x00, 0x00, 0xA7, "NCD"},
|
||||
{0x00, 0x00, 0xA9, "Network Systems"},
|
||||
{0x00, 0x00, 0xAA, "Xerox"},
|
||||
{0x00, 0x00, 0xB3, "CIMLinc"},
|
||||
{0x00, 0x00, 0xB7, "Dove Fastnet"},
|
||||
{0x00, 0x00, 0xBC, "Allen-Bradley"},
|
||||
{0x00, 0x00, 0xC0, "Western Digital"},
|
||||
{0x00, 0x00, 0xC5, "Farallon"},
|
||||
{0x00, 0x00, 0xC6, "Hewlett-Packard"},
|
||||
{0x00, 0x00, 0xC8, "Altos"},
|
||||
{0x00, 0x00, 0xC9, "Emulex"},
|
||||
{0x00, 0x00, 0xD7, "Dartmouth College"},
|
||||
{0x00, 0x00, 0xD8, "3Com (?)"},
|
||||
{0x00, 0x00, 0xDD, "Gould"},
|
||||
{0x00, 0x00, 0xDE, "Unigraph"},
|
||||
{0x00, 0x00, 0xE2, "Acer Counterpoint"},
|
||||
{0x00, 0x00, 0xEF, "Alantec"},
|
||||
{0x00, 0x00, 0xFD, "High Level Hardware"},
|
||||
{0x00, 0x01, 0x02, "BBN internal usage"},
|
||||
{0x00, 0x20, 0xAF, "3Com"},
|
||||
{0x00, 0x17, 0x00, "Kabel"},
|
||||
{0x00, 0x80, 0x64, "Wyse Technology"},
|
||||
{0x00, 0x80, 0x2B, "IMAC (?)"},
|
||||
{0x00, 0x80, 0x2D, "Xylogics, Inc."},
|
||||
{0x00, 0x80, 0x8C, "Frontier Software Development"},
|
||||
{0x00, 0x80, 0xC2, "IEEE 802.1 Committee"},
|
||||
{0x00, 0x80, 0xD3, "Shiva"},
|
||||
{0x00, 0xAA, 0x00, "Intel"},
|
||||
{0x00, 0xDD, 0x00, "Ungermann-Bass"},
|
||||
{0x00, 0xDD, 0x01, "Ungermann-Bass"},
|
||||
{0x02, 0x07, 0x01, "Racal InterLan"},
|
||||
{0x02, 0x04, 0x06, "BBN internal usage"},
|
||||
{0x02, 0x60, 0x86, "Satelcom MegaPac"},
|
||||
{0x02, 0x60, 0x8C, "3Com"},
|
||||
{0x02, 0xCF, 0x1F, "CMC"},
|
||||
{0x08, 0x00, 0x02, "3Com"},
|
||||
{0x08, 0x00, 0x03, "ACC"},
|
||||
{0x08, 0x00, 0x05, "Symbolics"},
|
||||
{0x08, 0x00, 0x08, "BBN"},
|
||||
{0x08, 0x00, 0x09, "Hewlett-Packard"},
|
||||
{0x08, 0x00, 0x0A, "Nestar Systems"},
|
||||
{0x08, 0x00, 0x0B, "Unisys"},
|
||||
{0x08, 0x00, 0x11, "Tektronix"},
|
||||
{0x08, 0x00, 0x14, "Excelan"},
|
||||
{0x08, 0x00, 0x17, "NSC"},
|
||||
{0x08, 0x00, 0x1A, "Data General"},
|
||||
{0x08, 0x00, 0x1B, "Data General"},
|
||||
{0x08, 0x00, 0x1E, "Apollo"},
|
||||
{0x08, 0x00, 0x20, "Sun"},
|
||||
{0x08, 0x00, 0x22, "NBI"},
|
||||
{0x08, 0x00, 0x25, "CDC"},
|
||||
{0x08, 0x00, 0x26, "Norsk Data"},
|
||||
{0x08, 0x00, 0x27, "PCS Computer Systems GmbH"},
|
||||
{0x08, 0x00, 0x28, "Texas Instruments"},
|
||||
{0x08, 0x00, 0x2B, "DEC"},
|
||||
{0x08, 0x00, 0x2E, "Metaphor"},
|
||||
{0x08, 0x00, 0x2F, "Prime Computer"},
|
||||
{0x08, 0x00, 0x36, "Intergraph"},
|
||||
{0x08, 0x00, 0x37, "Fujitsu-Xerox"},
|
||||
{0x08, 0x00, 0x38, "Bull"},
|
||||
{0x08, 0x00, 0x39, "Spider Systems"},
|
||||
{0x08, 0x00, 0x41, "DCA Digital Comm. Assoc."},
|
||||
{0x08, 0x00, 0x45, "Xylogics (?)"},
|
||||
{0x08, 0x00, 0x46, "Sony"},
|
||||
{0x08, 0x00, 0x47, "Sequent"},
|
||||
{0x08, 0x00, 0x49, "Univation"},
|
||||
{0x08, 0x00, 0x4C, "Encore"},
|
||||
{0x08, 0x00, 0x4E, "BICC"},
|
||||
{0x08, 0x00, 0x56, "Stanford University"},
|
||||
{0x08, 0x00, 0x58, "DECsystem 20 (?)"},
|
||||
{0x08, 0x00, 0x5A, "IBM"},
|
||||
{0x08, 0x00, 0x67, "Comdesign"},
|
||||
{0x08, 0x00, 0x68, "Ridge"},
|
||||
{0x08, 0x00, 0x69, "Silicon Graphics"},
|
||||
{0x08, 0x00, 0x6E, "Concurrent"},
|
||||
{0x08, 0x00, 0x75, "DDE"},
|
||||
{0x08, 0x00, 0x7C, "Vitalink"},
|
||||
{0x08, 0x00, 0x80, "XIOS"},
|
||||
{0x08, 0x00, 0x86, "Imagen/QMS"},
|
||||
{0x08, 0x00, 0x87, "Xyplex"},
|
||||
{0x08, 0x00, 0x89, "Kinetics"},
|
||||
{0x08, 0x00, 0x8B, "Pyramid"},
|
||||
{0x08, 0x00, 0x8D, "XyVision"},
|
||||
{0x08, 0x00, 0x90, "Retix Inc"},
|
||||
{0x48, 0x44, 0x53, "HDS (?)"},
|
||||
{0x80, 0x00, 0x10, "AT&T"},
|
||||
{0xAA, 0x00, 0x00, "DEC"},
|
||||
{0xAA, 0x00, 0x01, "DEC"},
|
||||
{0xAA, 0x00, 0x02, "DEC"},
|
||||
{0xAA, 0x00, 0x03, "DEC"},
|
||||
{0xAA, 0x00, 0x04, "DEC"},
|
||||
{0x00, 0x00, 0x00, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: nabstime.c,v 1.54 1999/04/26 04:42:49 ishii Exp $
|
||||
* $Id: nabstime.c,v 1.55 1999/05/25 16:12:09 momjian Exp $
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
@@ -64,13 +64,18 @@ GetCurrentAbsoluteTime(void)
|
||||
CDayLight = (tm->tm_isdst > 0);
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
||||
/*
|
||||
* XXX is there a better way to get local timezone string w/o
|
||||
* tzname? - tgl 97/03/18
|
||||
*/
|
||||
strftime(CTZName, MAXTZLEN, "%Z", tm);
|
||||
#endif
|
||||
/* XXX FreeBSD man pages indicate that this should work - thomas 1998-12-12 */
|
||||
|
||||
/*
|
||||
* XXX FreeBSD man pages indicate that this should work - thomas
|
||||
* 1998-12-12
|
||||
*/
|
||||
strcpy(CTZName, tm->tm_zone);
|
||||
|
||||
#elif defined(HAVE_INT_TIMEZONE)
|
||||
@@ -79,10 +84,10 @@ GetCurrentAbsoluteTime(void)
|
||||
CDayLight = tm->tm_isdst;
|
||||
CTimeZone =
|
||||
#ifdef __CYGWIN32__
|
||||
(tm->tm_isdst ? (_timezone - 3600) : _timezone);
|
||||
(tm->tm_isdst ? (_timezone - 3600) : _timezone);
|
||||
#else
|
||||
(tm->tm_isdst ? (timezone - 3600) : timezone);
|
||||
#endif
|
||||
(tm->tm_isdst ? (timezone - 3600) : timezone);
|
||||
#endif
|
||||
strcpy(CTZName, tzname[tm->tm_isdst]);
|
||||
#else
|
||||
#error USE_POSIX_TIME defined but no time zone available
|
||||
@@ -91,8 +96,9 @@ GetCurrentAbsoluteTime(void)
|
||||
CTimeZone = tb.timezone * 60;
|
||||
CDayLight = (tb.dstflag != 0);
|
||||
|
||||
/* XXX does this work to get the local timezone string in V7?
|
||||
* - tgl 97/03/18
|
||||
/*
|
||||
* XXX does this work to get the local timezone string in V7? -
|
||||
* tgl 97/03/18
|
||||
*/
|
||||
strftime(CTZName, MAXTZLEN, "%Z", localtime(&now));
|
||||
#endif
|
||||
@@ -389,6 +395,7 @@ AbsoluteTimeIsAfter(AbsoluteTime time1, AbsoluteTime time2)
|
||||
|
||||
return time1 > time2;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* abstime_finite()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.17 1999/02/13 23:19:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.18 1999/05/25 16:12:10 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -161,6 +161,7 @@ namecmp(Name n1, Name n2)
|
||||
{
|
||||
return strncmp(n1->data, n2->data, NAMEDATALEN);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* is for IP V4 CIDR notation, but prepared for V6: just
|
||||
* add the necessary bits where the comments indicate.
|
||||
*
|
||||
* $Id: network.c,v 1.8 1999/04/15 02:20:50 thomas Exp $
|
||||
* $Id: network.c,v 1.9 1999/05/25 16:12:11 momjian Exp $
|
||||
* Jon Postel RIP 16 Oct 1998
|
||||
*/
|
||||
|
||||
@@ -52,7 +52,7 @@ network_in(char *src, int type)
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
|
||||
dst = palloc(VARHDRSZ + sizeof(inet_struct));
|
||||
if (dst == NULL)
|
||||
elog(ERROR, "unable to allocate memory in network_in()");
|
||||
@@ -60,7 +60,7 @@ network_in(char *src, int type)
|
||||
/* First, try for an IP V4 address: */
|
||||
ip_family(dst) = AF_INET;
|
||||
bits = inet_net_pton(ip_family(dst), src, &ip_v4addr(dst),
|
||||
type ? ip_addrsize(dst) : -1);
|
||||
type ? ip_addrsize(dst) : -1);
|
||||
if ((bits < 0) || (bits > 32))
|
||||
/* Go for an IPV6 address here, before faulting out: */
|
||||
elog(ERROR, "could not parse \"%s\"", src);
|
||||
@@ -102,10 +102,10 @@ inet_out(inet *src)
|
||||
/* It's an IP V4 address: */
|
||||
if (ip_type(src))
|
||||
dst = inet_cidr_ntop(AF_INET, &ip_v4addr(src), ip_bits(src),
|
||||
tmp, sizeof(tmp));
|
||||
tmp, sizeof(tmp));
|
||||
else
|
||||
dst = inet_net_ntop(AF_INET, &ip_v4addr(src), ip_bits(src),
|
||||
tmp, sizeof(tmp));
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
if (dst == NULL)
|
||||
elog(ERROR, "unable to print address (%s)", strerror(errno));
|
||||
@@ -222,7 +222,7 @@ network_sub(inet *a1, inet *a2)
|
||||
{
|
||||
if (!PointerIsValid(a1) || !PointerIsValid(a2))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
|
||||
{
|
||||
return ((ip_bits(a1) > ip_bits(a2))
|
||||
@@ -370,7 +370,7 @@ network_broadcast(inet *ip)
|
||||
if (ip_family(ip) == AF_INET)
|
||||
{
|
||||
/* It's an IP V4 address: */
|
||||
int addr;
|
||||
int addr;
|
||||
unsigned long mask = 0xffffffff;
|
||||
|
||||
if (ip_bits(ip) < 32)
|
||||
@@ -402,7 +402,7 @@ network_network(inet *ip)
|
||||
{
|
||||
text *ret;
|
||||
int len;
|
||||
char tmp[sizeof("255.255.255.255/32")];
|
||||
char tmp[sizeof("255.255.255.255/32")];
|
||||
|
||||
if (!PointerIsValid(ip))
|
||||
return NULL;
|
||||
@@ -410,8 +410,8 @@ network_network(inet *ip)
|
||||
if (ip_family(ip) == AF_INET)
|
||||
{
|
||||
/* It's an IP V4 address: */
|
||||
int addr = htonl(ntohl(ip_v4addr(ip)) & (0xffffffff << (32 - ip_bits(ip))));
|
||||
|
||||
int addr = htonl(ntohl(ip_v4addr(ip)) & (0xffffffff << (32 - ip_bits(ip))));
|
||||
|
||||
if (inet_cidr_ntop(AF_INET, &addr, ip_bits(ip), tmp, sizeof(tmp)) == NULL)
|
||||
elog(ERROR, "unable to print network (%s)", strerror(errno));
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.15 1999/03/15 03:24:32 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.16 1999/05/25 16:12:12 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -47,18 +47,16 @@ int4notin(int32 not_in_arg, char *relation_and_attr)
|
||||
int attrid;
|
||||
char *relation,
|
||||
*attribute;
|
||||
char my_copy[NAMEDATALEN*2+2];
|
||||
char my_copy[NAMEDATALEN * 2 + 2];
|
||||
Datum value;
|
||||
|
||||
strncpy(my_copy, relation_and_attr, sizeof(my_copy));
|
||||
my_copy[sizeof(my_copy)-1] = '\0';
|
||||
my_copy[sizeof(my_copy) - 1] = '\0';
|
||||
|
||||
relation = (char *) strtok(my_copy, ".");
|
||||
attribute = (char *) strtok(NULL, ".");
|
||||
if (attribute == NULL)
|
||||
{
|
||||
elog(ERROR, "int4notin: must provide relationname.attributename");
|
||||
}
|
||||
|
||||
/* Open the relation and get a relation descriptor */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.29 1999/02/13 23:19:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.30 1999/05/25 16:12:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -55,17 +55,17 @@ pg_atoi(char *s, int size, int c)
|
||||
|
||||
Assert(s);
|
||||
|
||||
errno = 0;
|
||||
errno = 0;
|
||||
|
||||
/*
|
||||
* Some versions of strtol treat the empty string as an error. This
|
||||
* Some versions of strtol treat the empty string as an error. This
|
||||
* code will explicitly return 0 for an empty string.
|
||||
*/
|
||||
|
||||
if (s == (char *)NULL)
|
||||
if (s == (char *) NULL)
|
||||
elog(ERROR, "pg_atoi: NULL pointer!");
|
||||
else if (*s == 0)
|
||||
l = (long)0;
|
||||
l = (long) 0;
|
||||
else
|
||||
l = strtol(s, &badp, 10);
|
||||
if (errno) /* strtol must set ERANGE */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.36 1999/05/10 00:45:59 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.37 1999/05/25 16:12:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,9 +41,9 @@
|
||||
int32
|
||||
regprocin(char *pro_name_or_oid)
|
||||
{
|
||||
HeapTuple proctup = NULL;
|
||||
HeapTupleData tuple;
|
||||
RegProcedure result = InvalidOid;
|
||||
HeapTuple proctup = NULL;
|
||||
HeapTupleData tuple;
|
||||
RegProcedure result = InvalidOid;
|
||||
|
||||
if (pro_name_or_oid == NULL)
|
||||
return InvalidOid;
|
||||
@@ -52,6 +52,7 @@ regprocin(char *pro_name_or_oid)
|
||||
|
||||
if (!IsBootstrapProcessingMode())
|
||||
{
|
||||
|
||||
/*
|
||||
* we need to use the oid because there can be multiple entries
|
||||
* with the same name. We accept int4eq_1323 and 1323.
|
||||
@@ -76,23 +77,23 @@ regprocin(char *pro_name_or_oid)
|
||||
RetrieveIndexResult indexRes;
|
||||
Buffer buffer;
|
||||
int matches = 0;
|
||||
|
||||
|
||||
ScanKeyEntryInitialize(&skey[0],
|
||||
(bits16) 0x0,
|
||||
(AttrNumber) 1,
|
||||
(RegProcedure) F_NAMEEQ,
|
||||
PointerGetDatum(pro_name_or_oid));
|
||||
|
||||
|
||||
hdesc = heap_openr(ProcedureRelationName);
|
||||
idesc = index_openr(ProcedureNameIndex);
|
||||
|
||||
|
||||
sd = index_beginscan(idesc, false, 1, skey);
|
||||
while ((indexRes = index_getnext(sd, ForwardScanDirection)))
|
||||
{
|
||||
tuple.t_self = indexRes->heap_iptr;
|
||||
heap_fetch(hdesc, SnapshotNow,
|
||||
&tuple,
|
||||
&buffer);
|
||||
&tuple,
|
||||
&buffer);
|
||||
pfree(indexRes);
|
||||
if (tuple.t_data != NULL)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* out of it's tuple
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.14 1999/05/25 08:49:33 wieck Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.15 1999/05/25 16:12:19 momjian Exp $
|
||||
*
|
||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||
*
|
||||
@@ -57,16 +57,17 @@
|
||||
#include "catalog/pg_opclass.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
#define BUFSIZE 8192
|
||||
#define BUFSIZE 8192
|
||||
|
||||
/* ----------
|
||||
* Local data types
|
||||
* ----------
|
||||
*/
|
||||
typedef struct QryHier {
|
||||
struct QryHier *parent;
|
||||
Query *query;
|
||||
} QryHier;
|
||||
typedef struct QryHier
|
||||
{
|
||||
struct QryHier *parent;
|
||||
Query *query;
|
||||
} QryHier;
|
||||
|
||||
|
||||
/* ----------
|
||||
@@ -90,7 +91,7 @@ static char *query_getopclass = "SELECT * FROM pg_opclass WHERE oid = $1";
|
||||
*/
|
||||
text *pg_get_ruledef(NameData *rname);
|
||||
text *pg_get_viewdef(NameData *rname);
|
||||
text *pg_get_indexdef(Oid indexrelid);
|
||||
text *pg_get_indexdef(Oid indexrelid);
|
||||
NameData *pg_get_userbyid(int4 uid);
|
||||
|
||||
|
||||
@@ -100,16 +101,16 @@ NameData *pg_get_userbyid(int4 uid);
|
||||
*/
|
||||
static char *make_ruledef(HeapTuple ruletup, TupleDesc rulettc);
|
||||
static char *make_viewdef(HeapTuple ruletup, TupleDesc rulettc);
|
||||
static char *get_query_def(Query *query, QryHier *parentqh);
|
||||
static char *get_select_query_def(Query *query, QryHier *qh);
|
||||
static char *get_insert_query_def(Query *query, QryHier *qh);
|
||||
static char *get_update_query_def(Query *query, QryHier *qh);
|
||||
static char *get_delete_query_def(Query *query, QryHier *qh);
|
||||
static char *get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix);
|
||||
static char *get_func_expr(QryHier *qh, int rt_index, Expr *expr, bool varprefix);
|
||||
static char *get_tle_expr(QryHier *qh, int rt_index, TargetEntry *tle, bool varprefix);
|
||||
static char *get_query_def(Query *query, QryHier * parentqh);
|
||||
static char *get_select_query_def(Query *query, QryHier * qh);
|
||||
static char *get_insert_query_def(Query *query, QryHier * qh);
|
||||
static char *get_update_query_def(Query *query, QryHier * qh);
|
||||
static char *get_delete_query_def(Query *query, QryHier * qh);
|
||||
static char *get_rule_expr(QryHier * qh, int rt_index, Node *node, bool varprefix);
|
||||
static char *get_func_expr(QryHier * qh, int rt_index, Expr *expr, bool varprefix);
|
||||
static char *get_tle_expr(QryHier * qh, int rt_index, TargetEntry *tle, bool varprefix);
|
||||
static char *get_const_expr(Const *constval);
|
||||
static char *get_sublink_expr(QryHier *qh, int rt_index, Node *node, bool varprefix);
|
||||
static char *get_sublink_expr(QryHier * qh, int rt_index, Node *node, bool varprefix);
|
||||
static char *get_relation_name(Oid relid);
|
||||
static char *get_attribute_name(Oid relid, int2 attnum);
|
||||
static bool check_if_rte_used(int rt_index, Node *node, int sup);
|
||||
@@ -314,27 +315,27 @@ pg_get_viewdef(NameData *rname)
|
||||
* only return the SELECT part of a view
|
||||
* ----------
|
||||
*/
|
||||
text *
|
||||
text *
|
||||
pg_get_indexdef(Oid indexrelid)
|
||||
{
|
||||
text *indexdef;
|
||||
text *indexdef;
|
||||
HeapTuple ht_idx;
|
||||
HeapTuple ht_idxrel;
|
||||
HeapTuple ht_indrel;
|
||||
HeapTuple spi_tup;
|
||||
TupleDesc spi_ttc;
|
||||
int spi_fno;
|
||||
Form_pg_index idxrec;
|
||||
Form_pg_class idxrelrec;
|
||||
Form_pg_class indrelrec;
|
||||
int spi_fno;
|
||||
Form_pg_index idxrec;
|
||||
Form_pg_class idxrelrec;
|
||||
Form_pg_class indrelrec;
|
||||
Datum spi_args[1];
|
||||
char spi_nulls[2];
|
||||
int spirc;
|
||||
int len;
|
||||
int keyno;
|
||||
int spirc;
|
||||
int len;
|
||||
int keyno;
|
||||
char buf[BUFSIZE];
|
||||
char keybuf[BUFSIZE];
|
||||
char *sep;
|
||||
char *sep;
|
||||
|
||||
/* ----------
|
||||
* Connect to SPI manager
|
||||
@@ -371,30 +372,30 @@ pg_get_indexdef(Oid indexrelid)
|
||||
* ----------
|
||||
*/
|
||||
ht_idx = SearchSysCacheTuple(INDEXRELID,
|
||||
ObjectIdGetDatum(indexrelid), 0, 0, 0);
|
||||
ObjectIdGetDatum(indexrelid), 0, 0, 0);
|
||||
if (!HeapTupleIsValid(ht_idx))
|
||||
elog(ERROR, "syscache lookup for index %u failed", indexrelid);
|
||||
idxrec = (Form_pg_index)GETSTRUCT(ht_idx);
|
||||
idxrec = (Form_pg_index) GETSTRUCT(ht_idx);
|
||||
|
||||
/* ----------
|
||||
* Fetch the pg_class tuple of the index relation
|
||||
* ----------
|
||||
*/
|
||||
ht_idxrel = SearchSysCacheTuple(RELOID,
|
||||
ObjectIdGetDatum(idxrec->indexrelid), 0, 0, 0);
|
||||
ObjectIdGetDatum(idxrec->indexrelid), 0, 0, 0);
|
||||
if (!HeapTupleIsValid(ht_idxrel))
|
||||
elog(ERROR, "syscache lookup for relid %u failed", idxrec->indexrelid);
|
||||
idxrelrec = (Form_pg_class)GETSTRUCT(ht_idxrel);
|
||||
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
|
||||
|
||||
/* ----------
|
||||
* Fetch the pg_class tuple of the indexed relation
|
||||
* ----------
|
||||
*/
|
||||
ht_indrel = SearchSysCacheTuple(RELOID,
|
||||
ObjectIdGetDatum(idxrec->indrelid), 0, 0, 0);
|
||||
ObjectIdGetDatum(idxrec->indrelid), 0, 0, 0);
|
||||
if (!HeapTupleIsValid(ht_indrel))
|
||||
elog(ERROR, "syscache lookup for relid %u failed", idxrec->indrelid);
|
||||
indrelrec = (Form_pg_class)GETSTRUCT(ht_indrel);
|
||||
indrelrec = (Form_pg_class) GETSTRUCT(ht_indrel);
|
||||
|
||||
/* ----------
|
||||
* Get the am name for the index relation
|
||||
@@ -417,11 +418,11 @@ pg_get_indexdef(Oid indexrelid)
|
||||
* ----------
|
||||
*/
|
||||
sprintf(buf, "CREATE %sINDEX \"%s\" ON \"%s\" USING %s (",
|
||||
idxrec->indisunique ? "UNIQUE " : "",
|
||||
nameout(&(idxrelrec->relname)),
|
||||
nameout(&(indrelrec->relname)),
|
||||
SPI_getvalue(spi_tup, spi_ttc, spi_fno));
|
||||
|
||||
idxrec->indisunique ? "UNIQUE " : "",
|
||||
nameout(&(idxrelrec->relname)),
|
||||
nameout(&(indrelrec->relname)),
|
||||
SPI_getvalue(spi_tup, spi_ttc, spi_fno));
|
||||
|
||||
/* ----------
|
||||
* Collect the indexed attributes
|
||||
* ----------
|
||||
@@ -445,7 +446,7 @@ pg_get_indexdef(Oid indexrelid)
|
||||
strcat(keybuf, "oid");
|
||||
else
|
||||
strcat(keybuf, get_attribute_name(idxrec->indrelid,
|
||||
idxrec->indkey[keyno]));
|
||||
idxrec->indkey[keyno]));
|
||||
strcat(keybuf, "\"");
|
||||
|
||||
/* ----------
|
||||
@@ -478,10 +479,10 @@ pg_get_indexdef(Oid indexrelid)
|
||||
if (idxrec->indproc != InvalidOid)
|
||||
{
|
||||
HeapTuple proctup;
|
||||
Form_pg_proc procStruct;
|
||||
Form_pg_proc procStruct;
|
||||
|
||||
proctup = SearchSysCacheTuple(PROOID,
|
||||
ObjectIdGetDatum(idxrec->indproc), 0, 0, 0);
|
||||
ObjectIdGetDatum(idxrec->indproc), 0, 0, 0);
|
||||
if (!HeapTupleIsValid(proctup))
|
||||
elog(ERROR, "cache lookup for proc %u failed", idxrec->indproc);
|
||||
|
||||
@@ -508,13 +509,11 @@ pg_get_indexdef(Oid indexrelid)
|
||||
strcat(buf, "\"");
|
||||
}
|
||||
else
|
||||
/* ----------
|
||||
* For the others say 'attr opclass [, ...]'
|
||||
* ----------
|
||||
*/
|
||||
{
|
||||
/* ----------
|
||||
* For the others say 'attr opclass [, ...]'
|
||||
* ----------
|
||||
*/
|
||||
strcat(buf, keybuf);
|
||||
}
|
||||
|
||||
/* ----------
|
||||
* Finish
|
||||
@@ -551,8 +550,8 @@ NameData *
|
||||
pg_get_userbyid(int4 uid)
|
||||
{
|
||||
HeapTuple usertup;
|
||||
Form_pg_shadow user_rec;
|
||||
NameData *result;
|
||||
Form_pg_shadow user_rec;
|
||||
NameData *result;
|
||||
|
||||
/* ----------
|
||||
* Allocate space for the result
|
||||
@@ -566,16 +565,14 @@ pg_get_userbyid(int4 uid)
|
||||
* ----------
|
||||
*/
|
||||
usertup = SearchSysCacheTuple(USESYSID,
|
||||
ObjectIdGetDatum(uid), 0, 0, 0);
|
||||
ObjectIdGetDatum(uid), 0, 0, 0);
|
||||
if (HeapTupleIsValid(usertup))
|
||||
{
|
||||
user_rec = (Form_pg_shadow)GETSTRUCT(usertup);
|
||||
user_rec = (Form_pg_shadow) GETSTRUCT(usertup);
|
||||
StrNCpy(result->data, (&(user_rec->usename))->data, NAMEDATALEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf((char *)result, "unknown (UID=%d)", uid);
|
||||
}
|
||||
sprintf((char *) result, "unknown (UID=%d)", uid);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -683,12 +680,12 @@ make_ruledef(HeapTuple ruletup, TupleDesc rulettc)
|
||||
{
|
||||
Node *qual;
|
||||
Query *query;
|
||||
QryHier qh;
|
||||
QryHier qh;
|
||||
|
||||
qual = stringToNode(ev_qual);
|
||||
query = (Query *) lfirst(actions);
|
||||
qh.parent = NULL;
|
||||
qh.query = query;
|
||||
qh.query = query;
|
||||
|
||||
strcat(buf, " WHERE ");
|
||||
strcat(buf, get_rule_expr(&qh, 0, qual, TRUE));
|
||||
@@ -809,16 +806,16 @@ make_viewdef(HeapTuple ruletup, TupleDesc rulettc)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_query_def(Query *query, QryHier *parentqh)
|
||||
get_query_def(Query *query, QryHier * parentqh)
|
||||
{
|
||||
QryHier qh;
|
||||
|
||||
qh.parent = parentqh;
|
||||
qh.query = query;
|
||||
qh.query = query;
|
||||
|
||||
switch (query->commandType)
|
||||
{
|
||||
case CMD_SELECT:
|
||||
case CMD_SELECT:
|
||||
return get_select_query_def(query, &qh);
|
||||
break;
|
||||
|
||||
@@ -853,7 +850,7 @@ get_query_def(Query *query, QryHier *parentqh)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_select_query_def(Query *query, QryHier *qh)
|
||||
get_select_query_def(Query *query, QryHier * qh)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
char *sep;
|
||||
@@ -1023,7 +1020,7 @@ get_select_query_def(Query *query, QryHier *qh)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_insert_query_def(Query *query, QryHier *qh)
|
||||
get_insert_query_def(Query *query, QryHier * qh)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
char *sep;
|
||||
@@ -1133,7 +1130,7 @@ get_insert_query_def(Query *query, QryHier *qh)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_update_query_def(Query *query, QryHier *qh)
|
||||
get_update_query_def(Query *query, QryHier * qh)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
char *sep;
|
||||
@@ -1186,7 +1183,7 @@ get_update_query_def(Query *query, QryHier *qh)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_delete_query_def(Query *query, QryHier *qh)
|
||||
get_delete_query_def(Query *query, QryHier * qh)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
RangeTblEntry *rte;
|
||||
@@ -1220,7 +1217,7 @@ get_delete_query_def(Query *query, QryHier *qh)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
get_rule_expr(QryHier * qh, int rt_index, Node *node, bool varprefix)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
|
||||
@@ -1254,7 +1251,7 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
strcat(buf, aggref->aggname);
|
||||
strcat(buf, "\"(");
|
||||
strcat(buf, get_rule_expr(qh, rt_index,
|
||||
(Node *) (aggref->target), varprefix));
|
||||
(Node *) (aggref->target), varprefix));
|
||||
strcat(buf, ")");
|
||||
return pstrdup(buf);
|
||||
}
|
||||
@@ -1263,15 +1260,15 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
case T_GroupClause:
|
||||
{
|
||||
GroupClause *grp = (GroupClause *) node;
|
||||
List *l;
|
||||
TargetEntry *tle = NULL;
|
||||
List *l;
|
||||
TargetEntry *tle = NULL;
|
||||
|
||||
foreach(l, qh->query->targetList)
|
||||
{
|
||||
if (((TargetEntry *)lfirst(l))->resdom->resgroupref ==
|
||||
grp->tleGroupref)
|
||||
if (((TargetEntry *) lfirst(l))->resdom->resgroupref ==
|
||||
grp->tleGroupref)
|
||||
{
|
||||
tle = (TargetEntry *)lfirst(l);
|
||||
tle = (TargetEntry *) lfirst(l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1279,7 +1276,7 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
if (tle == NULL)
|
||||
elog(ERROR, "GROUP BY expression not found in targetlist");
|
||||
|
||||
return get_rule_expr(qh, rt_index, (Node *)tle, varprefix);
|
||||
return get_rule_expr(qh, rt_index, (Node *) tle, varprefix);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1358,9 +1355,10 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
{
|
||||
Var *var = (Var *) node;
|
||||
RangeTblEntry *rte;
|
||||
int sup = var->varlevelsup;
|
||||
int sup = var->varlevelsup;
|
||||
|
||||
while(sup-- > 0) qh = qh->parent;
|
||||
while (sup-- > 0)
|
||||
qh = qh->parent;
|
||||
|
||||
rte = (RangeTblEntry *) nth(var->varno - 1, qh->query->rtable);
|
||||
|
||||
@@ -1396,9 +1394,7 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
break;
|
||||
|
||||
case T_SubLink:
|
||||
{
|
||||
return get_sublink_expr(qh, rt_index, node, varprefix);
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Const:
|
||||
@@ -1421,7 +1417,7 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_func_expr(QryHier *qh, int rt_index, Expr *expr, bool varprefix)
|
||||
get_func_expr(QryHier * qh, int rt_index, Expr *expr, bool varprefix)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
HeapTuple proctup;
|
||||
@@ -1500,7 +1496,7 @@ get_func_expr(QryHier *qh, int rt_index, Expr *expr, bool varprefix)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_tle_expr(QryHier *qh, int rt_index, TargetEntry *tle, bool varprefix)
|
||||
get_tle_expr(QryHier * qh, int rt_index, TargetEntry *tle, bool varprefix)
|
||||
{
|
||||
HeapTuple proctup;
|
||||
Form_pg_proc procStruct;
|
||||
@@ -1609,14 +1605,14 @@ get_const_expr(Const *constval)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_sublink_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
get_sublink_expr(QryHier * qh, int rt_index, Node *node, bool varprefix)
|
||||
{
|
||||
SubLink *sublink = (SubLink *) node;
|
||||
Query *query = (Query *) (sublink->subselect);
|
||||
Expr *expr;
|
||||
Expr *expr;
|
||||
List *l;
|
||||
char *sep;
|
||||
char buf[BUFSIZE];
|
||||
char buf[BUFSIZE];
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
@@ -1640,32 +1636,33 @@ get_sublink_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
|
||||
strcat(buf, " ");
|
||||
}
|
||||
|
||||
switch (sublink->subLinkType) {
|
||||
switch (sublink->subLinkType)
|
||||
{
|
||||
case EXISTS_SUBLINK:
|
||||
strcat(buf, "EXISTS ");
|
||||
break;
|
||||
|
||||
case ANY_SUBLINK:
|
||||
expr = (Expr *)lfirst(sublink->oper);
|
||||
expr = (Expr *) lfirst(sublink->oper);
|
||||
strcat(buf, get_opname(((Oper *) (expr->oper))->opno));
|
||||
strcat(buf, " ANY ");
|
||||
break;
|
||||
|
||||
case ALL_SUBLINK:
|
||||
expr = (Expr *)lfirst(sublink->oper);
|
||||
expr = (Expr *) lfirst(sublink->oper);
|
||||
strcat(buf, get_opname(((Oper *) (expr->oper))->opno));
|
||||
strcat(buf, " ALL ");
|
||||
break;
|
||||
|
||||
case EXPR_SUBLINK:
|
||||
expr = (Expr *)lfirst(sublink->oper);
|
||||
expr = (Expr *) lfirst(sublink->oper);
|
||||
strcat(buf, get_opname(((Oper *) (expr->oper))->opno));
|
||||
strcat(buf, " ");
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "unupported sublink type %d",
|
||||
sublink->subLinkType);
|
||||
sublink->subLinkType);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.27 1999/05/10 00:46:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.28 1999/05/25 16:12:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -393,6 +393,7 @@ btreesel(Oid operatorObjectId,
|
||||
|
||||
if (FunctionalSelectivity(nIndexKeys, attributeNumber))
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to call the functions selectivity function here. For now
|
||||
* simply assume it's 1/3 since functions don't currently have
|
||||
@@ -437,6 +438,7 @@ btreenpage(Oid operatorObjectId,
|
||||
|
||||
if (FunctionalSelectivity(nIndexKeys, attributeNumber))
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to call the functions selectivity function here. For now
|
||||
* simply assume it's 1/3 since functions don't currently have
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.45 1999/05/19 17:53:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.46 1999/05/25 16:12:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ bpcharin(char *s, int dummy, int32 atttypmod)
|
||||
len = atttypmod - VARHDRSZ;
|
||||
|
||||
if (len > BLCKSZ - 128)
|
||||
elog(ERROR, "bpcharin: length of char() must be less than %d",BLCKSZ-128);
|
||||
elog(ERROR, "bpcharin: length of char() must be less than %d", BLCKSZ - 128);
|
||||
|
||||
result = (char *) palloc(atttypmod);
|
||||
VARSIZE(result) = atttypmod;
|
||||
@@ -152,7 +152,7 @@ bpchar(char *s, int32 len)
|
||||
rlen = len - VARHDRSZ;
|
||||
|
||||
if (rlen > BLCKSZ - 128)
|
||||
elog(ERROR, "bpchar: length of char() must be less than %d",BLCKSZ-128);
|
||||
elog(ERROR, "bpchar: length of char() must be less than %d", BLCKSZ - 128);
|
||||
|
||||
#ifdef STRINGDEBUG
|
||||
printf("bpchar- convert string length %d (%d) ->%d (%d)\n",
|
||||
@@ -163,13 +163,15 @@ bpchar(char *s, int32 len)
|
||||
VARSIZE(result) = len;
|
||||
r = VARDATA(result);
|
||||
#ifdef MULTIBYTE
|
||||
/* truncate multi-byte string in a way not to break
|
||||
multi-byte boundary */
|
||||
if (VARSIZE(s) > len) {
|
||||
slen = pg_mbcliplen(VARDATA(s), VARSIZE(s)-VARHDRSZ, rlen);
|
||||
} else {
|
||||
|
||||
/*
|
||||
* truncate multi-byte string in a way not to break multi-byte
|
||||
* boundary
|
||||
*/
|
||||
if (VARSIZE(s) > len)
|
||||
slen = pg_mbcliplen(VARDATA(s), VARSIZE(s) - VARHDRSZ, rlen);
|
||||
else
|
||||
slen = VARSIZE(s) - VARHDRSZ;
|
||||
}
|
||||
#else
|
||||
slen = VARSIZE(s) - VARHDRSZ;
|
||||
#endif
|
||||
@@ -206,7 +208,7 @@ bpchar(char *s, int32 len)
|
||||
* Converts an array of char() type to a specific internal length.
|
||||
* len is the length specified in () plus VARHDRSZ bytes.
|
||||
*/
|
||||
ArrayType *
|
||||
ArrayType *
|
||||
_bpchar(ArrayType *v, int32 len)
|
||||
{
|
||||
return array_map(v, BPCHAROID, bpchar, BPCHAROID, 1, len);
|
||||
@@ -331,7 +333,7 @@ varcharin(char *s, int dummy, int32 atttypmod)
|
||||
len = atttypmod; /* clip the string at max length */
|
||||
|
||||
if (len > BLCKSZ - 128)
|
||||
elog(ERROR, "varcharin: length of char() must be less than %d",BLCKSZ-128);
|
||||
elog(ERROR, "varcharin: length of char() must be less than %d", BLCKSZ - 128);
|
||||
|
||||
result = (char *) palloc(len);
|
||||
VARSIZE(result) = len;
|
||||
@@ -390,15 +392,18 @@ varchar(char *s, int32 slen)
|
||||
/* only reach here if we need to truncate string... */
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
/* truncate multi-byte string in a way not to break
|
||||
multi-byte boundary */
|
||||
|
||||
/*
|
||||
* truncate multi-byte string in a way not to break multi-byte
|
||||
* boundary
|
||||
*/
|
||||
len = pg_mbcliplen(VARDATA(s), slen - VARHDRSZ, slen - VARHDRSZ);
|
||||
slen = len + VARHDRSZ;
|
||||
#else
|
||||
len = slen - VARHDRSZ;
|
||||
#endif
|
||||
|
||||
if (len > BLCKSZ-128)
|
||||
if (len > BLCKSZ - 128)
|
||||
elog(ERROR, "varchar: length of varchar() must be less than BLCKSZ-128");
|
||||
|
||||
result = (char *) palloc(slen);
|
||||
@@ -412,7 +417,7 @@ varchar(char *s, int32 slen)
|
||||
* Converts an array of varchar() type to the specified size.
|
||||
* len is the length specified in () plus VARHDRSZ bytes.
|
||||
*/
|
||||
ArrayType *
|
||||
ArrayType *
|
||||
_varchar(ArrayType *v, int32 len)
|
||||
{
|
||||
return array_map(v, VARCHAROID, varchar, VARCHAROID, 1, len);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.47 1999/02/13 23:19:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.48 1999/05/25 16:12:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -314,7 +314,7 @@ textcat(text *t1, text *t2)
|
||||
* - string length
|
||||
*
|
||||
* If the starting position is zero or less, then return from the start of the string
|
||||
* adjusting the length to be consistant with the "negative start" per SQL92.
|
||||
* adjusting the length to be consistant with the "negative start" per SQL92.
|
||||
* If the length is less than zero, return the remaining string.
|
||||
*
|
||||
* Note that the arguments operate on octet length,
|
||||
@@ -352,11 +352,14 @@ text_substr(text *string, int32 m, int32 n)
|
||||
m = 1;
|
||||
n = 0;
|
||||
}
|
||||
/* starting position before the start of the string?
|
||||
* then offset into the string per SQL92 spec... */
|
||||
|
||||
/*
|
||||
* starting position before the start of the string? then offset into
|
||||
* the string per SQL92 spec...
|
||||
*/
|
||||
else if (m < 1)
|
||||
{
|
||||
n += (m-1);
|
||||
n += (m - 1);
|
||||
m = 1;
|
||||
}
|
||||
|
||||
@@ -588,10 +591,10 @@ text_ge(text *arg1, text *arg2)
|
||||
text *
|
||||
text_larger(text *arg1, text *arg2)
|
||||
{
|
||||
text *result;
|
||||
text *temp;
|
||||
text *result;
|
||||
text *temp;
|
||||
|
||||
temp = ((text_cmp(arg1, arg2) <= 0)? arg2: arg1);
|
||||
temp = ((text_cmp(arg1, arg2) <= 0) ? arg2 : arg1);
|
||||
|
||||
/* Make a copy */
|
||||
|
||||
@@ -604,10 +607,10 @@ text_larger(text *arg1, text *arg2)
|
||||
text *
|
||||
text_smaller(text *arg1, text *arg2)
|
||||
{
|
||||
text *result;
|
||||
text *temp;
|
||||
text *result;
|
||||
text *temp;
|
||||
|
||||
temp = ((text_cmp(arg1, arg2) > 0)? arg2: arg1);
|
||||
temp = ((text_cmp(arg1, arg2) > 0) ? arg2 : arg1);
|
||||
|
||||
/* Make a copy */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user