pgindent run before 6.3 release, with Thomas' requested changes.
This commit is contained in:
parent
757bf69a2e
commit
a32450a585
|
@ -35,27 +35,33 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
|
|||
int typlen;
|
||||
func_ptr proc_fn;
|
||||
int pronargs;
|
||||
int nitems, i, result;
|
||||
int ndim, *dim;
|
||||
int nitems,
|
||||
i,
|
||||
result;
|
||||
int ndim,
|
||||
*dim;
|
||||
char *p;
|
||||
|
||||
/* Sanity checks */
|
||||
if ((array == (ArrayType *) NULL)
|
||||
|| (ARR_IS_LO(array) == true)) {
|
||||
|| (ARR_IS_LO(array) == true))
|
||||
{
|
||||
/* elog(NOTICE, "array_iterator: array is null"); */
|
||||
return (0);
|
||||
}
|
||||
ndim = ARR_NDIM(array);
|
||||
dim = ARR_DIMS(array);
|
||||
nitems = getNitems(ndim, dim);
|
||||
if (nitems == 0) {
|
||||
if (nitems == 0)
|
||||
{
|
||||
/* elog(NOTICE, "array_iterator: nitems = 0"); */
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Lookup element type information */
|
||||
typ_tuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(elemtype), 0, 0, 0);
|
||||
if (!HeapTupleIsValid(typ_tuple)) {
|
||||
if (!HeapTupleIsValid(typ_tuple))
|
||||
{
|
||||
elog(ERROR, "array_iterator: cache lookup failed for type %d", elemtype);
|
||||
return 0;
|
||||
}
|
||||
|
@ -66,7 +72,8 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
|
|||
/* Lookup the function entry point */
|
||||
proc_fn = (func_ptr) NULL;
|
||||
fmgr_info(proc, &proc_fn, &pronargs);
|
||||
if ((proc_fn == NULL) || (pronargs != 2)) {
|
||||
if ((proc_fn == NULL) || (pronargs != 2))
|
||||
{
|
||||
elog(ERROR, "array_iterator: fmgr_info lookup failed for oid %d", proc);
|
||||
return (0);
|
||||
}
|
||||
|
@ -74,9 +81,12 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
|
|||
/* Scan the array and apply the operator to each element */
|
||||
result = 0;
|
||||
p = ARR_DATA_PTR(array);
|
||||
for (i = 0; i < nitems; i++) {
|
||||
if (typbyval) {
|
||||
switch(typlen) {
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
if (typbyval)
|
||||
{
|
||||
switch (typlen)
|
||||
{
|
||||
case 1:
|
||||
result = (int) (*proc_fn) (*p, value);
|
||||
break;
|
||||
|
@ -89,28 +99,41 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
|
|||
break;
|
||||
}
|
||||
p += typlen;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (int) (*proc_fn) (p, value);
|
||||
if (typlen > 0) {
|
||||
if (typlen > 0)
|
||||
{
|
||||
p += typlen;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
p += INTALIGN(*(int32 *) p);
|
||||
}
|
||||
}
|
||||
if (result) {
|
||||
if (!and) {
|
||||
if (result)
|
||||
{
|
||||
if (!and)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
} else {
|
||||
if (and) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (and)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (and && result) {
|
||||
if (and && result)
|
||||
{
|
||||
return (1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef ARRAY_ITERATOR_H
|
||||
#define ARRAY_ITERATOR_H
|
||||
|
||||
static int32 array_iterator(Oid elemtype, Oid proc, int and,
|
||||
static int32
|
||||
array_iterator(Oid elemtype, Oid proc, int and,
|
||||
ArrayType *array, Datum value);
|
||||
int32 array_texteq(ArrayType *array, char *value);
|
||||
int32 array_all_texteq(ArrayType *array, char *value);
|
||||
|
|
|
@ -38,7 +38,8 @@ hhmm_in(char *str)
|
|||
TimeADT *time;
|
||||
|
||||
double fsec;
|
||||
struct tm tt, *tm = &tt;
|
||||
struct tm tt,
|
||||
*tm = &tt;
|
||||
|
||||
int nf;
|
||||
char lowstr[MAXDATELEN + 1];
|
||||
|
@ -54,7 +55,8 @@ hhmm_in(char *str)
|
|||
elog(ERROR, "Bad time external representation '%s'", str);
|
||||
|
||||
if (tm->tm_hour < 0 || tm->tm_hour > 24 ||
|
||||
(tm->tm_hour==24 && (tm->tm_min!=0 || tm->tm_sec!=0 || fsec!= 0))) {
|
||||
(tm->tm_hour == 24 && (tm->tm_min != 0 || tm->tm_sec != 0 || fsec != 0)))
|
||||
{
|
||||
elog(ERROR,
|
||||
"time_in: hour must be limited to values 0 through 24:00 "
|
||||
"in \"%s\"",
|
||||
|
@ -83,7 +85,8 @@ char *
|
|||
hhmm_out(TimeADT *time)
|
||||
{
|
||||
char *result;
|
||||
struct tm tt, *tm = &tt;
|
||||
struct tm tt,
|
||||
*tm = &tt;
|
||||
char buf[MAXDATELEN + 1];
|
||||
|
||||
if (!PointerIsValid(time))
|
||||
|
@ -93,9 +96,12 @@ hhmm_out(TimeADT *time)
|
|||
tm->tm_min = (((int) (*time / 60)) % 60);
|
||||
tm->tm_sec = (((int) *time) % 60);
|
||||
|
||||
if (tm->tm_sec == 0) {
|
||||
if (tm->tm_sec == 0)
|
||||
{
|
||||
sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
}
|
||||
|
||||
|
@ -158,7 +164,9 @@ as_seconds(TimeADT *time)
|
|||
int4
|
||||
date_day(DateADT val)
|
||||
{
|
||||
int year, month, day;
|
||||
int year,
|
||||
month,
|
||||
day;
|
||||
|
||||
j2date(val + JDATE_2000, &year, &month, &day);
|
||||
|
||||
|
@ -168,7 +176,9 @@ date_day(DateADT val)
|
|||
int4
|
||||
date_month(DateADT val)
|
||||
{
|
||||
int year, month, day;
|
||||
int year,
|
||||
month,
|
||||
day;
|
||||
|
||||
j2date(val + JDATE_2000, &year, &month, &day);
|
||||
|
||||
|
@ -178,7 +188,9 @@ date_month(DateADT val)
|
|||
int4
|
||||
date_year(DateADT val)
|
||||
{
|
||||
int year, month, day;
|
||||
int year,
|
||||
month,
|
||||
day;
|
||||
|
||||
j2date(val + JDATE_2000, &year, &month, &day);
|
||||
|
||||
|
@ -203,7 +215,8 @@ DateADT
|
|||
currentdate()
|
||||
{
|
||||
DateADT date;
|
||||
struct tm tt, *tm = &tt;
|
||||
struct tm tt,
|
||||
*tm = &tt;
|
||||
|
||||
GetCurrentTime(tm);
|
||||
date = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - JDATE_2000);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* PostgreSQL type definitions for IP addresses.
|
||||
*
|
||||
* $Id: ip.c,v 1.2 1998/02/14 17:58:03 scrappy Exp $
|
||||
* $Id: ip.c,v 1.3 1998/02/26 04:27:37 momjian Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -13,7 +13,8 @@
|
|||
* This is the internal storage format for IP addresses:
|
||||
*/
|
||||
|
||||
typedef struct ipaddr {
|
||||
typedef struct ipaddr
|
||||
{
|
||||
uint32 address;
|
||||
int16 width;
|
||||
} ipaddr;
|
||||
|
@ -43,9 +44,12 @@ ipaddr *ipaddr_bcast(ipaddr *a);
|
|||
* Build a mask of a given width:
|
||||
*/
|
||||
|
||||
unsigned long build_mask(unsigned char bits) {
|
||||
unsigned long
|
||||
build_mask(unsigned char bits)
|
||||
{
|
||||
unsigned long mask = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bits; i++)
|
||||
mask = (mask >> 1) | 0x80000000;
|
||||
return mask;
|
||||
|
@ -56,16 +60,24 @@ unsigned long build_mask(unsigned char bits) {
|
|||
* is used to determine whether the mask size was specified.
|
||||
*/
|
||||
|
||||
ipaddr *ipaddr_in(char *str) {
|
||||
int a, b, c, d, w;
|
||||
ipaddr *
|
||||
ipaddr_in(char *str)
|
||||
{
|
||||
int a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
w;
|
||||
ipaddr *result;
|
||||
int count;
|
||||
|
||||
if (strlen(str) > 0) {
|
||||
if (strlen(str) > 0)
|
||||
{
|
||||
|
||||
count = sscanf(str, "%d.%d.%d.%d/%d", &a, &b, &c, &d, &w);
|
||||
|
||||
if (count < 4) {
|
||||
if (count < 4)
|
||||
{
|
||||
elog(ERROR, "ipaddr_in: error in parsing \"%s\"", str);
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -75,11 +87,14 @@ ipaddr *ipaddr_in(char *str) {
|
|||
|
||||
if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
|
||||
(c < 0) || (c > 255) || (d < 0) || (d > 255) ||
|
||||
(w < 0) || (w > 32)) {
|
||||
(w < 0) || (w > 32))
|
||||
{
|
||||
elog(ERROR, "ipaddr_in: illegal address \"%s\"", str);
|
||||
return (NULL);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
a = b = c = d = w = 0; /* special case for missing address */
|
||||
}
|
||||
|
||||
|
@ -97,7 +112,9 @@ ipaddr *ipaddr_in(char *str) {
|
|||
* generated only for subnets, not for plain host addresses.
|
||||
*/
|
||||
|
||||
char *ipaddr_out(ipaddr *addr) {
|
||||
char *
|
||||
ipaddr_out(ipaddr * addr)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if (addr == NULL)
|
||||
|
@ -105,7 +122,8 @@ char *ipaddr_out(ipaddr *addr) {
|
|||
|
||||
result = (char *) palloc(32);
|
||||
|
||||
if (addr->address > 0) {
|
||||
if (addr->address > 0)
|
||||
{
|
||||
if (addr->width == 32)
|
||||
sprintf(result, "%d.%d.%d.%d",
|
||||
(addr->address >> 24) & 0xff,
|
||||
|
@ -119,7 +137,9 @@ char *ipaddr_out(ipaddr *addr) {
|
|||
(addr->address >> 8) & 0xff,
|
||||
addr->address & 0xff,
|
||||
addr->width);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result[0] = 0; /* special case for missing address */
|
||||
}
|
||||
return (result);
|
||||
|
@ -129,27 +149,39 @@ char *ipaddr_out(ipaddr *addr) {
|
|||
* Boolean tests for magnitude.
|
||||
*/
|
||||
|
||||
bool ipaddr_lt(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_lt(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
return (a1->address < a2->address);
|
||||
};
|
||||
|
||||
bool ipaddr_le(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_le(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
return (a1->address <= a2->address);
|
||||
};
|
||||
|
||||
bool ipaddr_eq(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_eq(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
return (a1->address == a2->address);
|
||||
};
|
||||
|
||||
bool ipaddr_ge(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_ge(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
return (a1->address >= a2->address);
|
||||
};
|
||||
|
||||
bool ipaddr_gt(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_gt(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
return (a1->address > a2->address);
|
||||
};
|
||||
|
||||
bool ipaddr_ne(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_ne(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
return (a1->address != a2->address);
|
||||
};
|
||||
|
||||
|
@ -157,7 +189,9 @@ bool ipaddr_ne(ipaddr *a1, ipaddr *a2) {
|
|||
* Comparison function for sorting:
|
||||
*/
|
||||
|
||||
int4 ipaddr_cmp(ipaddr *a1, ipaddr *a2) {
|
||||
int4
|
||||
ipaddr_cmp(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
if (a1->address < a2->address)
|
||||
return -1;
|
||||
else if (a1->address > a2->address)
|
||||
|
@ -170,8 +204,11 @@ int4 ipaddr_cmp(ipaddr *a1, ipaddr *a2) {
|
|||
* Test whether an address is within a given subnet:
|
||||
*/
|
||||
|
||||
bool ipaddr_in_net(ipaddr *a1, ipaddr *a2) {
|
||||
bool
|
||||
ipaddr_in_net(ipaddr * a1, ipaddr * a2)
|
||||
{
|
||||
uint32 maskbits;
|
||||
|
||||
if (a1->width < a2->width)
|
||||
return FALSE;
|
||||
if ((a1->width == 32) && (a2->width == 32))
|
||||
|
@ -186,7 +223,9 @@ bool ipaddr_in_net(ipaddr *a1, ipaddr *a2) {
|
|||
* Pick out just the mask of a network:
|
||||
*/
|
||||
|
||||
ipaddr *ipaddr_mask(ipaddr *a) {
|
||||
ipaddr *
|
||||
ipaddr_mask(ipaddr * a)
|
||||
{
|
||||
ipaddr *result;
|
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr));
|
||||
|
@ -200,7 +239,9 @@ ipaddr *ipaddr_mask(ipaddr *a) {
|
|||
* Return the broadcast address of a network:
|
||||
*/
|
||||
|
||||
ipaddr *ipaddr_bcast(ipaddr *a) {
|
||||
ipaddr *
|
||||
ipaddr_bcast(ipaddr * a)
|
||||
{
|
||||
ipaddr *result;
|
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* PostgreSQL type definitions for MAC addresses.
|
||||
*
|
||||
* $Id: mac.c,v 1.2 1998/02/14 17:58:05 scrappy Exp $
|
||||
* $Id: mac.c,v 1.3 1998/02/26 04:27:44 momjian Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -15,7 +15,8 @@
|
|||
* This is the internal storage format for MAC addresses:
|
||||
*/
|
||||
|
||||
typedef struct macaddr {
|
||||
typedef struct macaddr
|
||||
{
|
||||
unsigned char a;
|
||||
unsigned char b;
|
||||
unsigned char c;
|
||||
|
@ -57,12 +58,20 @@ text *macaddr_manuf(macaddr *addr);
|
|||
* MAC address reader. Accepts several common notations.
|
||||
*/
|
||||
|
||||
macaddr *macaddr_in(char *str) {
|
||||
int a, b, c, d, e, f;
|
||||
macaddr *
|
||||
macaddr_in(char *str)
|
||||
{
|
||||
int a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f;
|
||||
macaddr *result;
|
||||
int count;
|
||||
|
||||
if (strlen(str) > 0) {
|
||||
if (strlen(str) > 0)
|
||||
{
|
||||
|
||||
count = sscanf(str, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f);
|
||||
if (count != 6)
|
||||
|
@ -74,19 +83,24 @@ macaddr *macaddr_in(char *str) {
|
|||
if (count != 6)
|
||||
count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f);
|
||||
|
||||
if (count != 6) {
|
||||
if (count != 6)
|
||||
{
|
||||
elog(ERROR, "macaddr_in: error in parsing \"%s\"", str);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
|
||||
(c < 0) || (c > 255) || (d < 0) || (d > 255) ||
|
||||
(e < 0) || (e > 255) || (f < 0) || (f > 255)) {
|
||||
(e < 0) || (e > 255) || (f < 0) || (f > 255))
|
||||
{
|
||||
elog(ERROR, "macaddr_in: illegal address \"%s\"", str);
|
||||
return (NULL);
|
||||
}
|
||||
} else {
|
||||
a = b = c = d = e = f = 0; /* special case for missing address */
|
||||
}
|
||||
else
|
||||
{
|
||||
a = b = c = d = e = f = 0; /* special case for missing
|
||||
* address */
|
||||
}
|
||||
|
||||
result = (macaddr *) palloc(sizeof(macaddr));
|
||||
|
@ -105,7 +119,9 @@ macaddr *macaddr_in(char *str) {
|
|||
* MAC address output function. Fixed format.
|
||||
*/
|
||||
|
||||
char *macaddr_out(macaddr *addr) {
|
||||
char *
|
||||
macaddr_out(macaddr * addr)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if (addr == NULL)
|
||||
|
@ -113,10 +129,13 @@ char *macaddr_out(macaddr *addr) {
|
|||
|
||||
result = (char *) palloc(32);
|
||||
|
||||
if ((hibits(addr) > 0) || (lobits(addr) > 0)) {
|
||||
if ((hibits(addr) > 0) || (lobits(addr) > 0))
|
||||
{
|
||||
sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
addr->a, addr->b, addr->c, addr->d, addr->e, addr->f);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result[0] = 0; /* special case for missing address */
|
||||
}
|
||||
return (result);
|
||||
|
@ -126,31 +145,43 @@ char *macaddr_out(macaddr *addr) {
|
|||
* Boolean tests.
|
||||
*/
|
||||
|
||||
bool macaddr_lt(macaddr *a1, macaddr *a2) {
|
||||
bool
|
||||
macaddr_lt(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
return ((hibits(a1) < hibits(a2)) ||
|
||||
((hibits(a1) == hibits(a2)) && lobits(a1) < lobits(a2)));
|
||||
};
|
||||
|
||||
bool macaddr_le(macaddr *a1, macaddr *a2) {
|
||||
bool
|
||||
macaddr_le(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
return ((hibits(a1) < hibits(a2)) ||
|
||||
((hibits(a1) == hibits(a2)) && lobits(a1) <= lobits(a2)));
|
||||
};
|
||||
|
||||
bool macaddr_eq(macaddr *a1, macaddr *a2) {
|
||||
bool
|
||||
macaddr_eq(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
return ((hibits(a1) == hibits(a2)) && (lobits(a1) == lobits(a2)));
|
||||
};
|
||||
|
||||
bool macaddr_ge(macaddr *a1, macaddr *a2) {
|
||||
bool
|
||||
macaddr_ge(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
return ((hibits(a1) > hibits(a2)) ||
|
||||
((hibits(a1) == hibits(a2)) && lobits(a1) >= lobits(a2)));
|
||||
};
|
||||
|
||||
bool macaddr_gt(macaddr *a1, macaddr *a2) {
|
||||
bool
|
||||
macaddr_gt(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
return ((hibits(a1) > hibits(a2)) ||
|
||||
((hibits(a1) == hibits(a2)) && lobits(a1) > lobits(a2)));
|
||||
};
|
||||
|
||||
bool macaddr_ne(macaddr *a1, macaddr *a2) {
|
||||
bool
|
||||
macaddr_ne(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
return ((hibits(a1) != hibits(a2)) || (lobits(a1) != lobits(a2)));
|
||||
};
|
||||
|
||||
|
@ -158,7 +189,9 @@ bool macaddr_ne(macaddr *a1, macaddr *a2) {
|
|||
* Comparison function for sorting:
|
||||
*/
|
||||
|
||||
int4 macaddr_cmp(macaddr *a1, macaddr *a2) {
|
||||
int4
|
||||
macaddr_cmp(macaddr * a1, macaddr * a2)
|
||||
{
|
||||
if (hibits(a1) < hibits(a2))
|
||||
return -1;
|
||||
else if (hibits(a1) > hibits(a2))
|
||||
|
@ -175,22 +208,28 @@ int4 macaddr_cmp(macaddr *a1, macaddr *a2) {
|
|||
* The special manufacturer fetching function. See "mac.h".
|
||||
*/
|
||||
|
||||
text *macaddr_manuf(macaddr *addr) {
|
||||
text *
|
||||
macaddr_manuf(macaddr * addr)
|
||||
{
|
||||
manufacturer *manuf;
|
||||
int length;
|
||||
text *result;
|
||||
|
||||
for (manuf = manufacturers; manuf->name != NULL; manuf++) {
|
||||
for (manuf = manufacturers; manuf->name != NULL; manuf++)
|
||||
{
|
||||
if ((manuf->a == addr->a) &&
|
||||
(manuf->b == addr->b) &&
|
||||
(manuf->c == addr->c))
|
||||
break;
|
||||
}
|
||||
if (manuf->name == NULL) {
|
||||
if (manuf->name == NULL)
|
||||
{
|
||||
result = palloc(VARHDRSZ + 1);
|
||||
memset(result, 0, VARHDRSZ + 1);
|
||||
VARSIZE(result) = VARHDRSZ + 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
length = strlen(manuf->name) + 1;
|
||||
result = palloc(length + VARHDRSZ);
|
||||
memset(result, 0, length + VARHDRSZ);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* PostgreSQL type definitions for MAC addresses.
|
||||
*
|
||||
* $Id: mac.h,v 1.2 1998/02/14 17:58:07 scrappy Exp $
|
||||
* $Id: mac.h,v 1.3 1998/02/26 04:27:50 momjian Exp $
|
||||
*/
|
||||
|
||||
typedef struct manufacturer {
|
||||
typedef struct manufacturer
|
||||
{
|
||||
unsigned char a;
|
||||
unsigned char b;
|
||||
unsigned char c;
|
||||
|
|
|
@ -53,8 +53,10 @@ timetravel()
|
|||
Trigger *trigger; /* to get trigger name */
|
||||
char **args; /* arguments */
|
||||
int attnum[2]; /* fnumbers of start/stop columns */
|
||||
Datum oldon, oldoff;
|
||||
Datum newon, newoff;
|
||||
Datum oldon,
|
||||
oldoff;
|
||||
Datum newon,
|
||||
newoff;
|
||||
Datum *cvals; /* column values */
|
||||
char *cnulls; /* column nulls */
|
||||
char *relname; /* triggered relation name */
|
||||
|
@ -187,9 +189,10 @@ timetravel()
|
|||
oldoff = SPI_getbinval(trigtuple, tupdesc, attnum[1], &isnull);
|
||||
if (isnull)
|
||||
elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
|
||||
|
||||
/*
|
||||
* If DELETE/UPDATE of tuple with stop_date neq INFINITY
|
||||
* then say upper Executor to skip operation for this tuple
|
||||
* If DELETE/UPDATE of tuple with stop_date neq INFINITY then say
|
||||
* upper Executor to skip operation for this tuple
|
||||
*/
|
||||
if (newtuple != NULL) /* UPDATE */
|
||||
{
|
||||
|
@ -240,15 +243,16 @@ timetravel()
|
|||
cvals[attnum[1] - 1] = NOEND_ABSTIME; /* stop_date eq INFINITY */
|
||||
cnulls[attnum[1] - 1] = ' ';
|
||||
}
|
||||
else /* DELETE */
|
||||
else
|
||||
/* DELETE */
|
||||
{
|
||||
cvals[attnum[1] - 1] = newoff; /* stop_date eq current date */
|
||||
cnulls[attnum[1] - 1] = ' ';
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct ident string as TriggerName $ TriggeredRelationId
|
||||
* and try to find prepared execution plan.
|
||||
* Construct ident string as TriggerName $ TriggeredRelationId and try
|
||||
* to find prepared execution plan.
|
||||
*/
|
||||
sprintf(ident, "%s$%u", trigger->tgname, rel->rd_id);
|
||||
plan = find_plan(ident, &Plans, &nPlans);
|
||||
|
@ -264,8 +268,7 @@ timetravel()
|
|||
ctypes = (Oid *) palloc(natts * sizeof(Oid));
|
||||
|
||||
/*
|
||||
* Construct query:
|
||||
* INSERT INTO _relation_ VALUES ($1, ...)
|
||||
* Construct query: INSERT INTO _relation_ VALUES ($1, ...)
|
||||
*/
|
||||
sprintf(sql, "INSERT INTO %s VALUES (", relname);
|
||||
for (i = 1; i <= natts; i++)
|
||||
|
@ -307,13 +310,15 @@ timetravel()
|
|||
|
||||
tmptuple = SPI_copytuple(trigtuple);
|
||||
rettuple = SPI_modifytuple(rel, tmptuple, 1, &(attnum[1]), &newoff, NULL);
|
||||
|
||||
/*
|
||||
* SPI_copytuple allocates tmptuple in upper executor context -
|
||||
* have to free allocation using SPI_pfree
|
||||
*/
|
||||
SPI_pfree(tmptuple);
|
||||
}
|
||||
else /* DELETE */
|
||||
else
|
||||
/* DELETE */
|
||||
rettuple = trigtuple;
|
||||
|
||||
SPI_finish(); /* don't forget say Bye to SPI mgr */
|
||||
|
|
|
@ -50,24 +50,32 @@
|
|||
char *
|
||||
string_output(char *data, int size)
|
||||
{
|
||||
register unsigned char c, *p, *r, *result;
|
||||
register int l, len;
|
||||
register unsigned char c,
|
||||
*p,
|
||||
*r,
|
||||
*result;
|
||||
register int l,
|
||||
len;
|
||||
|
||||
if (data == NULL) {
|
||||
if (data == NULL)
|
||||
{
|
||||
result = (char *) palloc(2);
|
||||
result[0] = '-';
|
||||
result[1] = '\0';
|
||||
return (result);
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
if (size < 0)
|
||||
{
|
||||
size = strlen(data);
|
||||
}
|
||||
|
||||
/* adjust string length for escapes */
|
||||
len = size;
|
||||
for (p=data,l=size; l>0; p++,l--) {
|
||||
switch (*p) {
|
||||
for (p = data, l = size; l > 0; p++, l--)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case '\\':
|
||||
case '"':
|
||||
case '{':
|
||||
|
@ -81,7 +89,8 @@ string_output(char *data, int size)
|
|||
len++;
|
||||
break;
|
||||
default:
|
||||
if (NOTPRINTABLE(*p)) {
|
||||
if (NOTPRINTABLE(*p))
|
||||
{
|
||||
len += 3;
|
||||
}
|
||||
}
|
||||
|
@ -90,8 +99,10 @@ string_output(char *data, int size)
|
|||
|
||||
result = (char *) palloc(len);
|
||||
|
||||
for (p=data,r=result,l=size; (l > 0) && (c = *p); p++,l--) {
|
||||
switch (c) {
|
||||
for (p = data, r = result, l = size; (l > 0) && (c = *p); p++, l--)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
case '"':
|
||||
case '{':
|
||||
|
@ -124,7 +135,8 @@ string_output(char *data, int size)
|
|||
*r++ = 'v';
|
||||
break;
|
||||
default:
|
||||
if (NOTPRINTABLE(c)) {
|
||||
if (NOTPRINTABLE(c))
|
||||
{
|
||||
*r = '\\';
|
||||
r += 3;
|
||||
*r-- = DIGIT(c & 07);
|
||||
|
@ -133,7 +145,9 @@ string_output(char *data, int size)
|
|||
c >>= 3;
|
||||
*r = DIGIT(c & 03);
|
||||
r += 3;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
*r++ = c;
|
||||
}
|
||||
}
|
||||
|
@ -172,54 +186,69 @@ string_output(char *data, int size)
|
|||
char *
|
||||
string_input(char *str, int size, int hdrsize, int *rtn_size)
|
||||
{
|
||||
register unsigned char *p, *r;
|
||||
register unsigned char *p,
|
||||
*r;
|
||||
unsigned char *result;
|
||||
int len;
|
||||
|
||||
if ((str == NULL) || (hdrsize < 0)) {
|
||||
if ((str == NULL) || (hdrsize < 0))
|
||||
{
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
/* Compute result size */
|
||||
len = strlen(str);
|
||||
for (p=str; *p; ) {
|
||||
if (*p++ == '\\') {
|
||||
if (ISOCTAL(*p)) {
|
||||
if (ISOCTAL(*(p+1))) {
|
||||
for (p = str; *p;)
|
||||
{
|
||||
if (*p++ == '\\')
|
||||
{
|
||||
if (ISOCTAL(*p))
|
||||
{
|
||||
if (ISOCTAL(*(p + 1)))
|
||||
{
|
||||
p++;
|
||||
len--;
|
||||
}
|
||||
if (ISOCTAL(*(p+1))) {
|
||||
if (ISOCTAL(*(p + 1)))
|
||||
{
|
||||
p++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
if (*p) p++;
|
||||
if (*p)
|
||||
p++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
|
||||
/* result has variable length */
|
||||
if (size == 0) {
|
||||
if (size == 0)
|
||||
{
|
||||
size = len + 1;
|
||||
} else
|
||||
|
||||
}
|
||||
else
|
||||
/* result has variable length with maximum size */
|
||||
if (size < 0) {
|
||||
if (size < 0)
|
||||
{
|
||||
size = MIN(len, -size) + 1;
|
||||
}
|
||||
|
||||
result = (char *) palloc(hdrsize + size);
|
||||
memset(result, 0, hdrsize + size);
|
||||
if (rtn_size) {
|
||||
if (rtn_size)
|
||||
{
|
||||
*rtn_size = size;
|
||||
}
|
||||
|
||||
r = result + hdrsize;
|
||||
for (p=str; *p; ) {
|
||||
for (p = str; *p;)
|
||||
{
|
||||
register unsigned char c;
|
||||
if ((c = *p++) == '\\') {
|
||||
switch (c = *p++) {
|
||||
|
||||
if ((c = *p++) == '\\')
|
||||
{
|
||||
switch (c = *p++)
|
||||
{
|
||||
case '\0':
|
||||
p--;
|
||||
break;
|
||||
|
@ -232,10 +261,12 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
|
|||
case '6':
|
||||
case '7':
|
||||
c = VALUE(c);
|
||||
if (isdigit(*p)) {
|
||||
if (isdigit(*p))
|
||||
{
|
||||
c = (c << 3) + VALUE(*p++);
|
||||
}
|
||||
if (isdigit(*p)) {
|
||||
if (isdigit(*p))
|
||||
{
|
||||
c = (c << 3) + VALUE(*p++);
|
||||
}
|
||||
*r++ = c;
|
||||
|
@ -261,7 +292,9 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
|
|||
default:
|
||||
*r++ = c;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
*r++ = c;
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +347,8 @@ c_textout(struct varlena *vlena)
|
|||
int len = 0;
|
||||
char *s = NULL;
|
||||
|
||||
if (vlena) {
|
||||
if (vlena)
|
||||
{
|
||||
len = VARSIZE(vlena) - VARHDRSZ;
|
||||
s = VARDATA(vlena);
|
||||
}
|
||||
|
@ -330,7 +364,8 @@ c_varcharout(char *s)
|
|||
{
|
||||
int len = 0;
|
||||
|
||||
if (s) {
|
||||
if (s)
|
||||
{
|
||||
len = *(int32 *) s - 4;
|
||||
s += 4;
|
||||
}
|
||||
|
@ -344,7 +379,8 @@ c_textin(char *str)
|
|||
struct varlena *result;
|
||||
int len;
|
||||
|
||||
if (str == NULL) {
|
||||
if (str == NULL)
|
||||
{
|
||||
return ((struct varlena *) NULL);
|
||||
}
|
||||
|
||||
|
@ -359,6 +395,7 @@ c_char16in(char *str)
|
|||
{
|
||||
return (string_input(str, 16, 0, NULL));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ char *c_varcharout(char *s);
|
|||
#if 0
|
||||
struct varlena *c_textin(char *str);
|
||||
char *c_char16in(char *str);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -88,7 +88,8 @@ user_unlock_all()
|
|||
SHMEM_OFFSET location;
|
||||
|
||||
ShmemPIDLookup(getpid(), &location);
|
||||
if (location == INVALID_OFFSET) {
|
||||
if (location == INVALID_OFFSET)
|
||||
{
|
||||
elog(NOTICE, "UserUnlockAll: unable to get proc ptr");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.36 1998/02/11 19:09:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.37 1998/02/26 04:29:15 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The old interface functions have been converted to macros
|
||||
|
@ -430,6 +430,7 @@ nocachegetattr(HeapTuple tup,
|
|||
}
|
||||
else if (attnum == 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* first attribute is always at position zero
|
||||
*/
|
||||
|
@ -520,8 +521,8 @@ nocachegetattr(HeapTuple tup,
|
|||
int j = 0;
|
||||
|
||||
/*
|
||||
* In for(), we make this <= and not < because we want to
|
||||
* test if we can go past it in initializing offsets.
|
||||
* In for(), we make this <= and not < because we want to test
|
||||
* if we can go past it in initializing offsets.
|
||||
*/
|
||||
for (j = 0; j <= attnum && !slow; j++)
|
||||
if (att[j]->attlen < 1 && !VARLENA_FIXED_SIZE(att[j]))
|
||||
|
@ -561,6 +562,7 @@ nocachegetattr(HeapTuple tup,
|
|||
(HeapTupleAllFixed(tup) ||
|
||||
att[j]->attlen > 0 || VARLENA_FIXED_SIZE(att[j]))); j++)
|
||||
{
|
||||
|
||||
/*
|
||||
* Fix me when going to a machine with more than a four-byte
|
||||
* word!
|
||||
|
@ -1018,4 +1020,3 @@ heap_addheader(uint32 natts, /* max domain index */
|
|||
|
||||
return (tup);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.27 1998/02/11 19:09:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.28 1998/02/26 04:29:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -300,6 +300,7 @@ nocache_index_getattr(IndexTuple tup,
|
|||
|
||||
for (; j < attnum + 1; j++)
|
||||
{
|
||||
|
||||
/*
|
||||
* Fix me when going to a machine with more than a four-byte
|
||||
* word!
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.26 1998/02/11 19:09:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.27 1998/02/26 04:29:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.35 1998/02/10 16:02:46 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.36 1998/02/26 04:29:22 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the executor utility code such as "ExecTypeFromTL" should be
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.17 1997/11/20 23:19:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.18 1998/02/26 04:29:28 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.26 1998/02/11 19:09:30 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.27 1998/02/26 04:29:31 momjian Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
|
@ -654,6 +654,7 @@ heap_beginscan(Relation relation,
|
|||
sdesc->rs_rd = relation;
|
||||
|
||||
if (nkeys)
|
||||
|
||||
/*
|
||||
* we do this here instead of in initsdesc() because heap_rescan
|
||||
* also calls initsdesc() and we don't want to allocate memory
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.16 1998/01/15 19:42:02 pgsql Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.17 1998/02/26 04:29:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.24 1997/11/20 23:20:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.25 1998/02/26 04:29:44 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.30 1998/01/15 19:42:13 pgsql Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.31 1998/02/26 04:29:50 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -197,12 +197,11 @@ _bt_moveright(Relation rel,
|
|||
* if number of attrs > keysize. Example: (2,0) - last items
|
||||
* on this page, (2,1) - first item on next page (hikey), our
|
||||
* scankey is x = 2. Scankey == (2,1) because of we compare
|
||||
* first attrs only, but we shouldn't to move right of here.
|
||||
* - vadim 04/15/97
|
||||
* first attrs only, but we shouldn't to move right of here. -
|
||||
* vadim 04/15/97
|
||||
*
|
||||
* Also, if this page is not LEAF one (and # of attrs > keysize)
|
||||
* then we can't move too.
|
||||
* - vadim 10/22/97
|
||||
* then we can't move too. - vadim 10/22/97
|
||||
*/
|
||||
|
||||
if (_bt_skeycmp(rel, keysz, scankey, page, hikey,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Id: nbtsort.c,v 1.28 1998/02/21 19:23:14 scrappy Exp $
|
||||
* $Id: nbtsort.c,v 1.29 1998/02/26 04:29:54 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.15 1998/01/07 21:02:05 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.16 1998/02/26 04:30:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.22 1998/01/15 19:42:19 pgsql Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.23 1998/02/26 04:30:15 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.16 1998/01/07 21:02:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.17 1998/02/26 04:30:18 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains the high level access-method interface to the
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.11 1997/11/02 15:24:47 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.12 1998/02/26 04:30:19 momjian Exp $
|
||||
*
|
||||
* OLD COMMENTS
|
||||
* XXX WARNING
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.36 1998/02/11 19:09:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.37 1998/02/26 04:30:22 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -208,11 +208,13 @@ extern int fsyncOff; /* do not fsync the database */
|
|||
|
||||
#if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp)
|
||||
static jmp_buf Warn_restart;
|
||||
|
||||
#define sigsetjmp(x,y) setjmp(x)
|
||||
#define siglongjmp longjmp
|
||||
|
||||
#else
|
||||
static sigjmp_buf Warn_restart;
|
||||
|
||||
#endif
|
||||
|
||||
int DebugMode;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.7 1998/02/25 13:05:57 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.8 1998/02/26 04:30:26 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* See acl.h.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.14 1998/02/11 19:09:47 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.15 1998/02/26 04:30:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.46 1998/02/11 19:09:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.47 1998/02/26 04:30:35 momjian Exp $
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
* heap_create() - Create an uncataloged heap relation
|
||||
|
@ -63,7 +63,8 @@
|
|||
#include <string.h>
|
||||
#endif
|
||||
|
||||
static void AddPgRelationTuple(Relation pg_class_desc,
|
||||
static void
|
||||
AddPgRelationTuple(Relation pg_class_desc,
|
||||
Relation new_rel_desc, Oid new_rel_oid, unsigned natts);
|
||||
static void AddToTempRelList(Relation r);
|
||||
static void DeletePgAttributeTuples(Relation rdesc);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.38 1998/02/07 21:41:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.39 1998/02/26 04:30:38 momjian Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.12 1998/02/11 19:10:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.13 1998/02/26 04:30:40 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.21 1998/02/11 19:10:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.22 1998/02/26 04:30:41 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* these routines moved here from commands/define.c and somewhat cleaned up.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.14 1998/02/11 19:10:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.15 1998/02/26 04:30:43 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.19 1998/02/11 19:10:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.20 1998/02/26 04:30:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.28 1998/01/31 04:38:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.29 1998/02/26 04:30:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.22 1998/01/10 05:19:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.23 1998/02/26 04:30:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -212,8 +212,8 @@ copy_heap(Oid OIDOldHeap)
|
|||
OldHeapDesc = RelationGetTupleDescriptor(OldHeap);
|
||||
|
||||
/*
|
||||
* Need to make a copy of the tuple descriptor, heap_create_with_catalog
|
||||
* modifies it.
|
||||
* Need to make a copy of the tuple descriptor,
|
||||
* heap_create_with_catalog modifies it.
|
||||
*/
|
||||
|
||||
tupdesc = CreateTupleDescCopy(OldHeapDesc);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.25 1998/02/07 21:41:52 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.26 1998/02/26 04:30:49 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The PortalExecutorHeapMemory crap needs to be eliminated
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.43 1998/02/25 13:06:08 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.44 1998/02/26 04:30:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -48,7 +48,8 @@ static Oid GetOutputFunction(Oid type);
|
|||
static Oid GetTypeElement(Oid type);
|
||||
static Oid GetInputFunction(Oid type);
|
||||
static Oid IsTypeByVal(Oid type);
|
||||
static void GetIndexRelations(Oid main_relation_oid,
|
||||
static void
|
||||
GetIndexRelations(Oid main_relation_oid,
|
||||
int *n_indices,
|
||||
Relation **index_rels);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.25 1998/02/10 04:00:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.26 1998/02/26 04:30:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -334,7 +334,8 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
|
|||
|
||||
for (i = 0; i < constr->num_check; i++)
|
||||
{
|
||||
Constraint *cdef = (Constraint *) makeNode(Constraint); /* palloc(sizeof(Constraint)); */
|
||||
Constraint *cdef = (Constraint *) makeNode(Constraint); /* palloc(sizeof(Constrai
|
||||
* nt)); */
|
||||
|
||||
cdef->contype = CONSTR_CHECK;
|
||||
if (check[i].ccname[0] == '$')
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.7 1998/02/25 13:06:09 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.8 1998/02/26 04:30:56 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.23 1998/02/25 13:06:12 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.24 1998/02/26 04:30:57 momjian Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
|
@ -273,7 +273,8 @@ CreateFunction(ProcedureStmt *stmt, CommandDest dest)
|
|||
PointerGetDatum(languageName),
|
||||
0, 0, 0);
|
||||
|
||||
if (!HeapTupleIsValid(languageTuple)) {
|
||||
if (!HeapTupleIsValid(languageTuple))
|
||||
{
|
||||
|
||||
elog(ERROR,
|
||||
"Unrecognized language specified in a CREATE FUNCTION: "
|
||||
|
@ -284,16 +285,18 @@ CreateFunction(ProcedureStmt *stmt, CommandDest dest)
|
|||
|
||||
/* Check that this language is a PL */
|
||||
languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
|
||||
if (!(languageStruct->lanispl)) {
|
||||
if (!(languageStruct->lanispl))
|
||||
{
|
||||
elog(ERROR,
|
||||
"Language '%s' isn't defined as PL", languageName);
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions in untrusted procedural languages are
|
||||
* restricted to be defined by postgres superusers only
|
||||
* Functions in untrusted procedural languages are restricted to
|
||||
* be defined by postgres superusers only
|
||||
*/
|
||||
if (languageStruct->lanpltrusted == false && !superuser()) {
|
||||
if (languageStruct->lanpltrusted == false && !superuser())
|
||||
{
|
||||
elog(ERROR, "Only users with Postgres superuser privilege "
|
||||
"are permitted to create a function in the '%s' "
|
||||
"language.",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.17 1998/02/13 03:21:30 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.18 1998/02/26 04:30:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.19 1998/02/10 04:00:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.20 1998/02/26 04:30:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -601,7 +601,8 @@ ExecCallTriggerFunc(Trigger * trigger)
|
|||
fmgr_info(trigger->tgfoid, &trigger->tgfunc);
|
||||
}
|
||||
|
||||
if (trigger->tgfunc.fn_plhandler != NULL) {
|
||||
if (trigger->tgfunc.fn_plhandler != NULL)
|
||||
{
|
||||
return (HeapTuple) (*(trigger->tgfunc.fn_plhandler))
|
||||
(&trigger->tgfunc);
|
||||
}
|
||||
|
|
|
@ -43,31 +43,36 @@ static void CheckPgUserAclNotNull(void);
|
|||
*---------------------------------------------------------------------
|
||||
*/
|
||||
static
|
||||
void UpdatePgPwdFile(char* sql) {
|
||||
void
|
||||
UpdatePgPwdFile(char *sql)
|
||||
{
|
||||
|
||||
char *filename;
|
||||
char *tempname;
|
||||
|
||||
/* Create a temporary filename to be renamed later. This prevents the
|
||||
* backend from clobbering the pg_pwd file while the postmaster might be
|
||||
* reading from it.
|
||||
/*
|
||||
* Create a temporary filename to be renamed later. This prevents the
|
||||
* backend from clobbering the pg_pwd file while the postmaster might
|
||||
* be reading from it.
|
||||
*/
|
||||
filename = crypt_getpwdfilename();
|
||||
tempname = (char *) malloc(strlen(filename) + 12);
|
||||
sprintf(tempname, "%s.%d", filename, MyProcPid);
|
||||
|
||||
/* Copy the contents of pg_shadow to the pg_pwd ASCII file using a the SEPCHAR
|
||||
* character as the delimiter between fields. Then rename the file to its
|
||||
* final name.
|
||||
/*
|
||||
* Copy the contents of pg_shadow to the pg_pwd ASCII file using a the
|
||||
* SEPCHAR character as the delimiter between fields. Then rename the
|
||||
* file to its final name.
|
||||
*/
|
||||
sprintf(sql, "copy %s to '%s' using delimiters %s", ShadowRelationName, tempname, CRYPT_PWD_FILE_SEPCHAR);
|
||||
pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
|
||||
rename(tempname, filename);
|
||||
free((void *) tempname);
|
||||
|
||||
/* Create a flag file the postmaster will detect the next time it tries to
|
||||
* authenticate a user. The postmaster will know to reload the pg_pwd file
|
||||
* contents.
|
||||
/*
|
||||
* Create a flag file the postmaster will detect the next time it
|
||||
* tries to authenticate a user. The postmaster will know to reload
|
||||
* the pg_pwd file contents.
|
||||
*/
|
||||
filename = crypt_getpwdreloadfilename();
|
||||
creat(filename, S_IRUSR | S_IWUSR);
|
||||
|
@ -80,7 +85,9 @@ void UpdatePgPwdFile(char* sql) {
|
|||
* user is specified in the desired groups of defined in pg_group.
|
||||
*---------------------------------------------------------------------
|
||||
*/
|
||||
void DefineUser(CreateUserStmt *stmt) {
|
||||
void
|
||||
DefineUser(CreateUserStmt *stmt)
|
||||
{
|
||||
|
||||
char *pg_user;
|
||||
Relation pg_shadow_rel;
|
||||
|
@ -101,28 +108,35 @@ void DefineUser(CreateUserStmt *stmt) {
|
|||
if (!(inblock = IsTransactionBlock()))
|
||||
BeginTransactionBlock();
|
||||
|
||||
/* Make sure the user attempting to create a user can insert into the pg_shadow
|
||||
* relation.
|
||||
/*
|
||||
* Make sure the user attempting to create a user can insert into the
|
||||
* pg_shadow relation.
|
||||
*/
|
||||
pg_user = GetPgUserName();
|
||||
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR | ACL_AP) != ACLCHECK_OK) {
|
||||
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR | ACL_AP) != ACLCHECK_OK)
|
||||
{
|
||||
UserAbortTransactionBlock();
|
||||
elog(ERROR, "defineUser: user \"%s\" does not have SELECT and INSERT privilege for \"%s\"",
|
||||
pg_user, ShadowRelationName);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Scan the pg_shadow relation to be certain the user doesn't already exist.
|
||||
/*
|
||||
* Scan the pg_shadow relation to be certain the user doesn't already
|
||||
* exist.
|
||||
*/
|
||||
pg_shadow_rel = heap_openr(ShadowRelationName);
|
||||
pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
|
||||
/* Secure a write lock on pg_shadow so we can be sure of what the next usesysid
|
||||
* should be.
|
||||
|
||||
/*
|
||||
* Secure a write lock on pg_shadow so we can be sure of what the next
|
||||
* usesysid should be.
|
||||
*/
|
||||
RelationSetLockForWrite(pg_shadow_rel);
|
||||
|
||||
scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
|
||||
|
||||
if (!exists && !strncmp((char *) datum, stmt->user, strlen(stmt->user)))
|
||||
|
@ -136,7 +150,8 @@ void DefineUser(CreateUserStmt *stmt) {
|
|||
}
|
||||
heap_endscan(scan);
|
||||
|
||||
if (exists) {
|
||||
if (exists)
|
||||
{
|
||||
RelationUnsetLockForWrite(pg_shadow_rel);
|
||||
heap_close(pg_shadow_rel);
|
||||
UserAbortTransactionBlock();
|
||||
|
@ -144,7 +159,8 @@ void DefineUser(CreateUserStmt *stmt) {
|
|||
return;
|
||||
}
|
||||
|
||||
/* Build the insert statment to be executed.
|
||||
/*
|
||||
* Build the insert statment to be executed.
|
||||
*/
|
||||
sprintf(sql, "insert into %s(usename,usesysid,usecreatedb,usetrace,usesuper,usecatupd,passwd", ShadowRelationName);
|
||||
/* if (stmt->password)
|
||||
|
@ -163,14 +179,18 @@ void DefineUser(CreateUserStmt *stmt) {
|
|||
else
|
||||
strcat(sql_end, ",'f','t'");
|
||||
sql_end += strlen(sql_end);
|
||||
if (stmt->password) {
|
||||
if (stmt->password)
|
||||
{
|
||||
sprintf(sql_end, ",'%s'", stmt->password);
|
||||
sql_end += strlen(sql_end);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(sql_end, ",''");
|
||||
sql_end += strlen(sql_end);
|
||||
}
|
||||
if (stmt->validUntil) {
|
||||
if (stmt->validUntil)
|
||||
{
|
||||
sprintf(sql_end, ",'%s'", stmt->validUntil);
|
||||
sql_end += strlen(sql_end);
|
||||
}
|
||||
|
@ -178,13 +198,15 @@ void DefineUser(CreateUserStmt *stmt) {
|
|||
|
||||
pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
|
||||
|
||||
/* Add the stuff here for groups.
|
||||
/*
|
||||
* Add the stuff here for groups.
|
||||
*/
|
||||
|
||||
UpdatePgPwdFile(sql);
|
||||
|
||||
/* This goes after the UpdatePgPwdFile to be certain that two backends to not
|
||||
* attempt to write to the pg_pwd file at the same time.
|
||||
/*
|
||||
* This goes after the UpdatePgPwdFile to be certain that two backends
|
||||
* to not attempt to write to the pg_pwd file at the same time.
|
||||
*/
|
||||
RelationUnsetLockForWrite(pg_shadow_rel);
|
||||
heap_close(pg_shadow_rel);
|
||||
|
@ -194,7 +216,9 @@ void DefineUser(CreateUserStmt *stmt) {
|
|||
}
|
||||
|
||||
|
||||
extern void AlterUser(AlterUserStmt *stmt) {
|
||||
extern void
|
||||
AlterUser(AlterUserStmt *stmt)
|
||||
{
|
||||
|
||||
char *pg_user;
|
||||
Relation pg_shadow_rel;
|
||||
|
@ -214,31 +238,39 @@ extern void AlterUser(AlterUserStmt *stmt) {
|
|||
if (!(inblock = IsTransactionBlock()))
|
||||
BeginTransactionBlock();
|
||||
|
||||
/* Make sure the user attempting to create a user can insert into the pg_shadow
|
||||
* relation.
|
||||
/*
|
||||
* Make sure the user attempting to create a user can insert into the
|
||||
* pg_shadow relation.
|
||||
*/
|
||||
pg_user = GetPgUserName();
|
||||
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK) {
|
||||
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK)
|
||||
{
|
||||
UserAbortTransactionBlock();
|
||||
elog(ERROR, "alterUser: user \"%s\" does not have SELECT and UPDATE privilege for \"%s\"",
|
||||
pg_user, ShadowRelationName);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Scan the pg_shadow relation to be certain the user exists.
|
||||
/*
|
||||
* Scan the pg_shadow relation to be certain the user exists.
|
||||
*/
|
||||
pg_shadow_rel = heap_openr(ShadowRelationName);
|
||||
pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
|
||||
/* Secure a write lock on pg_shadow so we can be sure that when the dump of
|
||||
* the pg_pwd file is done, there is not another backend doing the same.
|
||||
|
||||
/*
|
||||
* Secure a write lock on pg_shadow so we can be sure that when the
|
||||
* dump of the pg_pwd file is done, there is not another backend doing
|
||||
* the same.
|
||||
*/
|
||||
RelationSetLockForWrite(pg_shadow_rel);
|
||||
|
||||
scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
|
||||
|
||||
if (!strncmp((char*)datum, stmt->user, strlen(stmt->user))) {
|
||||
if (!strncmp((char *) datum, stmt->user, strlen(stmt->user)))
|
||||
{
|
||||
exists = true;
|
||||
ReleaseBuffer(buffer);
|
||||
break;
|
||||
|
@ -246,7 +278,8 @@ extern void AlterUser(AlterUserStmt *stmt) {
|
|||
}
|
||||
heap_endscan(scan);
|
||||
|
||||
if (!exists) {
|
||||
if (!exists)
|
||||
{
|
||||
RelationUnsetLockForWrite(pg_shadow_rel);
|
||||
heap_close(pg_shadow_rel);
|
||||
UserAbortTransactionBlock();
|
||||
|
@ -254,15 +287,18 @@ extern void AlterUser(AlterUserStmt *stmt) {
|
|||
return;
|
||||
}
|
||||
|
||||
/* Create the update statement to modify the user.
|
||||
/*
|
||||
* Create the update statement to modify the user.
|
||||
*/
|
||||
sprintf(sql, "update %s set", ShadowRelationName);
|
||||
sql_end = sql;
|
||||
if (stmt->password) {
|
||||
if (stmt->password)
|
||||
{
|
||||
sql_end += strlen(sql_end);
|
||||
sprintf(sql_end, " passwd = '%s'", stmt->password);
|
||||
}
|
||||
if (stmt->createdb) {
|
||||
if (stmt->createdb)
|
||||
{
|
||||
if (sql_end != sql)
|
||||
strcat(sql_end, ",");
|
||||
sql_end += strlen(sql_end);
|
||||
|
@ -271,7 +307,8 @@ extern void AlterUser(AlterUserStmt *stmt) {
|
|||
else
|
||||
strcat(sql_end, " usecreatedb = 'f'");
|
||||
}
|
||||
if (stmt->createuser) {
|
||||
if (stmt->createuser)
|
||||
{
|
||||
if (sql_end != sql)
|
||||
strcat(sql_end, ",");
|
||||
sql_end += strlen(sql_end);
|
||||
|
@ -280,13 +317,15 @@ extern void AlterUser(AlterUserStmt *stmt) {
|
|||
else
|
||||
strcat(sql_end, " usesuper = 'f'");
|
||||
}
|
||||
if (stmt->validUntil) {
|
||||
if (stmt->validUntil)
|
||||
{
|
||||
if (sql_end != sql)
|
||||
strcat(sql_end, ",");
|
||||
sql_end += strlen(sql_end);
|
||||
sprintf(sql_end, " valuntil = '%s'", stmt->validUntil);
|
||||
}
|
||||
if (sql_end != sql) {
|
||||
if (sql_end != sql)
|
||||
{
|
||||
sql_end += strlen(sql_end);
|
||||
sprintf(sql_end, " where usename = '%s'", stmt->user);
|
||||
pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
|
||||
|
@ -304,7 +343,9 @@ extern void AlterUser(AlterUserStmt *stmt) {
|
|||
}
|
||||
|
||||
|
||||
extern void RemoveUser(char* user) {
|
||||
extern void
|
||||
RemoveUser(char *user)
|
||||
{
|
||||
|
||||
char *pg_user;
|
||||
Relation pg_shadow_rel,
|
||||
|
@ -324,32 +365,41 @@ extern void RemoveUser(char* user) {
|
|||
if (!(inblock = IsTransactionBlock()))
|
||||
BeginTransactionBlock();
|
||||
|
||||
/* Make sure the user attempting to create a user can delete from the pg_shadow
|
||||
* relation.
|
||||
/*
|
||||
* Make sure the user attempting to create a user can delete from the
|
||||
* pg_shadow relation.
|
||||
*/
|
||||
pg_user = GetPgUserName();
|
||||
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK) {
|
||||
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK)
|
||||
{
|
||||
UserAbortTransactionBlock();
|
||||
elog(ERROR, "removeUser: user \"%s\" does not have SELECT and DELETE privilege for \"%s\"",
|
||||
pg_user, ShadowRelationName);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Perform a scan of the pg_shadow relation to find the usesysid of the user to
|
||||
* be deleted. If it is not found, then return a warning message.
|
||||
/*
|
||||
* Perform a scan of the pg_shadow relation to find the usesysid of
|
||||
* the user to be deleted. If it is not found, then return a warning
|
||||
* message.
|
||||
*/
|
||||
pg_shadow_rel = heap_openr(ShadowRelationName);
|
||||
pg_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
|
||||
/* Secure a write lock on pg_shadow so we can be sure that when the dump of
|
||||
* the pg_pwd file is done, there is not another backend doing the same.
|
||||
|
||||
/*
|
||||
* Secure a write lock on pg_shadow so we can be sure that when the
|
||||
* dump of the pg_pwd file is done, there is not another backend doing
|
||||
* the same.
|
||||
*/
|
||||
RelationSetLockForWrite(pg_shadow_rel);
|
||||
|
||||
scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_dsc, &n);
|
||||
|
||||
if (!strncmp((char*)datum, user, strlen(user))) {
|
||||
if (!strncmp((char *) datum, user, strlen(user)))
|
||||
{
|
||||
usesysid = (int) heap_getattr(tuple, Anum_pg_shadow_usesysid, pg_dsc, &n);
|
||||
ReleaseBuffer(buffer);
|
||||
break;
|
||||
|
@ -358,7 +408,8 @@ extern void RemoveUser(char* user) {
|
|||
}
|
||||
heap_endscan(scan);
|
||||
|
||||
if (usesysid == -1) {
|
||||
if (usesysid == -1)
|
||||
{
|
||||
RelationUnsetLockForWrite(pg_shadow_rel);
|
||||
heap_close(pg_shadow_rel);
|
||||
UserAbortTransactionBlock();
|
||||
|
@ -366,19 +417,23 @@ extern void RemoveUser(char* user) {
|
|||
return;
|
||||
}
|
||||
|
||||
/* Perform a scan of the pg_database relation to find the databases owned by
|
||||
* usesysid. Then drop them.
|
||||
/*
|
||||
* Perform a scan of the pg_database relation to find the databases
|
||||
* owned by usesysid. Then drop them.
|
||||
*/
|
||||
pg_rel = heap_openr(DatabaseRelationName);
|
||||
pg_dsc = RelationGetTupleDescriptor(pg_rel);
|
||||
|
||||
scan = heap_beginscan(pg_rel, false, false, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_database_datdba, pg_dsc, &n);
|
||||
|
||||
if ((int)datum == usesysid) {
|
||||
if ((int) datum == usesysid)
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_database_datname, pg_dsc, &n);
|
||||
if (memcmp((void*)datum, "template1", 9)) {
|
||||
if (memcmp((void *) datum, "template1", 9))
|
||||
{
|
||||
dbase = (char **) realloc((void *) dbase, sizeof(char *) * (ndbase + 1));
|
||||
dbase[ndbase] = (char *) malloc(NAMEDATALEN + 1);
|
||||
memcpy((void *) dbase[ndbase], (void *) datum, NAMEDATALEN);
|
||||
|
@ -390,7 +445,8 @@ extern void RemoveUser(char* user) {
|
|||
heap_endscan(scan);
|
||||
heap_close(pg_rel);
|
||||
|
||||
while (ndbase--) {
|
||||
while (ndbase--)
|
||||
{
|
||||
elog(NOTICE, "Dropping database %s", dbase[ndbase]);
|
||||
sprintf(sql, "drop database %s", dbase[ndbase]);
|
||||
free((void *) dbase[ndbase]);
|
||||
|
@ -399,22 +455,26 @@ extern void RemoveUser(char* user) {
|
|||
if (dbase)
|
||||
free((void *) dbase);
|
||||
|
||||
/* Since pg_shadow is global over all databases, one of two things must be done
|
||||
* to insure complete consistency. First, pg_shadow could be made non-global.
|
||||
* This would elminate the code above for deleting database and would require
|
||||
* the addition of code to delete tables, views, etc owned by the user.
|
||||
/*
|
||||
* Since pg_shadow is global over all databases, one of two things
|
||||
* must be done to insure complete consistency. First, pg_shadow
|
||||
* could be made non-global. This would elminate the code above for
|
||||
* deleting database and would require the addition of code to delete
|
||||
* tables, views, etc owned by the user.
|
||||
*
|
||||
* The second option would be to create a means of deleting tables, view,
|
||||
* etc. owned by the user from other databases. Pg_user is global and so
|
||||
* this must be done at some point.
|
||||
* etc. owned by the user from other databases. Pg_user is global and
|
||||
* so this must be done at some point.
|
||||
*
|
||||
* Let us not forget that the user should be removed from the pg_groups also.
|
||||
* Let us not forget that the user should be removed from the pg_groups
|
||||
* also.
|
||||
*
|
||||
* Todd A. Brandys 11/18/1997
|
||||
*
|
||||
*/
|
||||
|
||||
/* Remove the user from the pg_shadow table
|
||||
/*
|
||||
* Remove the user from the pg_shadow table
|
||||
*/
|
||||
sprintf(sql, "delete from %s where usename = '%s'", ShadowRelationName, user);
|
||||
pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
|
||||
|
@ -433,7 +493,8 @@ extern void RemoveUser(char* user) {
|
|||
*
|
||||
* check to see if there is an ACL on pg_shadow
|
||||
*/
|
||||
static void CheckPgUserAclNotNull()
|
||||
static void
|
||||
CheckPgUserAclNotNull()
|
||||
{
|
||||
HeapTuple htp;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.62 1998/02/25 23:40:32 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.63 1998/02/26 04:31:03 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -725,6 +725,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
|
|||
}
|
||||
else if (!TransactionIdIsInProgress(htup->t_xmin))
|
||||
{
|
||||
|
||||
/*
|
||||
* Not Aborted, Not Committed, Not in Progress -
|
||||
* so it's from crashed process. - vadim 11/26/96
|
||||
|
@ -742,8 +743,8 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
|
|||
}
|
||||
|
||||
/*
|
||||
* here we are concerned about tuples with xmin committed
|
||||
* and xmax unknown or committed
|
||||
* here we are concerned about tuples with xmin committed and
|
||||
* xmax unknown or committed
|
||||
*/
|
||||
if (htup->t_infomask & HEAP_XMIN_COMMITTED &&
|
||||
!(htup->t_infomask & HEAP_XMAX_INVALID))
|
||||
|
@ -759,6 +760,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
|
|||
tupgone = true;
|
||||
else if (!TransactionIdIsInProgress(htup->t_xmax))
|
||||
{
|
||||
|
||||
/*
|
||||
* Not Aborted, Not Committed, Not in Progress - so it
|
||||
* from crashed process. - vadim 06/02/97
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Routines for handling of 'SET var TO',
|
||||
* 'SHOW var' and 'RESET var' statements.
|
||||
*
|
||||
* $Id: variable.c,v 1.3 1998/02/03 16:06:49 thomas Exp $
|
||||
* $Id: variable.c,v 1.4 1998/02/26 04:31:05 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -342,18 +342,21 @@ parse_date(const char *value)
|
|||
DateStyle = USE_GERMAN_DATES;
|
||||
dcnt++;
|
||||
EuroDates = TRUE;
|
||||
if ((ecnt > 0) && (! EuroDates)) ecnt++;
|
||||
if ((ecnt > 0) && (!EuroDates))
|
||||
ecnt++;
|
||||
}
|
||||
else if (!strncasecmp(tok, "EURO", 4))
|
||||
{
|
||||
EuroDates = TRUE;
|
||||
if ((dcnt <= 0) || (DateStyle != USE_GERMAN_DATES)) ecnt++;
|
||||
if ((dcnt <= 0) || (DateStyle != USE_GERMAN_DATES))
|
||||
ecnt++;
|
||||
}
|
||||
else if ((!strcasecmp(tok, "US"))
|
||||
|| (!strncasecmp(tok, "NONEURO", 7)))
|
||||
{
|
||||
EuroDates = FALSE;
|
||||
if ((dcnt <= 0) || (DateStyle == USE_GERMAN_DATES)) ecnt++;
|
||||
if ((dcnt <= 0) || (DateStyle == USE_GERMAN_DATES))
|
||||
ecnt++;
|
||||
}
|
||||
else if (!strcasecmp(tok, "DEFAULT"))
|
||||
{
|
||||
|
@ -501,7 +504,10 @@ reset_timezone()
|
|||
tzset();
|
||||
}
|
||||
|
||||
/* otherwise, time zone was set but no original explicit time zone available */
|
||||
/*
|
||||
* otherwise, time zone was set but no original explicit time zone
|
||||
* available
|
||||
*/
|
||||
else
|
||||
{
|
||||
strcpy(tzbuf, "=");
|
||||
|
@ -523,13 +529,27 @@ struct VariableParsers
|
|||
} VariableParsers[] =
|
||||
|
||||
{
|
||||
{ "datestyle", parse_date, show_date, reset_date },
|
||||
{ "timezone", parse_timezone, show_timezone, reset_timezone },
|
||||
{ "cost_heap", parse_cost_heap, show_cost_heap, reset_cost_heap },
|
||||
{ "cost_index", parse_cost_index, show_cost_index, reset_cost_index },
|
||||
{ "geqo", parse_geqo, show_geqo, reset_geqo },
|
||||
{ "r_plans", parse_r_plans, show_r_plans, reset_r_plans },
|
||||
{ NULL, NULL, NULL, NULL }
|
||||
{
|
||||
"datestyle", parse_date, show_date, reset_date
|
||||
},
|
||||
{
|
||||
"timezone", parse_timezone, show_timezone, reset_timezone
|
||||
},
|
||||
{
|
||||
"cost_heap", parse_cost_heap, show_cost_heap, reset_cost_heap
|
||||
},
|
||||
{
|
||||
"cost_index", parse_cost_index, show_cost_index, reset_cost_index
|
||||
},
|
||||
{
|
||||
"geqo", parse_geqo, show_geqo, reset_geqo
|
||||
},
|
||||
{
|
||||
"r_plans", parse_r_plans, show_r_plans, reset_r_plans
|
||||
},
|
||||
{
|
||||
NULL, NULL, NULL, NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.20 1998/02/10 04:00:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.21 1998/02/26 04:31:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.18 1998/02/23 06:26:53 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.19 1998/02/26 04:31:08 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -303,7 +303,9 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
|
|||
foreach(lst, node->initPlan)
|
||||
{
|
||||
Plan *splan = ((SubPlan *) lfirst(lst))->plan;
|
||||
if ( splan->extParam != NULL ) /* don't care about child locParam */
|
||||
|
||||
if (splan->extParam != NULL) /* don't care about child
|
||||
* locParam */
|
||||
SetChangedParamList(splan, node->chgParam);
|
||||
if (splan->chgParam != NULL)
|
||||
ExecReScanSetParamPlan((SubPlan *) lfirst(lst), node);
|
||||
|
@ -311,6 +313,7 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
|
|||
foreach(lst, node->subPlan)
|
||||
{
|
||||
Plan *splan = ((SubPlan *) lfirst(lst))->plan;
|
||||
|
||||
if (splan->extParam != NULL)
|
||||
SetChangedParamList(splan, node->chgParam);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.43 1998/02/21 06:31:37 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.44 1998/02/26 04:31:09 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -57,22 +57,28 @@
|
|||
|
||||
|
||||
/* decls for local routines only used within this module */
|
||||
static void ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
|
||||
static void
|
||||
ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
|
||||
Query *parseTree);
|
||||
static TupleDesc InitPlan(CmdType operation, Query *parseTree,
|
||||
static TupleDesc
|
||||
InitPlan(CmdType operation, Query *parseTree,
|
||||
Plan *plan, EState *estate);
|
||||
static void EndPlan(Plan *plan, EState *estate);
|
||||
static TupleTableSlot * ExecutePlan(EState *estate, Plan *plan,
|
||||
static TupleTableSlot *
|
||||
ExecutePlan(EState *estate, Plan *plan,
|
||||
Query *parseTree, CmdType operation,
|
||||
int numberTuples, ScanDirection direction,
|
||||
void (*printfunc) ());
|
||||
static void ExecRetrieve(TupleTableSlot *slot, void (*printfunc) (),
|
||||
EState *estate);
|
||||
static void ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
static void
|
||||
ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
EState *estate);
|
||||
static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
static void
|
||||
ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
EState *estate);
|
||||
static void ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
static void
|
||||
ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
EState *estate, Query *parseTree);
|
||||
|
||||
/* end of local decls */
|
||||
|
@ -90,6 +96,7 @@ ExecutorLimit(int limit)
|
|||
{
|
||||
return queryLimit = limit;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -301,11 +308,12 @@ ExecCheckPerms(CmdType operation,
|
|||
|
||||
if (rte->skipAcl)
|
||||
{
|
||||
|
||||
/*
|
||||
* This happens if the access to this table is due
|
||||
* to a view query rewriting - the rewrite handler
|
||||
* checked the permissions against the view owner,
|
||||
* so we just skip this entry.
|
||||
* This happens if the access to this table is due to a view
|
||||
* query rewriting - the rewrite handler checked the
|
||||
* permissions against the view owner, so we just skip this
|
||||
* entry.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
@ -1283,6 +1291,7 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
|
|||
return (newtuple);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static char *
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.8 1998/02/13 03:26:40 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.9 1998/02/26 04:31:11 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.25 1998/02/13 03:26:42 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.26 1998/02/26 04:31:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -71,19 +71,24 @@ int execConstLen;
|
|||
|
||||
/* static functions decls */
|
||||
static Datum ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
|
||||
static Datum
|
||||
ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
|
||||
bool *isNull, bool *isDone);
|
||||
static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
|
||||
static Datum
|
||||
ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
|
||||
bool *isNull, bool *isDone);
|
||||
static void ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
|
||||
static void
|
||||
ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
|
||||
List *argList, Datum argV[], bool *argIsDone);
|
||||
static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
|
||||
static Datum
|
||||
ExecEvalOper(Expr *opClause, ExprContext *econtext,
|
||||
bool *isNull);
|
||||
static Datum ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecMakeFunctionResult(Node *node, List *arguments,
|
||||
static Datum
|
||||
ExecMakeFunctionResult(Node *node, List *arguments,
|
||||
ExprContext *econtext, bool *isNull, bool *isDone);
|
||||
static bool ExecQualClause(Node *clause, ExprContext *econtext);
|
||||
|
||||
|
@ -302,7 +307,8 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
|
|||
}
|
||||
|
||||
result = heap_getattr(heapTuple, /* tuple containing attribute */
|
||||
attnum, /* attribute number of desired attribute */
|
||||
attnum, /* attribute number of desired
|
||||
* attribute */
|
||||
tuple_type, /* tuple descriptor of tuple */
|
||||
isNull); /* return: is attribute null? */
|
||||
|
||||
|
@ -1045,17 +1051,19 @@ ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull)
|
|||
if (*isNull)
|
||||
{
|
||||
IsNull = *isNull;
|
||||
|
||||
/*
|
||||
* Many functions don't (or can't!) check is an argument
|
||||
* NULL or NOT_NULL and may return TRUE (1) with *isNull TRUE
|
||||
* (an_int4_column <> 1: int4ne returns TRUE for NULLs).
|
||||
* Not having time to fix function manager I want to fix
|
||||
* OR: if we had 'x <> 1 OR x isnull' then TRUE, TRUE were
|
||||
* returned by 'x <> 1' for NULL ... but ExecQualClause say
|
||||
* that qualification *fails* if isnull is TRUE for all values
|
||||
* returned by ExecEvalExpr. So, force this rule here: if isnull
|
||||
* is TRUE then clause failed. Note: nullvalue() & nonnullvalue()
|
||||
* always set isnull to FALSE for NULLs. - vadim 09/22/97
|
||||
* Many functions don't (or can't!) check is an argument NULL
|
||||
* or NOT_NULL and may return TRUE (1) with *isNull TRUE
|
||||
* (an_int4_column <> 1: int4ne returns TRUE for NULLs). Not
|
||||
* having time to fix function manager I want to fix OR: if we
|
||||
* had 'x <> 1 OR x isnull' then TRUE, TRUE were returned by
|
||||
* 'x <> 1' for NULL ... but ExecQualClause say that
|
||||
* qualification *fails* if isnull is TRUE for all values
|
||||
* returned by ExecEvalExpr. So, force this rule here: if
|
||||
* isnull is TRUE then clause failed. Note: nullvalue() &
|
||||
* nonnullvalue() always set isnull to FALSE for NULLs. -
|
||||
* vadim 09/22/97
|
||||
*/
|
||||
const_value = 0;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.16 1998/02/10 04:00:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.17 1998/02/26 04:31:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.29 1998/02/13 03:26:43 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.30 1998/02/26 04:31:15 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -545,8 +545,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
|||
ExecInitNode(outerPlan, estate, (Plan *) node);
|
||||
|
||||
/*
|
||||
* Result runs in its own context, but make it use our aggregates
|
||||
* fix for 'select sum(2+2)'
|
||||
* Result runs in its own context, but make it use our aggregates fix
|
||||
* for 'select sum(2+2)'
|
||||
*/
|
||||
if (nodeTag(outerPlan) == T_Result)
|
||||
{
|
||||
|
@ -686,9 +686,10 @@ ExecReScanAgg(Agg *node, ExprContext *exprCtxt, Plan *parent)
|
|||
aggstate->agg_done = FALSE;
|
||||
MemSet(econtext->ecxt_values, 0, sizeof(Datum) * length(node->aggs));
|
||||
MemSet(econtext->ecxt_nulls, 0, length(node->aggs));
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan
|
||||
* will be re-scanned by first ExecProcNode.
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
*/
|
||||
if (((Plan *) node)->lefttree->chgParam == NULL)
|
||||
ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.10 1997/12/27 06:40:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.11 1998/02/26 04:31:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* columns. (ie. tuples from the same group are consecutive)
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.17 1998/02/18 12:40:43 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.18 1998/02/26 04:31:24 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -119,9 +119,10 @@ ExecGroupEveryTuple(Group *node)
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* Compare with first tuple and see if this tuple is of
|
||||
* the same group.
|
||||
* Compare with first tuple and see if this tuple is of the
|
||||
* same group.
|
||||
*/
|
||||
if (!sameGroup(firsttuple, outerslot->val,
|
||||
node->numCols, node->grpColIdx,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.19 1998/02/13 03:26:46 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.20 1998/02/26 04:31:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -903,8 +903,8 @@ ExecReScanHash(Hash *node, ExprContext *exprCtxt, Plan *parent)
|
|||
}
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan
|
||||
* will be re-scanned by first ExecProcNode.
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
*/
|
||||
if (((Plan *) node)->lefttree->chgParam == NULL)
|
||||
ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.10 1998/02/13 03:26:47 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.11 1998/02/26 04:31:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -212,12 +212,14 @@ ExecHashJoin(HashJoin *node)
|
|||
|
||||
while (curbatch <= nbatch && TupIsNull(outerTupleSlot))
|
||||
{
|
||||
|
||||
/*
|
||||
* if the current batch runs out, switch to new batch
|
||||
*/
|
||||
curbatch = ExecHashJoinNewBatch(hjstate);
|
||||
if (curbatch > nbatch)
|
||||
{
|
||||
|
||||
/*
|
||||
* when the last batch runs out, clean up
|
||||
*/
|
||||
|
@ -350,6 +352,7 @@ ExecHashJoin(HashJoin *node)
|
|||
curbatch = ExecHashJoinNewBatch(hjstate);
|
||||
if (curbatch > nbatch)
|
||||
{
|
||||
|
||||
/*
|
||||
* when the last batch runs out, clean up
|
||||
*/
|
||||
|
@ -853,8 +856,8 @@ ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent)
|
|||
node->hashdone = false;
|
||||
|
||||
/*
|
||||
* Unfortunately, currently we have to destroy hashtable
|
||||
* in all cases...
|
||||
* Unfortunately, currently we have to destroy hashtable in all
|
||||
* cases...
|
||||
*/
|
||||
if (hjstate->hj_HashTable)
|
||||
{
|
||||
|
@ -874,8 +877,8 @@ ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent)
|
|||
hjstate->jstate.cs_TupFromTlist = (bool) false;
|
||||
|
||||
/*
|
||||
* if chgParam of subnodes is not null then plans
|
||||
* will be re-scanned by first ExecProcNode.
|
||||
* if chgParam of subnodes is not null then plans will be re-scanned
|
||||
* by first ExecProcNode.
|
||||
*/
|
||||
if (((Plan *) node)->lefttree->chgParam == NULL)
|
||||
ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.14 1998/02/13 03:26:49 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.15 1998/02/26 04:31:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -991,8 +991,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
|||
indexstate->cstate.cs_TupFromTlist = false;
|
||||
|
||||
/*
|
||||
* if there are some PARAM_EXEC in skankeys then
|
||||
* force index rescan on first scan.
|
||||
* if there are some PARAM_EXEC in skankeys then force index rescan on
|
||||
* first scan.
|
||||
*/
|
||||
((Plan *) node)->chgParam = execParam;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.12 1998/02/13 03:26:50 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.13 1998/02/26 04:31:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.12 1997/09/08 21:43:15 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.13 1998/02/26 04:31:30 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -749,7 +749,8 @@ ExecMergeJoin(MergeJoin *node)
|
|||
*
|
||||
* new outer tuple > marked tuple
|
||||
*
|
||||
*****************************
|
||||
****************************
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -831,7 +832,8 @@ ExecMergeJoin(MergeJoin *node)
|
|||
* we have to advance the outer scan until we find the outer
|
||||
* 8.
|
||||
*
|
||||
*****************************
|
||||
****************************
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -935,7 +937,8 @@ ExecMergeJoin(MergeJoin *node)
|
|||
* we have to advance the inner scan until we find the inner
|
||||
* 12.
|
||||
*
|
||||
*****************************
|
||||
****************************
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.8 1998/02/13 03:26:51 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.9 1998/02/26 04:31:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -384,11 +384,11 @@ ExecReScanNestLoop(NestLoop *node, ExprContext *exprCtxt, Plan *parent)
|
|||
Plan *outerPlan = outerPlan((Plan *) node);
|
||||
|
||||
/*
|
||||
* If outerPlan->chgParam is not null then plan will be
|
||||
* automatically re-scanned by first ExecProcNode.
|
||||
* innerPlan is re-scanned for each new outer tuple and MUST NOT
|
||||
* be re-scanned from here or you'll get troubles from inner
|
||||
* index scans when outer Vars are used as run-time keys...
|
||||
* If outerPlan->chgParam is not null then plan will be automatically
|
||||
* re-scanned by first ExecProcNode. innerPlan is re-scanned for each
|
||||
* new outer tuple and MUST NOT be re-scanned from here or you'll get
|
||||
* troubles from inner index scans when outer Vars are used as
|
||||
* run-time keys...
|
||||
*/
|
||||
if (outerPlan->chgParam == NULL)
|
||||
ExecReScan(outerPlan, exprCtxt, (Plan *) node);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* SeqScan (emp.all)
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.7 1998/02/18 07:19:34 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.8 1998/02/26 04:31:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -288,8 +288,8 @@ ExecReScanResult(Result *node, ExprContext *exprCtxt, Plan *parent)
|
|||
resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan
|
||||
* will be re-scanned by first ExecProcNode.
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
*/
|
||||
if (((Plan *) node)->lefttree &&
|
||||
((Plan *) node)->lefttree->chgParam == NULL)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.13 1998/02/23 06:26:56 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.14 1998/02/26 04:31:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -395,9 +395,9 @@ ExecReScanSort(Sort *node, ExprContext *exprCtxt, Plan *parent)
|
|||
SortState *sortstate = node->sortstate;
|
||||
|
||||
/*
|
||||
* If we haven't sorted yet, just return. If outerplan'
|
||||
* chgParam is not NULL then it will be re-scanned by
|
||||
* ExecProcNode, else - no reason to re-scan it at all.
|
||||
* If we haven't sorted yet, just return. If outerplan' chgParam is
|
||||
* not NULL then it will be re-scanned by ExecProcNode, else - no
|
||||
* reason to re-scan it at all.
|
||||
*/
|
||||
if (sortstate->sort_Flag == false)
|
||||
return;
|
||||
|
|
|
@ -125,8 +125,8 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
|
|||
node->shutdown = true;
|
||||
|
||||
/*
|
||||
* If this plan is un-correlated or undirect correlated one and
|
||||
* want to set params for parent plan then prepare parameters.
|
||||
* If this plan is un-correlated or undirect correlated one and want
|
||||
* to set params for parent plan then prepare parameters.
|
||||
*/
|
||||
if (node->setParam != NULL)
|
||||
{
|
||||
|
@ -138,10 +138,11 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
|
|||
|
||||
prm->execPlan = node;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that in the case of un-correlated subqueries we don't care
|
||||
* about setting parent->chgParam here: indices take care about it,
|
||||
* for others - it doesn't matter...
|
||||
* about setting parent->chgParam here: indices take care about
|
||||
* it, for others - it doesn't matter...
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -276,8 +277,7 @@ ExecReScanSetParamPlan (SubPlan *node, Plan *parent)
|
|||
|
||||
/*
|
||||
* Don't actual re-scan: ExecSetParamPlan does re-scan if
|
||||
* node->plan->chgParam is not NULL...
|
||||
ExecReScan (plan, NULL, plan);
|
||||
* node->plan->chgParam is not NULL... ExecReScan (plan, NULL, plan);
|
||||
*/
|
||||
|
||||
foreach(lst, node->setParam)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* ExecEndTee
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.15 1998/01/07 21:02:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.16 1998/02/26 04:31:33 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.16 1998/02/23 06:26:58 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.17 1998/02/26 04:31:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -363,9 +363,10 @@ ExecReScanUnique(Unique *node, ExprContext *exprCtxt, Plan *parent)
|
|||
UniqueState *uniquestate = node->uniquestate;
|
||||
|
||||
ExecClearTuple(uniquestate->cs_ResultTupleSlot);
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan
|
||||
* will be re-scanned by first ExecProcNode.
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
*/
|
||||
if (((Plan *) node)->lefttree->chgParam == NULL)
|
||||
ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
|
||||
|
|
|
@ -1001,7 +1001,8 @@ _SPI_checktuples()
|
|||
if (tuptable != NULL)
|
||||
failed = true;
|
||||
}
|
||||
else /* some tuples were processed */
|
||||
else
|
||||
/* some tuples were processed */
|
||||
{
|
||||
if (tuptable == NULL) /* spi_printtup was not called */
|
||||
failed = true;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.8 1997/09/08 21:43:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.9 1998/02/26 04:31:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.7 1997/09/08 21:43:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.8 1998/02/26 04:31:39 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/qsort.c,v 1.5 1998/02/11 19:10:35 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/qsort.c,v 1.6 1998/02/26 04:31:40 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.26 1998/02/25 13:06:49 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.27 1998/02/26 04:31:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -327,11 +327,15 @@ pg_krb5_recvauth(Port *port)
|
|||
* Handle a v0 password packet.
|
||||
*/
|
||||
|
||||
static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
|
||||
static void
|
||||
pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
|
||||
{
|
||||
Port *port;
|
||||
PasswordPacketV0 *pp;
|
||||
char *user, *password, *cp, *start;
|
||||
char *user,
|
||||
*password,
|
||||
*cp,
|
||||
*start;
|
||||
|
||||
port = (Port *) arg;
|
||||
pp = (PasswordPacketV0 *) pkt;
|
||||
|
@ -396,7 +400,8 @@ static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
|
|||
* Tell the user the authentication failed, but not why.
|
||||
*/
|
||||
|
||||
void auth_failed(Port *port)
|
||||
void
|
||||
auth_failed(Port *port)
|
||||
{
|
||||
PacketSendError(&port->pktInfo, "User authentication failed");
|
||||
}
|
||||
|
@ -405,8 +410,10 @@ void auth_failed(Port *port)
|
|||
/*
|
||||
* be_recvauth -- server demux routine for incoming authentication information
|
||||
*/
|
||||
void be_recvauth(Port *port)
|
||||
void
|
||||
be_recvauth(Port *port)
|
||||
{
|
||||
|
||||
/*
|
||||
* Get the authentication method to use for this frontend/database
|
||||
* combination.
|
||||
|
@ -491,9 +498,11 @@ void be_recvauth(Port *port)
|
|||
* Send an authentication request packet to the frontend.
|
||||
*/
|
||||
|
||||
static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler)())
|
||||
static void
|
||||
sendAuthRequest(Port *port, AuthRequest areq, void (*handler) ())
|
||||
{
|
||||
char *dp, *sp;
|
||||
char *dp,
|
||||
*sp;
|
||||
int i;
|
||||
uint32 net_areq;
|
||||
|
||||
|
@ -526,8 +535,10 @@ static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler)())
|
|||
* Called when we have told the front end that it is authorised.
|
||||
*/
|
||||
|
||||
static void handle_done_auth(Port *port)
|
||||
static void
|
||||
handle_done_auth(Port *port)
|
||||
{
|
||||
|
||||
/*
|
||||
* Don't generate any more traffic. This will cause the backend to
|
||||
* start.
|
||||
|
@ -542,7 +553,8 @@ static void handle_done_auth(Port *port)
|
|||
* authentication.
|
||||
*/
|
||||
|
||||
static void handle_krb4_auth(Port *port)
|
||||
static void
|
||||
handle_krb4_auth(Port *port)
|
||||
{
|
||||
if (pg_krb4_recvauth(port) != STATUS_OK)
|
||||
auth_failed(port);
|
||||
|
@ -556,7 +568,8 @@ static void handle_krb4_auth(Port *port)
|
|||
* authentication.
|
||||
*/
|
||||
|
||||
static void handle_krb5_auth(Port *port)
|
||||
static void
|
||||
handle_krb5_auth(Port *port)
|
||||
{
|
||||
if (pg_krb5_recvauth(port) != STATUS_OK)
|
||||
auth_failed(port);
|
||||
|
@ -570,7 +583,8 @@ static void handle_krb5_auth(Port *port)
|
|||
* authentication.
|
||||
*/
|
||||
|
||||
static void handle_password_auth(Port *port)
|
||||
static void
|
||||
handle_password_auth(Port *port)
|
||||
{
|
||||
/* Set up the read of the password packet. */
|
||||
|
||||
|
@ -582,7 +596,8 @@ static void handle_password_auth(Port *port)
|
|||
* Called when we have received the password packet.
|
||||
*/
|
||||
|
||||
static void readPasswordPacket(char *arg, PacketLen len, char *pkt)
|
||||
static void
|
||||
readPasswordPacket(char *arg, PacketLen len, char *pkt)
|
||||
{
|
||||
char password[sizeof(PasswordPacket) + 1];
|
||||
Port *port;
|
||||
|
@ -609,7 +624,8 @@ static void readPasswordPacket(char *arg, PacketLen len, char *pkt)
|
|||
* not.
|
||||
*/
|
||||
|
||||
static int checkPassword(Port *port, char *user, char *password)
|
||||
static int
|
||||
checkPassword(Port *port, char *user, char *password)
|
||||
{
|
||||
if (port->auth_method == uaPassword && port->auth_arg[0] != '\0')
|
||||
return verify_password(port->auth_arg, user, password);
|
||||
|
@ -622,7 +638,8 @@ static int checkPassword(Port *port, char *user, char *password)
|
|||
* Server demux routine for incoming authentication information for protocol
|
||||
* version 0.
|
||||
*/
|
||||
static int old_be_recvauth(Port *port)
|
||||
static int
|
||||
old_be_recvauth(Port *port)
|
||||
{
|
||||
int status;
|
||||
MsgType msgtype = (MsgType) port->proto;
|
||||
|
@ -665,7 +682,8 @@ static int old_be_recvauth(Port *port)
|
|||
* depending on what authentication we really want to use.
|
||||
*/
|
||||
|
||||
static int map_old_to_new(Port *port, UserAuth old, int status)
|
||||
static int
|
||||
map_old_to_new(Port *port, UserAuth old, int status)
|
||||
{
|
||||
switch (port->auth_method)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.13 1998/02/10 16:03:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.14 1998/02/26 04:31:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.14 1998/01/26 01:41:06 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.15 1998/02/26 04:31:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -33,11 +33,14 @@ int pwd_cache_count = 0;
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
char* crypt_getpwdfilename() {
|
||||
char *
|
||||
crypt_getpwdfilename()
|
||||
{
|
||||
|
||||
static char *pfnam = NULL;
|
||||
|
||||
if (!pfnam) {
|
||||
if (!pfnam)
|
||||
{
|
||||
pfnam = (char *) malloc(strlen(DataDir) + strlen(CRYPT_PWD_FILE) + 2);
|
||||
sprintf(pfnam, "%s/%s", DataDir, CRYPT_PWD_FILE);
|
||||
}
|
||||
|
@ -47,11 +50,14 @@ char* crypt_getpwdfilename() {
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
char* crypt_getpwdreloadfilename() {
|
||||
char *
|
||||
crypt_getpwdreloadfilename()
|
||||
{
|
||||
|
||||
static char *rpfnam = NULL;
|
||||
|
||||
if (!rpfnam) {
|
||||
if (!rpfnam)
|
||||
{
|
||||
char *pwdfilename;
|
||||
|
||||
pwdfilename = crypt_getpwdfilename();
|
||||
|
@ -65,7 +71,9 @@ char* crypt_getpwdreloadfilename() {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static
|
||||
FILE* crypt_openpwdfile() {
|
||||
FILE *
|
||||
crypt_openpwdfile()
|
||||
{
|
||||
char *filename;
|
||||
FILE *pwdfile;
|
||||
|
||||
|
@ -78,7 +86,9 @@ FILE* crypt_openpwdfile() {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static
|
||||
int compar_user(const void* user_a, const void* user_b) {
|
||||
int
|
||||
compar_user(const void *user_a, const void *user_b)
|
||||
{
|
||||
|
||||
int min,
|
||||
value;
|
||||
|
@ -88,18 +98,22 @@ int compar_user(const void* user_a, const void* user_b) {
|
|||
login_a = *((char **) user_a);
|
||||
login_b = *((char **) user_b);
|
||||
|
||||
/* We only really want to compare the user logins which are first. We look
|
||||
* for the first SEPSTR char getting the number of chars there are before it.
|
||||
* We only need to compare to the min count from the two strings.
|
||||
/*
|
||||
* We only really want to compare the user logins which are first. We
|
||||
* look for the first SEPSTR char getting the number of chars there
|
||||
* are before it. We only need to compare to the min count from the
|
||||
* two strings.
|
||||
*/
|
||||
min = strcspn(login_a, CRYPT_PWD_FILE_SEPSTR);
|
||||
value = strcspn(login_b, CRYPT_PWD_FILE_SEPSTR);
|
||||
if (value < min)
|
||||
min = value;
|
||||
|
||||
/* We add one to min so that the separator character is included in the
|
||||
* comparison. Why? I believe this will prevent logins that are proper
|
||||
* prefixes of other logins from being 'masked out'. Being conservative!
|
||||
/*
|
||||
* We add one to min so that the separator character is included in
|
||||
* the comparison. Why? I believe this will prevent logins that are
|
||||
* proper prefixes of other logins from being 'masked out'. Being
|
||||
* conservative!
|
||||
*/
|
||||
return strncmp(login_a, login_b, min + 1);
|
||||
}
|
||||
|
@ -107,7 +121,9 @@ int compar_user(const void* user_a, const void* user_b) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static
|
||||
void crypt_loadpwdfile() {
|
||||
void
|
||||
crypt_loadpwdfile()
|
||||
{
|
||||
|
||||
char *filename;
|
||||
int result;
|
||||
|
@ -117,14 +133,19 @@ void crypt_loadpwdfile() {
|
|||
filename = crypt_getpwdreloadfilename();
|
||||
result = unlink(filename);
|
||||
|
||||
/* We want to delete the flag file before reading the contents of the pg_pwd
|
||||
* file. If result == 0 then the unlink of the reload file was successful.
|
||||
* This means that a backend performed a COPY of the pg_shadow file to
|
||||
* pg_pwd. Therefore we must now do a reload.
|
||||
/*
|
||||
* We want to delete the flag file before reading the contents of the
|
||||
* pg_pwd file. If result == 0 then the unlink of the reload file was
|
||||
* successful. This means that a backend performed a COPY of the
|
||||
* pg_shadow file to pg_pwd. Therefore we must now do a reload.
|
||||
*/
|
||||
if (!pwd_cache || !result) {
|
||||
if (pwd_cache) { /* free the old data only if this is a reload */
|
||||
while (pwd_cache_count--) {
|
||||
if (!pwd_cache || !result)
|
||||
{
|
||||
if (pwd_cache)
|
||||
{ /* free the old data only if this is a
|
||||
* reload */
|
||||
while (pwd_cache_count--)
|
||||
{
|
||||
free((void *) pwd_cache[pwd_cache_count]);
|
||||
}
|
||||
free((void *) pwd_cache);
|
||||
|
@ -135,11 +156,15 @@ void crypt_loadpwdfile() {
|
|||
if (!(pwd_file = crypt_openpwdfile()))
|
||||
return;
|
||||
|
||||
/* Here is where we load the data from pg_pwd.
|
||||
/*
|
||||
* Here is where we load the data from pg_pwd.
|
||||
*/
|
||||
while (fgets(buffer, 256, pwd_file) != NULL) {
|
||||
/* We must remove the return char at the end of the string, as this will
|
||||
* affect the correct parsing of the password entry.
|
||||
while (fgets(buffer, 256, pwd_file) != NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* We must remove the return char at the end of the string, as
|
||||
* this will affect the correct parsing of the password entry.
|
||||
*/
|
||||
if (buffer[(result = strlen(buffer) - 1)] == '\n')
|
||||
buffer[result] = '\0';
|
||||
|
@ -149,7 +174,8 @@ void crypt_loadpwdfile() {
|
|||
}
|
||||
fclose(pwd_file);
|
||||
|
||||
/* Now sort the entries in the cache for faster searching later.
|
||||
/*
|
||||
* Now sort the entries in the cache for faster searching later.
|
||||
*/
|
||||
qsort((void *) pwd_cache, pwd_cache_count, sizeof(char *), compar_user);
|
||||
}
|
||||
|
@ -158,18 +184,22 @@ void crypt_loadpwdfile() {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static
|
||||
void crypt_parsepwdentry(char* buffer, char** pwd, char** valdate) {
|
||||
void
|
||||
crypt_parsepwdentry(char *buffer, char **pwd, char **valdate)
|
||||
{
|
||||
|
||||
char *parse = buffer;
|
||||
int count,
|
||||
i;
|
||||
|
||||
/* skip to the password field
|
||||
/*
|
||||
* skip to the password field
|
||||
*/
|
||||
for (i = 0; i < 6; i++)
|
||||
parse += (strcspn(parse, CRYPT_PWD_FILE_SEPSTR) + 1);
|
||||
|
||||
/* store a copy of user password to return
|
||||
/*
|
||||
* store a copy of user password to return
|
||||
*/
|
||||
count = strcspn(parse, CRYPT_PWD_FILE_SEPSTR);
|
||||
*pwd = (char *) malloc(count + 1);
|
||||
|
@ -177,7 +207,8 @@ void crypt_parsepwdentry(char* buffer, char** pwd, char** valdate) {
|
|||
(*pwd)[count] = '\0';
|
||||
parse += (count + 1);
|
||||
|
||||
/* store a copy of date login becomes invalid
|
||||
/*
|
||||
* store a copy of date login becomes invalid
|
||||
*/
|
||||
count = strcspn(parse, CRYPT_PWD_FILE_SEPSTR);
|
||||
*valdate = (char *) malloc(count + 1);
|
||||
|
@ -189,7 +220,9 @@ void crypt_parsepwdentry(char* buffer, char** pwd, char** valdate) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static
|
||||
int crypt_getloginfo(const char* user, char** passwd, char** valuntil) {
|
||||
int
|
||||
crypt_getloginfo(const char *user, char **passwd, char **valuntil)
|
||||
{
|
||||
|
||||
char *pwd;
|
||||
char *valdate;
|
||||
|
@ -199,13 +232,15 @@ int crypt_getloginfo(const char* user, char** passwd, char** valuntil) {
|
|||
*valuntil = NULL;
|
||||
crypt_loadpwdfile();
|
||||
|
||||
if (pwd_cache) {
|
||||
if (pwd_cache)
|
||||
{
|
||||
char **pwd_entry;
|
||||
char user_search[NAMEDATALEN + 2];
|
||||
|
||||
sprintf(user_search, "%s\t", user);
|
||||
fakeout = (void *) &user_search;
|
||||
if ((pwd_entry = (char**)bsearch((void*)&fakeout, (void*)pwd_cache, pwd_cache_count, sizeof(char*), compar_user))) {
|
||||
if ((pwd_entry = (char **) bsearch((void *) &fakeout, (void *) pwd_cache, pwd_cache_count, sizeof(char *), compar_user)))
|
||||
{
|
||||
crypt_parsepwdentry(*pwd_entry, &pwd, &valdate);
|
||||
*passwd = pwd;
|
||||
*valuntil = valdate;
|
||||
|
@ -221,7 +256,9 @@ int crypt_getloginfo(const char* user, char** passwd, char** valuntil) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#if 0
|
||||
MsgType crypt_salt(const char* user) {
|
||||
MsgType
|
||||
crypt_salt(const char *user)
|
||||
{
|
||||
|
||||
char *passwd;
|
||||
char *valuntil;
|
||||
|
@ -229,21 +266,28 @@ MsgType crypt_salt(const char* user) {
|
|||
if (crypt_getloginfo(user, &passwd, &valuntil) == STATUS_ERROR)
|
||||
return STARTUP_UNSALT_MSG;
|
||||
|
||||
if (passwd == NULL || *passwd == '\0' || !strcmp(passwd, "\\N")) {
|
||||
if (passwd) free((void*)passwd);
|
||||
if (valuntil) free((void*)valuntil);
|
||||
if (passwd == NULL || *passwd == '\0' || !strcmp(passwd, "\\N"))
|
||||
{
|
||||
if (passwd)
|
||||
free((void *) passwd);
|
||||
if (valuntil)
|
||||
free((void *) valuntil);
|
||||
return STARTUP_UNSALT_MSG;
|
||||
}
|
||||
|
||||
free((void *) passwd);
|
||||
if (valuntil) free((void*)valuntil);
|
||||
if (valuntil)
|
||||
free((void *) valuntil);
|
||||
return STARTUP_SALT_MSG;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
int crypt_verify(Port* port, const char* user, const char* pgpass) {
|
||||
int
|
||||
crypt_verify(Port *port, const char *user, const char *pgpass)
|
||||
{
|
||||
|
||||
char *passwd;
|
||||
char *valuntil;
|
||||
|
@ -255,9 +299,12 @@ int crypt_verify(Port* port, const char* user, const char* pgpass) {
|
|||
if (crypt_getloginfo(user, &passwd, &valuntil) == STATUS_ERROR)
|
||||
return STATUS_ERROR;
|
||||
|
||||
if (passwd == NULL || *passwd == '\0') {
|
||||
if (passwd) free((void*)passwd);
|
||||
if (valuntil) free((void*)valuntil);
|
||||
if (passwd == NULL || *passwd == '\0')
|
||||
{
|
||||
if (passwd)
|
||||
free((void *) passwd);
|
||||
if (valuntil)
|
||||
free((void *) valuntil);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -268,8 +315,11 @@ int crypt_verify(Port* port, const char* user, const char* pgpass) {
|
|||
|
||||
crypt_pwd = (port->auth_method == uaCrypt ? crypt(passwd, port->salt) : passwd);
|
||||
|
||||
if (!strcmp(pgpass, crypt_pwd)) {
|
||||
/* check here to be sure we are not past valuntil
|
||||
if (!strcmp(pgpass, crypt_pwd))
|
||||
{
|
||||
|
||||
/*
|
||||
* check here to be sure we are not past valuntil
|
||||
*/
|
||||
if (!valuntil || strcmp(valuntil, "\\N") == 0)
|
||||
vuntil = INVALID_ABSTIME;
|
||||
|
@ -283,7 +333,8 @@ int crypt_verify(Port* port, const char* user, const char* pgpass) {
|
|||
}
|
||||
|
||||
free((void *) passwd);
|
||||
if (valuntil) free((void*)valuntil);
|
||||
if (valuntil)
|
||||
free((void *) valuntil);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.28 1998/02/24 15:18:41 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.29 1998/02/26 04:31:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -167,7 +167,8 @@ process_hba_record(FILE *file, SockAddr *raddr, const char database[],
|
|||
return *error_p true, after issuing a message to stderr. If no error,
|
||||
leave *error_p as it was.
|
||||
---------------------------------------------------------------------------*/
|
||||
char db[MAX_TOKEN], buf[MAX_TOKEN];
|
||||
char db[MAX_TOKEN],
|
||||
buf[MAX_TOKEN];
|
||||
|
||||
/* Read the record type field. */
|
||||
|
||||
|
@ -215,7 +216,8 @@ process_hba_record(FILE *file, SockAddr *raddr, const char database[],
|
|||
}
|
||||
else if (strcmp(buf, "host") == 0)
|
||||
{
|
||||
struct in_addr file_ip_addr, mask;
|
||||
struct in_addr file_ip_addr,
|
||||
mask;
|
||||
|
||||
/* Get the database. */
|
||||
|
||||
|
@ -860,13 +862,20 @@ struct CharsetItem
|
|||
char Table[MAX_TOKEN];
|
||||
};
|
||||
|
||||
int InRange(char *buf,int host)
|
||||
int
|
||||
InRange(char *buf, int host)
|
||||
{
|
||||
int valid,i,FromAddr,ToAddr,tmp;
|
||||
int valid,
|
||||
i,
|
||||
FromAddr,
|
||||
ToAddr,
|
||||
tmp;
|
||||
struct in_addr file_ip_addr;
|
||||
char *p;
|
||||
unsigned int one=0x80000000,NetMask=0;
|
||||
unsigned int one = 0x80000000,
|
||||
NetMask = 0;
|
||||
unsigned char mask;
|
||||
|
||||
p = strchr(buf, '/');
|
||||
if (p)
|
||||
{
|
||||
|
@ -922,14 +931,20 @@ int InRange(char *buf,int host)
|
|||
return false;
|
||||
}
|
||||
|
||||
void GetCharSetByHost(char TableName[],int host, const char DataDir[])
|
||||
void
|
||||
GetCharSetByHost(char TableName[], int host, const char DataDir[])
|
||||
{
|
||||
FILE *file;
|
||||
char buf[MAX_TOKEN],BaseCharset[MAX_TOKEN],
|
||||
OrigCharset[MAX_TOKEN],DestCharset[MAX_TOKEN],HostCharset[MAX_TOKEN];
|
||||
char c,eof=false;
|
||||
char buf[MAX_TOKEN],
|
||||
BaseCharset[MAX_TOKEN],
|
||||
OrigCharset[MAX_TOKEN],
|
||||
DestCharset[MAX_TOKEN],
|
||||
HostCharset[MAX_TOKEN];
|
||||
char c,
|
||||
eof = false;
|
||||
char *map_file;
|
||||
int key=0,i;
|
||||
int key = 0,
|
||||
i;
|
||||
struct CharsetItem *ChArray[MAX_CHARSETS];
|
||||
int ChIndex = 0;
|
||||
|
||||
|
@ -1031,6 +1046,7 @@ void GetCharSetByHost(char TableName[],int host, const char DataDir[])
|
|||
free((struct CharsetItem *) ChArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extern int
|
||||
|
|
|
@ -36,7 +36,10 @@ verify_password(char *auth_arg, char *user, char *password)
|
|||
|
||||
while (!feof(pw_file))
|
||||
{
|
||||
char pw_file_line[255], *p, *test_user, *test_pw;
|
||||
char pw_file_line[255],
|
||||
*p,
|
||||
*test_user,
|
||||
*test_pw;
|
||||
|
||||
fgets(pw_file_line, sizeof(pw_file_line), pw_file);
|
||||
p = pw_file_line;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.12 1997/12/09 03:10:43 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.13 1998/02/26 04:31:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.9 1997/12/09 03:10:45 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.10 1998/02/26 04:31:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.38 1998/02/24 04:01:53 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.39 1998/02/26 04:31:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.14 1998/01/31 20:12:09 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.15 1998/02/26 04:31:56 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -52,7 +52,8 @@ void PacketReceiveSetup(Packet *pkt, void (*iodone)(), char *arg)
|
|||
* open.
|
||||
*/
|
||||
|
||||
int PacketReceiveFragment(Packet *pkt, int sock)
|
||||
int
|
||||
PacketReceiveFragment(Packet *pkt, int sock)
|
||||
{
|
||||
int got;
|
||||
|
||||
|
@ -131,7 +132,8 @@ void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone)(), char *arg)
|
|||
* open.
|
||||
*/
|
||||
|
||||
int PacketSendFragment(Packet *pkt, int sock)
|
||||
int
|
||||
PacketSendFragment(Packet *pkt, int sock)
|
||||
{
|
||||
int done;
|
||||
|
||||
|
@ -173,7 +175,8 @@ int PacketSendFragment(Packet *pkt, int sock)
|
|||
* Send an error message from the postmaster to the frontend.
|
||||
*/
|
||||
|
||||
void PacketSendError(Packet *pkt, char *errormsg)
|
||||
void
|
||||
PacketSendError(Packet *pkt, char *errormsg)
|
||||
{
|
||||
fprintf(stderr, "%s\n", errormsg);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.13 1998/02/05 04:21:56 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.14 1998/02/26 04:31:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -38,9 +38,11 @@ main(int argc, char *argv[])
|
|||
#if defined(alpha)
|
||||
#ifdef NOFIXADE
|
||||
int buffer[] = {SSIN_UACPROC, UAC_SIGBUS};
|
||||
|
||||
#endif /* NOFIXADE */
|
||||
#ifdef NOPRINTADE
|
||||
int buffer[] = {SSIN_UACPROC, UAC_NOPRINT};
|
||||
|
||||
#endif /* NOPRINTADE */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.40 1998/02/23 02:54:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.41 1998/02/26 04:32:04 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -1576,7 +1576,8 @@ _copyQuery(Query *from)
|
|||
|
||||
if (from->unionClause)
|
||||
{
|
||||
List *ulist, *temp_list = NIL;
|
||||
List *ulist,
|
||||
*temp_list = NIL;
|
||||
|
||||
foreach(ulist, from->unionClause)
|
||||
temp_list = lappend(temp_list, copyObject(lfirst(ulist)));
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.15 1998/02/13 03:27:44 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.16 1998/02/26 04:32:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.11 1998/01/15 18:59:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.12 1998/02/26 04:32:08 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* XXX a few of the following functions are duplicated to handle
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.8 1998/02/21 16:58:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.9 1998/02/26 04:32:08 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Creator functions in POSTGRES 4.2 are generated automatically. Most of
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.6 1997/09/08 21:44:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.7 1998/02/26 04:32:09 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.4 1997/09/18 20:20:43 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.5 1998/02/26 04:32:10 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* Andrew Yu Oct 20, 1994 file creation
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.32 1998/02/21 18:17:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.33 1998/02/26 04:32:12 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.10 1998/01/07 21:03:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.11 1998/02/26 04:32:16 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.27 1998/02/21 18:17:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.28 1998/02/26 04:32:17 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* geqo_erx.c--
|
||||
* edge recombination crossover [ER]
|
||||
*
|
||||
* $Id: geqo_erx.c,v 1.7 1998/01/07 21:03:40 momjian Exp $
|
||||
* $Id: geqo_erx.c,v 1.8 1998/02/26 04:32:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_eval.c,v 1.17 1998/01/07 21:03:42 momjian Exp $
|
||||
* $Id: geqo_eval.c,v 1.18 1998/02/26 04:32:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_main.c,v 1.6 1997/09/08 21:44:25 momjian Exp $
|
||||
* $Id: geqo_main.c,v 1.7 1998/02/26 04:32:22 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_paths.c,v 1.7 1997/09/08 21:44:32 momjian Exp $
|
||||
* $Id: geqo_paths.c,v 1.8 1998/02/26 04:32:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_pool.c,v 1.4 1997/09/08 21:44:34 momjian Exp $
|
||||
* $Id: geqo_pool.c,v 1.5 1998/02/26 04:32:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* geqo_recombination.c--
|
||||
* misc recombination procedures
|
||||
*
|
||||
* $Id: geqo_recombination.c,v 1.4 1997/09/08 21:44:36 momjian Exp $
|
||||
* $Id: geqo_recombination.c,v 1.5 1998/02/26 04:32:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.14 1997/12/21 05:18:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.15 1998/02/26 04:32:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -191,10 +191,12 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
|
|||
|
||||
while (--levels_needed)
|
||||
{
|
||||
|
||||
/*
|
||||
* Determine all possible pairs of relations to be joined at this
|
||||
* level. Determine paths for joining these relation pairs and modify
|
||||
* 'new-rels' accordingly, then eliminate redundant join relations.
|
||||
* level. Determine paths for joining these relation pairs and
|
||||
* modify 'new-rels' accordingly, then eliminate redundant join
|
||||
* relations.
|
||||
*/
|
||||
new_rels = find_join_rels(root, outer_rels);
|
||||
|
||||
|
@ -205,8 +207,8 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
|
|||
#if 0
|
||||
|
||||
/*
|
||||
* * for each expensive predicate in each path in each distinct rel, *
|
||||
* consider doing pullup -- JMH
|
||||
* * for each expensive predicate in each path in each distinct
|
||||
* rel, * consider doing pullup -- JMH
|
||||
*/
|
||||
if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF)
|
||||
foreach(x, new_rels)
|
||||
|
@ -219,9 +221,10 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
|
|||
{
|
||||
|
||||
/*
|
||||
* In case of bushy trees if there is still a join between a join
|
||||
* relation and another relation, add a new joininfo that involves
|
||||
* the join relation to the joininfo list of the other relation
|
||||
* In case of bushy trees if there is still a join between a
|
||||
* join relation and another relation, add a new joininfo that
|
||||
* involves the join relation to the joininfo list of the
|
||||
* other relation
|
||||
*/
|
||||
add_new_joininfos(root, new_rels, outer_rels);
|
||||
}
|
||||
|
@ -244,8 +247,8 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
|
|||
{
|
||||
|
||||
/*
|
||||
* prune rels that have been completely incorporated into new join
|
||||
* rels
|
||||
* prune rels that have been completely incorporated into new
|
||||
* join rels
|
||||
*/
|
||||
outer_rels = prune_oldrels(outer_rels);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.5 1998/02/13 03:29:36 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.6 1998/02/26 04:32:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -273,14 +273,15 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
|
|||
/* this isn't an Oper, it's a Func!! */
|
||||
|
||||
/*
|
||||
* This is not an operator, so we guess at the selectivity.
|
||||
* THIS IS A HACK TO GET V4 OUT THE DOOR. FUNCS SHOULD BE ABLE
|
||||
* TO HAVE SELECTIVITIES THEMSELVES. -- JMH 7/9/92
|
||||
* This is not an operator, so we guess at the selectivity. THIS
|
||||
* IS A HACK TO GET V4 OUT THE DOOR. FUNCS SHOULD BE ABLE TO HAVE
|
||||
* SELECTIVITIES THEMSELVES. -- JMH 7/9/92
|
||||
*/
|
||||
s1 = 0.1;
|
||||
}
|
||||
else if (is_subplan((Node *) clause))
|
||||
{
|
||||
|
||||
/*
|
||||
* Just for the moment! FIX ME! - vadim 02/04/98
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.4 1997/09/08 21:44:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.5 1998/02/26 04:32:30 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue