typedef struct remoteConn
{
- PGconn *conn; /* Hold the remote connection */
+ PGconn *conn; /* Hold the remote connection */
int openCursorCount; /* The number of open cursors */
- bool newXactForCursor; /* Opened a transaction for a cursor */
+ bool newXactForCursor; /* Opened a transaction for a cursor */
} remoteConn;
/*
static char *generate_relation_name(Oid relid);
/* Global */
-static remoteConn *pconn = NULL;
-static HTAB *remoteConnHash = NULL;
+static remoteConn *pconn = NULL;
+static HTAB *remoteConnHash = NULL;
/*
* Following is list that holds multiple remote connections.
else
conn = rconn->conn;
- /* If we are not in a transaction, start one */
+ /* If we are not in a transaction, start one */
if (PQtransactionStatus(conn) == PQTRANS_IDLE)
{
res = PQexec(conn, "BEGIN");
else
{
values[i] = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(ptr)));
+ PointerGetDatum(ptr)));
ptr = att_addlength(ptr, typlen, PointerGetDatum(ptr));
ptr = (char *) att_align(ptr, typalign);
}
key = -1;
if (key > -1)
- val = tgt_pkattvals[key] ? pstrdup(tgt_pkattvals[key]) : NULL;
+ val = tgt_pkattvals[key] ? pstrdup(tgt_pkattvals[key]) : NULL;
else
val = SPI_getvalue(tuple, tupdesc, i + 1);
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
if (tgt_pkattvals != NULL)
- val = tgt_pkattvals[i] ? pstrdup(tgt_pkattvals[i]) : NULL;
+ val = tgt_pkattvals[i] ? pstrdup(tgt_pkattvals[i]) : NULL;
else
val = SPI_getvalue(tuple, tupdesc, pkattnum);
if (strategy == BooleanSearchStrategy)
PG_RETURN_BOOL(execconsistent((QUERYTYPE *) query,
(ArrayType *) DatumGetPointer(entry->key),
- GIST_LEAF(entry)));
+ GIST_LEAF(entry)));
/* XXX are we sure it's safe to scribble on the query object here? */
/* XXX what about toasted input? */
for (i = 0; i < entryvec->n; i++)
{
- ArrayType *ent = GETENTRY(entryvec, i);
+ ArrayType *ent = GETENTRY(entryvec, i);
CHECKARRVALID(ent);
totlen += ARRNELEMS(ent);
for (i = 0; i < entryvec->n; i++)
{
- ArrayType *ent = GETENTRY(entryvec, i);
- int nel;
+ ArrayType *ent = GETENTRY(entryvec, i);
+ int nel;
nel = ARRNELEMS(ent);
memcpy(ptr, ARRPTR(ent), nel * sizeof(int4));
CHECKARRVALID(r);
PREPAREARR(r);
- if (ARRNELEMS(r)>= 2 * MAXNUMRANGE)
- elog(NOTICE,"Input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
- 2 * MAXNUMRANGE - 1, ARRNELEMS(r));
-
+ if (ARRNELEMS(r) >= 2 * MAXNUMRANGE)
+ elog(NOTICE, "Input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
+ 2 * MAXNUMRANGE - 1, ARRNELEMS(r));
+
retval = palloc(sizeof(GISTENTRY));
gistentryinit(*retval, PointerGetDatum(r),
entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
PG_RETURN_POINTER(retval);
}
- /* leaf entries never compress one more time, only when entry->leafkey ==true,
- so now we work only with internal keys */
+ /*
+ * leaf entries never compress one more time, only when entry->leafkey
+ * ==true, so now we work only with internal keys
+ */
r = (ArrayType *) PG_DETOAST_DATUM(entry->key);
CHECKARRVALID(r);
- if (ARRISVOID(r))
+ if (ARRISVOID(r))
{
if (r != (ArrayType *) DatumGetPointer(entry->key))
pfree(r);
/*
- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.45 2005/10/29 19:38:07 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.46 2005/11/22 18:17:04 momjian Exp $
*
* pgbench: a simple benchmark program for PostgreSQL
* written by Tatsuo Ishii
fprintf(stderr, "Use limit/ulimt to increase the limit before using pgbench.\n");
exit(1);
}
-#endif /* #if !(defined(__CYGWIN__) || defined(__MINGW32__)) */
+#endif /* #if !(defined(__CYGWIN__) ||
+ * defined(__MINGW32__)) */
break;
case 'C':
is_connect = 1;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.6 2005/10/15 02:49:06 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.7 2005/11/22 18:17:04 momjian Exp $
*/
#include "postgres.h"
* The original purpose of the 2-byte check was to show user a
* friendly "wrong key" message. This made following possible:
*
- * "An Attack on CFB Mode Encryption As Used By OpenPGP" by Serge Mister
- * and Robert Zuccherato
+ * "An Attack on CFB Mode Encryption As Used By OpenPGP" by Serge
+ * Mister and Robert Zuccherato
*
- * To avoid being 'oracle', we delay reporting, which basically means we
- * prefer to run into corrupt packet header.
+ * To avoid being 'oracle', we delay reporting, which basically means
+ * we prefer to run into corrupt packet header.
*
- * We _could_ throw PXE_PGP_CORRUPT_DATA here, but there is possibility
- * of attack via timing, so we don't.
+ * We _could_ throw PXE_PGP_CORRUPT_DATA here, but there is
+ * possibility of attack via timing, so we don't.
*/
ctx->corrupt_prefix = 1;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.6 2005/10/15 02:49:06 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.7 2005/11/22 18:17:04 momjian Exp $
*/
#include "postgres.h"
/*
* Try to make the feeding unpredictable.
*
- * Prefer data over keys, as it's rather likely that key is same in several
- * calls.
+ * Prefer data over keys, as it's rather likely that key is same in
+ * several calls.
*/
/* chance: 7/8 */
* Get the next category item value, which is alway
* attribute number three.
*
- * Be careful to sssign the value to the array index based on
- * which category we are presently processing.
+ * Be careful to sssign the value to the array index based
+ * on which category we are presently processing.
*/
values[1 + i] = SPI_getvalue(spi_tuple, spi_tupdesc, 3);
/*
* The provided SQL query must always return at least three columns:
*
- * 1. rowname the label for each row - column 1 in the final result 2.
- * category the label for each value-column in the final result 3.
+ * 1. rowname the label for each row - column 1 in the final result
+ * 2. category the label for each value-column in the final result 3.
* value the values used to populate the value-columns
*
* If there are more than three columns, the last two are taken as
state->state = WAITOPERATOR;
return VAL;
}
- else if ( state->state == WAITFIRSTOPERAND )
+ else if (state->state == WAITFIRSTOPERAND)
return END;
else
ereport(ERROR,
return ERR;
break;
case WAITSINGLEOPERAND:
- if ( *(state->buf) == '\0' )
+ if (*(state->buf) == '\0')
return END;
*strval = state->buf;
- *lenval = strlen( state->buf );
- state->buf += strlen( state->buf );
+ *lenval = strlen(state->buf);
+ state->buf += strlen(state->buf);
state->count++;
- return VAL;
+ return VAL;
default:
return ERR;
break;
* input
*/
static QUERYTYPE *
-queryin(char *buf, void (*pushval) (QPRS_STATE *, int, char *, int, int2), int cfg_id, bool isplain)
+ queryin(char *buf, void (*pushval) (QPRS_STATE *, int, char *, int, int2), int cfg_id, bool isplain)
{
QPRS_STATE state;
int4 i;
/* parse query & make polish notation (postfix, but in reverse order) */
makepol(&state, pushval);
pfree(state.valstate.word);
- if (!state.num) {
+ if (!state.num)
+ {
elog(NOTICE, "Query doesn't contain lexem(s)");
- query = (QUERYTYPE*)palloc( HDRSIZEQT );
+ query = (QUERYTYPE *) palloc(HDRSIZEQT);
query->len = HDRSIZEQT;
query->size = 0;
- return query;
+ return query;
}
/* make finish struct */
str = text2char(in);
PG_FREE_IF_COPY(in, 1);
- query = queryin(str, pushval_morph, PG_GETARG_INT32(0),false);
-
- if ( query->size == 0 )
+ query = queryin(str, pushval_morph, PG_GETARG_INT32(0), false);
+
+ if (query->size == 0)
PG_RETURN_POINTER(query);
res = clean_fakeval_v2(GETQUERY(query), &len);
PG_FREE_IF_COPY(in, 1);
query = queryin(str, pushval_morph, PG_GETARG_INT32(0), true);
-
- if ( query->size == 0 )
+
+ if (query->size == 0)
PG_RETURN_POINTER(query);
res = clean_fakeval_v2(GETQUERY(query), &len);
Int32GetDatum(get_currcfg()),
PG_GETARG_DATUM(0)));
}
-
int4 val;
/* user-friendly value, must correlate with WordEntry */
uint32
- istrue:1, /* use for ranking in Cover */
+ istrue:1, /* use for ranking in Cover */
length:11,
distance:20;
} ITEM;
#include "query.h"
typedef uint64 TPQTGist;
-#define SIGLEN (sizeof(TPQTGist)*BITS_PER_BYTE)
+
+#define SIGLEN (sizeof(TPQTGist)*BITS_PER_BYTE)
#define GETENTRY(vec,pos) ((TPQTGist *) DatumGetPointer((vec)->vector[(pos)].key))
PG_FUNCTION_INFO_V1(tsq_mcontains);
-Datum tsq_mcontains(PG_FUNCTION_ARGS);
+Datum tsq_mcontains(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(tsq_mcontained);
-Datum tsq_mcontained(PG_FUNCTION_ARGS);
+Datum tsq_mcontained(PG_FUNCTION_ARGS);
static TPQTGist
-makesign(QUERYTYPE* a) {
- int i;
- ITEM *ptr = GETQUERY(a);
+makesign(QUERYTYPE * a)
+{
+ int i;
+ ITEM *ptr = GETQUERY(a);
TPQTGist sign = 0;
- for (i = 0; i < a->size; i++) {
- if ( ptr->type == VAL )
+ for (i = 0; i < a->size; i++)
+ {
+ if (ptr->type == VAL)
sign |= 1 << (ptr->val % SIGLEN);
ptr++;
}
-
+
return sign;
}
Datum
-tsq_mcontains(PG_FUNCTION_ARGS) {
+tsq_mcontains(PG_FUNCTION_ARGS)
+{
QUERYTYPE *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
QUERYTYPE *ex = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
- TPQTGist sq, se;
- int i,j;
- ITEM *iq, *ie;
-
- if ( query->size < ex->size ) {
+ TPQTGist sq,
+ se;
+ int i,
+ j;
+ ITEM *iq,
+ *ie;
+
+ if (query->size < ex->size)
+ {
PG_FREE_IF_COPY(query, 0);
PG_FREE_IF_COPY(ex, 1);
- PG_RETURN_BOOL( false );
+ PG_RETURN_BOOL(false);
}
sq = makesign(query);
se = makesign(ex);
- if ( (sq&se)!=se ) {
+ if ((sq & se) != se)
+ {
PG_FREE_IF_COPY(query, 0);
PG_FREE_IF_COPY(ex, 1);
- PG_RETURN_BOOL( false );
- }
+ PG_RETURN_BOOL(false);
+ }
ie = GETQUERY(ex);
- for(i=0;i<ex->size;i++) {
+ for (i = 0; i < ex->size; i++)
+ {
iq = GETQUERY(query);
- if ( ie[i].type != VAL )
+ if (ie[i].type != VAL)
continue;
- for(j=0;j<query->size;j++)
- if ( iq[j].type == VAL && ie[i].val == iq[j].val ) {
- j = query->size+1;
+ for (j = 0; j < query->size; j++)
+ if (iq[j].type == VAL && ie[i].val == iq[j].val)
+ {
+ j = query->size + 1;
break;
}
- if ( j == query->size ) {
+ if (j == query->size)
+ {
PG_FREE_IF_COPY(query, 0);
PG_FREE_IF_COPY(ex, 1);
- PG_RETURN_BOOL( false );
+ PG_RETURN_BOOL(false);
}
- }
+ }
PG_FREE_IF_COPY(query, 0);
PG_FREE_IF_COPY(ex, 1);
- PG_RETURN_BOOL( true );
+ PG_RETURN_BOOL(true);
}
Datum
-tsq_mcontained(PG_FUNCTION_ARGS) {
+tsq_mcontained(PG_FUNCTION_ARGS)
+{
PG_RETURN_DATUM(
- DirectFunctionCall2(
- tsq_mcontains,
- PG_GETARG_DATUM(1),
- PG_GETARG_DATUM(0)
- )
+ DirectFunctionCall2(
+ tsq_mcontains,
+ PG_GETARG_DATUM(1),
+ PG_GETARG_DATUM(0)
+ )
);
}
PG_FUNCTION_INFO_V1(gtsq_in);
-Datum gtsq_in(PG_FUNCTION_ARGS);
+Datum gtsq_in(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_out);
-Datum gtsq_out(PG_FUNCTION_ARGS);
+Datum gtsq_out(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_compress);
-Datum gtsq_compress(PG_FUNCTION_ARGS);
+Datum gtsq_compress(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_decompress);
-Datum gtsq_decompress(PG_FUNCTION_ARGS);
+Datum gtsq_decompress(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_consistent);
-Datum gtsq_consistent(PG_FUNCTION_ARGS);
+Datum gtsq_consistent(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_union);
-Datum gtsq_union(PG_FUNCTION_ARGS);
+Datum gtsq_union(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_same);
-Datum gtsq_same(PG_FUNCTION_ARGS);
+Datum gtsq_same(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_penalty);
-Datum gtsq_penalty(PG_FUNCTION_ARGS);
+Datum gtsq_penalty(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(gtsq_picksplit);
-Datum gtsq_picksplit(PG_FUNCTION_ARGS);
+Datum gtsq_picksplit(PG_FUNCTION_ARGS);
Datum
-gtsq_in(PG_FUNCTION_ARGS) {
- elog(ERROR, "Not implemented");
- PG_RETURN_DATUM(0);
+gtsq_in(PG_FUNCTION_ARGS)
+{
+ elog(ERROR, "Not implemented");
+ PG_RETURN_DATUM(0);
}
Datum
-gtsq_out(PG_FUNCTION_ARGS) {
- elog(ERROR, "Not implemented");
- PG_RETURN_DATUM(0);
+gtsq_out(PG_FUNCTION_ARGS)
+{
+ elog(ERROR, "Not implemented");
+ PG_RETURN_DATUM(0);
}
Datum
-gtsq_compress(PG_FUNCTION_ARGS) {
+gtsq_compress(PG_FUNCTION_ARGS)
+{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
GISTENTRY *retval = entry;
- if (entry->leafkey) {
- TPQTGist *sign = (TPQTGist*)palloc( sizeof(TPQTGist) );
+ if (entry->leafkey)
+ {
+ TPQTGist *sign = (TPQTGist *) palloc(sizeof(TPQTGist));
+
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
- *sign = makesign( (QUERYTYPE*)DatumGetPointer(PG_DETOAST_DATUM(entry->key)) );
+ *sign = makesign((QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(entry->key)));
gistentryinit(*retval, PointerGetDatum(sign),
- entry->rel, entry->page,
- entry->offset, sizeof(TPQTGist), FALSE);
+ entry->rel, entry->page,
+ entry->offset, sizeof(TPQTGist), FALSE);
}
PG_RETURN_POINTER(retval);
}
Datum
-gtsq_decompress(PG_FUNCTION_ARGS) {
+gtsq_decompress(PG_FUNCTION_ARGS)
+{
PG_RETURN_DATUM(PG_GETARG_DATUM(0));
}
Datum
-gtsq_consistent(PG_FUNCTION_ARGS) {
+gtsq_consistent(PG_FUNCTION_ARGS)
+{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
- TPQTGist *key = (TPQTGist*) DatumGetPointer(entry->key);
+ TPQTGist *key = (TPQTGist *) DatumGetPointer(entry->key);
QUERYTYPE *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
- StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
+ StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
TPQTGist sq = makesign(query);
- if ( GIST_LEAF(entry) )
- PG_RETURN_BOOL( ( (*key) & sq ) == ((strategy==1) ? sq : *key) );
- else
- PG_RETURN_BOOL( (*key) & sq );
+ if (GIST_LEAF(entry))
+ PG_RETURN_BOOL(((*key) & sq) == ((strategy == 1) ? sq : *key));
+ else
+ PG_RETURN_BOOL((*key) & sq);
}
Datum
-gtsq_union(PG_FUNCTION_ARGS) {
+gtsq_union(PG_FUNCTION_ARGS)
+{
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
- TPQTGist *sign = (TPQTGist*)palloc( sizeof(TPQTGist) );
- int i;
- int *size = (int *) PG_GETARG_POINTER(1);
+ TPQTGist *sign = (TPQTGist *) palloc(sizeof(TPQTGist));
+ int i;
+ int *size = (int *) PG_GETARG_POINTER(1);
- memset( sign, 0, sizeof(TPQTGist) );
+ memset(sign, 0, sizeof(TPQTGist));
- for (i = 0; i < entryvec->n;i++)
+ for (i = 0; i < entryvec->n; i++)
*sign |= *GETENTRY(entryvec, i);
*size = sizeof(TPQTGist);
}
Datum
-gtsq_same(PG_FUNCTION_ARGS) {
- TPQTGist *a = (TPQTGist *) PG_GETARG_POINTER(0);
- TPQTGist *b = (TPQTGist *) PG_GETARG_POINTER(1);
+gtsq_same(PG_FUNCTION_ARGS)
+{
+ TPQTGist *a = (TPQTGist *) PG_GETARG_POINTER(0);
+ TPQTGist *b = (TPQTGist *) PG_GETARG_POINTER(1);
- PG_RETURN_POINTER( *a == *b );
+ PG_RETURN_POINTER(*a == *b);
}
static int
-sizebitvec(TPQTGist sign) {
- int size=0,i;
+sizebitvec(TPQTGist sign)
+{
+ int size = 0,
+ i;
- for(i=0;i<SIGLEN;i++)
- size += 0x01 & (sign>>i);
+ for (i = 0; i < SIGLEN; i++)
+ size += 0x01 & (sign >> i);
return size;
}
static int
-hemdist(TPQTGist a, TPQTGist b) {
- TPQTGist res = a ^ b;
+hemdist(TPQTGist a, TPQTGist b)
+{
+ TPQTGist res = a ^ b;
return sizebitvec(res);
}
Datum
-gtsq_penalty(PG_FUNCTION_ARGS) {
- TPQTGist *origval = (TPQTGist*) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
- TPQTGist *newval = (TPQTGist*) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
- float *penalty = (float *) PG_GETARG_POINTER(2);
+gtsq_penalty(PG_FUNCTION_ARGS)
+{
+ TPQTGist *origval = (TPQTGist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
+ TPQTGist *newval = (TPQTGist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
+ float *penalty = (float *) PG_GETARG_POINTER(2);
*penalty = hemdist(*origval, *newval);
}
-typedef struct {
- OffsetNumber pos;
- int4 cost;
+typedef struct
+{
+ OffsetNumber pos;
+ int4 cost;
} SPLITCOST;
static int
-comparecost(const void *a, const void *b) {
- if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
- return 0;
- else
- return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
+comparecost(const void *a, const void *b)
+{
+ if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
+ return 0;
+ else
+ return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
}
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
Datum
-gtsq_picksplit(PG_FUNCTION_ARGS) {
+gtsq_picksplit(PG_FUNCTION_ARGS)
+{
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
OffsetNumber maxoff = entryvec->n - 2;
- OffsetNumber k,j;
-
- TPQTGist *datum_l, *datum_r;
- int4 size_alpha, size_beta;
- int4 size_waste, waste = -1;
- int4 nbytes;
- OffsetNumber seed_1 = 0, seed_2 = 0;
- OffsetNumber *left, *right;
-
- SPLITCOST *costvector;
+ OffsetNumber k,
+ j;
+
+ TPQTGist *datum_l,
+ *datum_r;
+ int4 size_alpha,
+ size_beta;
+ int4 size_waste,
+ waste = -1;
+ int4 nbytes;
+ OffsetNumber seed_1 = 0,
+ seed_2 = 0;
+ OffsetNumber *left,
+ *right;
+
+ SPLITCOST *costvector;
nbytes = (maxoff + 2) * sizeof(OffsetNumber);
left = v->spl_left = (OffsetNumber *) palloc(nbytes);
v->spl_nleft = v->spl_nright = 0;
for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k))
- for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j)) {
- size_waste = hemdist( *GETENTRY(entryvec,j), *GETENTRY(entryvec,k) );
- if (size_waste > waste) {
+ for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j))
+ {
+ size_waste = hemdist(*GETENTRY(entryvec, j), *GETENTRY(entryvec, k));
+ if (size_waste > waste)
+ {
waste = size_waste;
seed_1 = k;
seed_2 = j;
}
- if (seed_1 == 0 || seed_2 == 0) {
+ if (seed_1 == 0 || seed_2 == 0)
+ {
seed_1 = 1;
seed_2 = 2;
}
- datum_l = (TPQTGist*)palloc( sizeof(TPQTGist) );
- *datum_l=*GETENTRY(entryvec,seed_1);
- datum_r = (TPQTGist*)palloc( sizeof(TPQTGist) );
- *datum_r=*GETENTRY(entryvec,seed_2);
-
-
+ datum_l = (TPQTGist *) palloc(sizeof(TPQTGist));
+ *datum_l = *GETENTRY(entryvec, seed_1);
+ datum_r = (TPQTGist *) palloc(sizeof(TPQTGist));
+ *datum_r = *GETENTRY(entryvec, seed_2);
+
+
maxoff = OffsetNumberNext(maxoff);
costvector = (SPLITCOST *) palloc(sizeof(SPLITCOST) * maxoff);
- for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) {
+ for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j))
+ {
costvector[j - 1].pos = j;
- size_alpha = hemdist( *GETENTRY(entryvec,seed_1), *GETENTRY(entryvec,j) );
- size_beta = hemdist( *GETENTRY(entryvec,seed_2), *GETENTRY(entryvec,j) );
+ size_alpha = hemdist(*GETENTRY(entryvec, seed_1), *GETENTRY(entryvec, j));
+ size_beta = hemdist(*GETENTRY(entryvec, seed_2), *GETENTRY(entryvec, j));
costvector[j - 1].cost = abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
- for (k = 0; k < maxoff; k++) {
+ for (k = 0; k < maxoff; k++)
+ {
j = costvector[k].pos;
- if ( j == seed_1 ) {
+ if (j == seed_1)
+ {
*left++ = j;
v->spl_nleft++;
continue;
- } else if ( j == seed_2 ) {
+ }
+ else if (j == seed_2)
+ {
*right++ = j;
v->spl_nright++;
continue;
}
- size_alpha = hemdist( *datum_l, *GETENTRY(entryvec,j) );
- size_beta = hemdist( *datum_r, *GETENTRY(entryvec,j) );
+ size_alpha = hemdist(*datum_l, *GETENTRY(entryvec, j));
+ size_beta = hemdist(*datum_r, *GETENTRY(entryvec, j));
- if (size_alpha < size_beta + WISH_F(v->spl_nleft, v->spl_nright, 0.05)) {
- *datum_l |= *GETENTRY(entryvec,j);
+ if (size_alpha < size_beta + WISH_F(v->spl_nleft, v->spl_nright, 0.05))
+ {
+ *datum_l |= *GETENTRY(entryvec, j);
*left++ = j;
v->spl_nleft++;
- } else {
- *datum_r |= *GETENTRY(entryvec,j);
+ }
+ else
+ {
+ *datum_r |= *GETENTRY(entryvec, j);
*right++ = j;
v->spl_nright++;
}
PG_RETURN_POINTER(v);
}
-
-
MemoryContext AggregateContext = NULL;
static int
-addone(int * counters, int last, int total) {
+addone(int *counters, int last, int total)
+{
counters[last]++;
- if ( counters[last]>=total ) {
- if (last==0)
+ if (counters[last] >= total)
+ {
+ if (last == 0)
return 0;
- if ( addone( counters, last-1, total-1 ) == 0 )
+ if (addone(counters, last - 1, total - 1) == 0)
return 0;
- counters[last] = counters[last-1]+1;
+ counters[last] = counters[last - 1] + 1;
}
return 1;
}
-static QTNode *
-findeq(QTNode *node, QTNode *ex, MemoryType memtype, QTNode *subs, bool *isfind) {
-
- if ( (node->sign & ex->sign) != ex->sign || node->valnode->type != ex->valnode->type || node->valnode->val != ex->valnode->val )
+static QTNode *
+findeq(QTNode * node, QTNode * ex, MemoryType memtype, QTNode * subs, bool *isfind)
+{
+
+ if ((node->sign & ex->sign) != ex->sign || node->valnode->type != ex->valnode->type || node->valnode->val != ex->valnode->val)
return node;
- if ( node->flags & QTN_NOCHANGE )
- return node;
+ if (node->flags & QTN_NOCHANGE)
+ return node;
- if ( node->valnode->type==OPR ) {
- if ( node->nchild == ex->nchild ) {
- if ( QTNEq( node, ex ) ) {
- QTNFree( node );
- if ( subs ) {
- node = QTNCopy( subs, memtype );
+ if (node->valnode->type == OPR)
+ {
+ if (node->nchild == ex->nchild)
+ {
+ if (QTNEq(node, ex))
+ {
+ QTNFree(node);
+ if (subs)
+ {
+ node = QTNCopy(subs, memtype);
node->flags |= QTN_NOCHANGE;
- } else
- node = NULL;
+ }
+ else
+ node = NULL;
*isfind = true;
}
- } else if ( node->nchild > ex->nchild ) {
- int *counters = (int*)palloc( sizeof(int) * node->nchild );
- int i;
- QTNode *tnode = (QTNode*)MEMALLOC( memtype, sizeof(QTNode) );
+ }
+ else if (node->nchild > ex->nchild)
+ {
+ int *counters = (int *) palloc(sizeof(int) * node->nchild);
+ int i;
+ QTNode *tnode = (QTNode *) MEMALLOC(memtype, sizeof(QTNode));
memset(tnode, 0, sizeof(QTNode));
- tnode->child = (QTNode**)MEMALLOC( memtype, sizeof(QTNode*) * ex->nchild );
+ tnode->child = (QTNode **) MEMALLOC(memtype, sizeof(QTNode *) * ex->nchild);
tnode->nchild = ex->nchild;
- tnode->valnode = (ITEM*)MEMALLOC( memtype, sizeof(ITEM) );
+ tnode->valnode = (ITEM *) MEMALLOC(memtype, sizeof(ITEM));
*(tnode->valnode) = *(ex->valnode);
- for(i=0;i<ex->nchild;i++)
- counters[i]=i;
+ for (i = 0; i < ex->nchild; i++)
+ counters[i] = i;
- do {
- tnode->sign=0;
- for(i=0;i<ex->nchild;i++) {
- tnode->child[i] = node->child[ counters[i] ];
+ do
+ {
+ tnode->sign = 0;
+ for (i = 0; i < ex->nchild; i++)
+ {
+ tnode->child[i] = node->child[counters[i]];
tnode->sign |= tnode->child[i]->sign;
}
- if ( QTNEq( tnode, ex ) ) {
- int j=0;
+ if (QTNEq(tnode, ex))
+ {
+ int j = 0;
- MEMFREE( memtype, tnode->valnode );
- MEMFREE( memtype, tnode->child );
- MEMFREE( memtype, tnode );
- if ( subs ) {
- tnode = QTNCopy( subs, memtype );
+ MEMFREE(memtype, tnode->valnode);
+ MEMFREE(memtype, tnode->child);
+ MEMFREE(memtype, tnode);
+ if (subs)
+ {
+ tnode = QTNCopy(subs, memtype);
tnode->flags = QTN_NOCHANGE | QTN_NEEDFREE;
- } else
+ }
+ else
tnode = NULL;
- node->child[ counters[0] ] = tnode;
+ node->child[counters[0]] = tnode;
- for(i=1;i<ex->nchild;i++)
- node->child[ counters[i] ] = NULL;
- for(i=0;i<node->nchild;i++) {
- if ( node->child[i] ) {
+ for (i = 1; i < ex->nchild; i++)
+ node->child[counters[i]] = NULL;
+ for (i = 0; i < node->nchild; i++)
+ {
+ if (node->child[i])
+ {
node->child[j] = node->child[i];
j++;
}
}
- node->nchild = j;
+ node->nchild = j;
*isfind = true;
break;
}
- } while (addone(counters,ex->nchild-1,node->nchild));
- if ( tnode && (tnode->flags & QTN_NOCHANGE) == 0 ) {
- MEMFREE( memtype, tnode->valnode );
- MEMFREE( memtype, tnode->child );
- MEMFREE( memtype, tnode );
- } else
- QTNSort( node );
- pfree( counters );
+ } while (addone(counters, ex->nchild - 1, node->nchild));
+ if (tnode && (tnode->flags & QTN_NOCHANGE) == 0)
+ {
+ MEMFREE(memtype, tnode->valnode);
+ MEMFREE(memtype, tnode->child);
+ MEMFREE(memtype, tnode);
+ }
+ else
+ QTNSort(node);
+ pfree(counters);
}
- } else if ( QTNEq( node, ex ) ) {
- QTNFree( node );
- if ( subs ) {
- node = QTNCopy( subs, memtype );
+ }
+ else if (QTNEq(node, ex))
+ {
+ QTNFree(node);
+ if (subs)
+ {
+ node = QTNCopy(subs, memtype);
node->flags |= QTN_NOCHANGE;
- } else {
+ }
+ else
+ {
node = NULL;
}
*isfind = true;
}
return node;
-}
+}
static QTNode *
-dofindsubquery( QTNode *root, QTNode *ex, MemoryType memtype, QTNode *subs, bool *isfind ) {
- root = findeq( root, ex, memtype, subs, isfind );
+dofindsubquery(QTNode * root, QTNode * ex, MemoryType memtype, QTNode * subs, bool *isfind)
+{
+ root = findeq(root, ex, memtype, subs, isfind);
+
+ if (root && (root->flags & QTN_NOCHANGE) == 0 && root->valnode->type == OPR)
+ {
+ int i;
- if ( root && (root->flags & QTN_NOCHANGE) == 0 && root->valnode->type==OPR) {
- int i;
- for(i=0;i<root->nchild;i++)
- root->child[i] = dofindsubquery( root->child[i], ex, memtype, subs, isfind );
+ for (i = 0; i < root->nchild; i++)
+ root->child[i] = dofindsubquery(root->child[i], ex, memtype, subs, isfind);
}
return root;
}
static QTNode *
-dropvoidsubtree( QTNode *root ) {
+dropvoidsubtree(QTNode * root)
+{
- if ( !root )
+ if (!root)
return NULL;
- if ( root->valnode->type==OPR ) {
- int i,j=0;
+ if (root->valnode->type == OPR)
+ {
+ int i,
+ j = 0;
- for(i=0;i<root->nchild;i++) {
- if ( root->child[i] ) {
+ for (i = 0; i < root->nchild; i++)
+ {
+ if (root->child[i])
+ {
root->child[j] = root->child[i];
j++;
}
root->nchild = j;
- if ( root->valnode->val == (int4)'!' && root->nchild==0 ) {
+ if (root->valnode->val == (int4) '!' && root->nchild == 0)
+ {
QTNFree(root);
- root=NULL;
- } else if ( root->nchild==1 ) {
- QTNode *nroot = root->child[0];
+ root = NULL;
+ }
+ else if (root->nchild == 1)
+ {
+ QTNode *nroot = root->child[0];
+
pfree(root);
- root = nroot;
- }
+ root = nroot;
+ }
}
return root;
}
static QTNode *
-findsubquery( QTNode *root, QTNode *ex, MemoryType memtype, QTNode *subs, bool *isfind ) {
- bool DidFind = false;
- root = dofindsubquery( root, ex, memtype, subs, &DidFind );
+findsubquery(QTNode * root, QTNode * ex, MemoryType memtype, QTNode * subs, bool *isfind)
+{
+ bool DidFind = false;
+
+ root = dofindsubquery(root, ex, memtype, subs, &DidFind);
- if ( !subs && DidFind )
- root = dropvoidsubtree( root );
+ if (!subs && DidFind)
+ root = dropvoidsubtree(root);
- if ( isfind )
+ if (isfind)
*isfind = DidFind;
return root;
}
-static Oid tsqOid = InvalidOid;
+static Oid tsqOid = InvalidOid;
static void
get_tsq_Oid(void)
{
- int ret;
- bool isnull;
-
- if ((ret = SPI_exec("select oid from pg_type where typname='tsquery'", 1)) < 0)
- /* internal error */
- elog(ERROR, "SPI_exec to get tsquery oid returns %d", ret);
-
- if (SPI_processed < 0)
- /* internal error */
- elog(ERROR, "There is no tsvector type");
- tsqOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
- if (tsqOid == InvalidOid)
- /* internal error */
- elog(ERROR, "tsquery type has InvalidOid");
+ int ret;
+ bool isnull;
+
+ if ((ret = SPI_exec("select oid from pg_type where typname='tsquery'", 1)) < 0)
+ /* internal error */
+ elog(ERROR, "SPI_exec to get tsquery oid returns %d", ret);
+
+ if (SPI_processed < 0)
+ /* internal error */
+ elog(ERROR, "There is no tsvector type");
+ tsqOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
+ if (tsqOid == InvalidOid)
+ /* internal error */
+ elog(ERROR, "tsquery type has InvalidOid");
}
PG_FUNCTION_INFO_V1(tsquery_rewrite);
PG_FUNCTION_INFO_V1(rewrite_accum);
-Datum rewrite_accum(PG_FUNCTION_ARGS);
-
-Datum
-rewrite_accum(PG_FUNCTION_ARGS) {
- QUERYTYPE *acc = (QUERYTYPE *) PG_GETARG_POINTER(0);
- ArrayType *qa = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
- QUERYTYPE *q;
- QTNode *qex, *subs = NULL, *acctree;
- bool isfind = false;
- Datum *elemsp;
- int nelemsp;
+Datum rewrite_accum(PG_FUNCTION_ARGS);
+
+Datum
+rewrite_accum(PG_FUNCTION_ARGS)
+{
+ QUERYTYPE *acc = (QUERYTYPE *) PG_GETARG_POINTER(0);
+ ArrayType *qa = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+ QUERYTYPE *q;
+ QTNode *qex,
+ *subs = NULL,
+ *acctree;
+ bool isfind = false;
+ Datum *elemsp;
+ int nelemsp;
AggregateContext = ((AggState *) fcinfo->context)->aggcontext;
-
- if (acc == NULL || PG_ARGISNULL(0)) {
- acc = (QUERYTYPE*)MEMALLOC( AggMemory, sizeof(QUERYTYPE) );
+
+ if (acc == NULL || PG_ARGISNULL(0))
+ {
+ acc = (QUERYTYPE *) MEMALLOC(AggMemory, sizeof(QUERYTYPE));
acc->len = HDRSIZEQT;
acc->size = 0;
}
- if ( qa == NULL || PG_ARGISNULL(1) ) {
- PG_FREE_IF_COPY( qa, 1 );
- PG_RETURN_POINTER( acc );
+ if (qa == NULL || PG_ARGISNULL(1))
+ {
+ PG_FREE_IF_COPY(qa, 1);
+ PG_RETURN_POINTER(acc);
}
- if ( ARR_NDIM(qa) != 1 )
+ if (ARR_NDIM(qa) != 1)
elog(ERROR, "array must be one-dimensional, not %d dimension", ARR_NDIM(qa));
- if ( ArrayGetNItems( ARR_NDIM(qa), ARR_DIMS(qa)) != 3 )
+ if (ArrayGetNItems(ARR_NDIM(qa), ARR_DIMS(qa)) != 3)
elog(ERROR, "array should have only three elements");
- if (tsqOid == InvalidOid) {
+ if (tsqOid == InvalidOid)
+ {
SPI_connect();
get_tsq_Oid();
SPI_finish();
if (ARR_ELEMTYPE(qa) != tsqOid)
elog(ERROR, "array should contain tsquery type");
- deconstruct_array(qa, tsqOid, -1, false, 'i', &elemsp, NULL, &nelemsp);
+ deconstruct_array(qa, tsqOid, -1, false, 'i', &elemsp, NULL, &nelemsp);
- q = (QUERYTYPE*)DatumGetPointer( elemsp[0] );
- if ( q->size == 0 ) {
- pfree( elemsp );
- PG_RETURN_POINTER( acc );
+ q = (QUERYTYPE *) DatumGetPointer(elemsp[0]);
+ if (q->size == 0)
+ {
+ pfree(elemsp);
+ PG_RETURN_POINTER(acc);
}
-
- if ( !acc->size ) {
- if ( acc->len > HDRSIZEQT ) {
- pfree( elemsp );
- PG_RETURN_POINTER( acc );
- } else
- acctree = QT2QTN( GETQUERY(q), GETOPERAND(q) );
- } else
- acctree = QT2QTN( GETQUERY(acc), GETOPERAND(acc) );
-
- QTNTernary( acctree );
- QTNSort( acctree );
-
- q = (QUERYTYPE*)DatumGetPointer( elemsp[1] );
- if ( q->size == 0 ) {
- pfree( elemsp );
- PG_RETURN_POINTER( acc );
+
+ if (!acc->size)
+ {
+ if (acc->len > HDRSIZEQT)
+ {
+ pfree(elemsp);
+ PG_RETURN_POINTER(acc);
+ }
+ else
+ acctree = QT2QTN(GETQUERY(q), GETOPERAND(q));
}
- qex = QT2QTN( GETQUERY(q), GETOPERAND(q) );
- QTNTernary( qex );
- QTNSort( qex );
-
- q = (QUERYTYPE*)DatumGetPointer( elemsp[2] );
- if ( q->size )
- subs = QT2QTN( GETQUERY(q), GETOPERAND(q) );
+ else
+ acctree = QT2QTN(GETQUERY(acc), GETOPERAND(acc));
- acctree = findsubquery( acctree, qex, PlainMemory, subs, &isfind );
+ QTNTernary(acctree);
+ QTNSort(acctree);
+
+ q = (QUERYTYPE *) DatumGetPointer(elemsp[1]);
+ if (q->size == 0)
+ {
+ pfree(elemsp);
+ PG_RETURN_POINTER(acc);
+ }
+ qex = QT2QTN(GETQUERY(q), GETOPERAND(q));
+ QTNTernary(qex);
+ QTNSort(qex);
- if ( isfind || !acc->size ) {
+ q = (QUERYTYPE *) DatumGetPointer(elemsp[2]);
+ if (q->size)
+ subs = QT2QTN(GETQUERY(q), GETOPERAND(q));
+
+ acctree = findsubquery(acctree, qex, PlainMemory, subs, &isfind);
+
+ if (isfind || !acc->size)
+ {
/* pfree( acc ); do not pfree(p), because nodeAgg.c will */
- if ( acctree ) {
- QTNBinary( acctree );
- acc = QTN2QT( acctree, AggMemory );
- } else {
- acc = (QUERYTYPE*)MEMALLOC( AggMemory, HDRSIZEQT*2 );
+ if (acctree)
+ {
+ QTNBinary(acctree);
+ acc = QTN2QT(acctree, AggMemory);
+ }
+ else
+ {
+ acc = (QUERYTYPE *) MEMALLOC(AggMemory, HDRSIZEQT * 2);
acc->len = HDRSIZEQT * 2;
acc->size = 0;
}
}
- pfree( elemsp );
- QTNFree( qex );
- QTNFree( subs );
- QTNFree( acctree );
+ pfree(elemsp);
+ QTNFree(qex);
+ QTNFree(subs);
+ QTNFree(acctree);
- PG_RETURN_POINTER( acc );
+ PG_RETURN_POINTER(acc);
}
PG_FUNCTION_INFO_V1(rewrite_finish);
-Datum rewrite_finish(PG_FUNCTION_ARGS);
-
-Datum
-rewrite_finish(PG_FUNCTION_ARGS) {
- QUERYTYPE *acc = (QUERYTYPE *) PG_GETARG_POINTER(0);
- QUERYTYPE *rewrited;
-
- if (acc == NULL || PG_ARGISNULL(0) || acc->size == 0 ) {
- acc = (QUERYTYPE*)palloc(sizeof(QUERYTYPE));
+Datum rewrite_finish(PG_FUNCTION_ARGS);
+
+Datum
+rewrite_finish(PG_FUNCTION_ARGS)
+{
+ QUERYTYPE *acc = (QUERYTYPE *) PG_GETARG_POINTER(0);
+ QUERYTYPE *rewrited;
+
+ if (acc == NULL || PG_ARGISNULL(0) || acc->size == 0)
+ {
+ acc = (QUERYTYPE *) palloc(sizeof(QUERYTYPE));
acc->len = HDRSIZEQT;
acc->size = 0;
}
- rewrited = (QUERYTYPE*) palloc( acc->len );
- memcpy( rewrited, acc, acc->len );
- pfree( acc );
+ rewrited = (QUERYTYPE *) palloc(acc->len);
+ memcpy(rewrited, acc, acc->len);
+ pfree(acc);
- PG_RETURN_POINTER(rewrited);
+ PG_RETURN_POINTER(rewrited);
}
-Datum tsquery_rewrite(PG_FUNCTION_ARGS);
+Datum tsquery_rewrite(PG_FUNCTION_ARGS);
Datum
-tsquery_rewrite(PG_FUNCTION_ARGS) {
+tsquery_rewrite(PG_FUNCTION_ARGS)
+{
QUERYTYPE *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
- text *in = PG_GETARG_TEXT_P(1);
+ text *in = PG_GETARG_TEXT_P(1);
QUERYTYPE *rewrited = query;
- QTNode *tree;
- char *buf;
- void *plan;
- Portal portal;
- bool isnull;
- int i;
-
- if ( query->size == 0 ) {
+ QTNode *tree;
+ char *buf;
+ void *plan;
+ Portal portal;
+ bool isnull;
+ int i;
+
+ if (query->size == 0)
+ {
PG_FREE_IF_COPY(in, 1);
- PG_RETURN_POINTER( rewrited );
+ PG_RETURN_POINTER(rewrited);
}
- tree = QT2QTN( GETQUERY(query), GETOPERAND(query) );
- QTNTernary( tree );
- QTNSort( tree );
+ tree = QT2QTN(GETQUERY(query), GETOPERAND(query));
+ QTNTernary(tree);
+ QTNSort(tree);
- buf = (char*)palloc( VARSIZE(in) );
+ buf = (char *) palloc(VARSIZE(in));
memcpy(buf, VARDATA(in), VARSIZE(in) - VARHDRSZ);
- buf[ VARSIZE(in) - VARHDRSZ ] = '\0';
+ buf[VARSIZE(in) - VARHDRSZ] = '\0';
SPI_connect();
if ((portal = SPI_cursor_open(NULL, plan, NULL, NULL, false)) == NULL)
elog(ERROR, "SPI_cursor_open('%s') returns NULL", buf);
-
+
SPI_cursor_fetch(portal, true, 100);
if (SPI_tuptable->tupdesc->natts != 2)
elog(ERROR, "number of fields doesn't equal to 2");
- if (SPI_gettypeid(SPI_tuptable->tupdesc, 1) != tsqOid )
+ if (SPI_gettypeid(SPI_tuptable->tupdesc, 1) != tsqOid)
elog(ERROR, "column #1 isn't of tsquery type");
- if (SPI_gettypeid(SPI_tuptable->tupdesc, 2) != tsqOid )
+ if (SPI_gettypeid(SPI_tuptable->tupdesc, 2) != tsqOid)
elog(ERROR, "column #2 isn't of tsquery type");
- while (SPI_processed > 0 && tree ) {
- for (i = 0; i < SPI_processed && tree; i++) {
- Datum qdata = SPI_getbinval(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 1, &isnull);
- Datum sdata;
+ while (SPI_processed > 0 && tree)
+ {
+ for (i = 0; i < SPI_processed && tree; i++)
+ {
+ Datum qdata = SPI_getbinval(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 1, &isnull);
+ Datum sdata;
- if ( isnull ) continue;
+ if (isnull)
+ continue;
sdata = SPI_getbinval(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 2, &isnull);
- if (!isnull) {
- QUERYTYPE *qtex = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(qdata));
- QUERYTYPE *qtsubs = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(sdata));
- QTNode *qex, *qsubs = NULL;
-
- if (qtex->size == 0) {
- if ( qtex != (QUERYTYPE *) DatumGetPointer(qdata) )
- pfree( qtex );
- if ( qtsubs != (QUERYTYPE *) DatumGetPointer(sdata) )
- pfree( qtsubs );
+ if (!isnull)
+ {
+ QUERYTYPE *qtex = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(qdata));
+ QUERYTYPE *qtsubs = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(sdata));
+ QTNode *qex,
+ *qsubs = NULL;
+
+ if (qtex->size == 0)
+ {
+ if (qtex != (QUERYTYPE *) DatumGetPointer(qdata))
+ pfree(qtex);
+ if (qtsubs != (QUERYTYPE *) DatumGetPointer(sdata))
+ pfree(qtsubs);
continue;
}
- qex = QT2QTN( GETQUERY(qtex), GETOPERAND(qtex) );
+ qex = QT2QTN(GETQUERY(qtex), GETOPERAND(qtex));
- QTNTernary( qex );
- QTNSort( qex );
+ QTNTernary(qex);
+ QTNSort(qex);
- if ( qtsubs->size )
- qsubs = QT2QTN( GETQUERY(qtsubs), GETOPERAND(qtsubs) );
+ if (qtsubs->size)
+ qsubs = QT2QTN(GETQUERY(qtsubs), GETOPERAND(qtsubs));
- tree = findsubquery( tree, qex, SPIMemory, qsubs, NULL );
-
- QTNFree( qex );
- if ( qtex != (QUERYTYPE *) DatumGetPointer(qdata) )
- pfree( qtex );
- QTNFree( qsubs );
- if ( qtsubs != (QUERYTYPE *) DatumGetPointer(sdata) )
- pfree( qtsubs );
+ tree = findsubquery(tree, qex, SPIMemory, qsubs, NULL);
+
+ QTNFree(qex);
+ if (qtex != (QUERYTYPE *) DatumGetPointer(qdata))
+ pfree(qtex);
+ QTNFree(qsubs);
+ if (qtsubs != (QUERYTYPE *) DatumGetPointer(sdata))
+ pfree(qtsubs);
}
}
SPI_freetuptable(SPI_tuptable);
SPI_cursor_fetch(portal, true, 100);
}
-
+
SPI_freetuptable(SPI_tuptable);
SPI_cursor_close(portal);
SPI_freeplan(plan);
- SPI_finish();
+ SPI_finish();
- if ( tree ) {
- QTNBinary( tree );
- rewrited = QTN2QT( tree, PlainMemory );
- QTNFree( tree );
+ if (tree)
+ {
+ QTNBinary(tree);
+ rewrited = QTN2QT(tree, PlainMemory);
+ QTNFree(tree);
PG_FREE_IF_COPY(query, 0);
- } else {
+ }
+ else
+ {
rewrited->len = HDRSIZEQT;
rewrited->size = 0;
}
pfree(buf);
PG_FREE_IF_COPY(in, 1);
- PG_RETURN_POINTER( rewrited );
+ PG_RETURN_POINTER(rewrited);
}
PG_FUNCTION_INFO_V1(tsquery_rewrite_query);
-Datum tsquery_rewrite_query(PG_FUNCTION_ARGS);
+Datum tsquery_rewrite_query(PG_FUNCTION_ARGS);
Datum
-tsquery_rewrite_query(PG_FUNCTION_ARGS) {
- QUERYTYPE *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
- QUERYTYPE *ex = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
- QUERYTYPE *subst = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(2)));
- QUERYTYPE *rewrited = query;
- QTNode *tree, *qex, *subs = NULL;
-
- if ( query->size == 0 || ex->size == 0 ) {
- PG_FREE_IF_COPY(ex, 1);
- PG_FREE_IF_COPY(subst, 2);
- PG_RETURN_POINTER( rewrited );
- }
-
- tree = QT2QTN( GETQUERY(query), GETOPERAND(query) );
- QTNTernary( tree );
- QTNSort( tree );
-
- qex = QT2QTN( GETQUERY(ex), GETOPERAND(ex) );
- QTNTernary( qex );
- QTNSort( qex );
-
- if ( subst->size )
- subs = QT2QTN( GETQUERY(subst), GETOPERAND(subst) );
-
- tree = findsubquery( tree, qex, PlainMemory, subs, NULL );
- QTNFree( qex );
- QTNFree( subs );
-
- if ( !tree ) {
+tsquery_rewrite_query(PG_FUNCTION_ARGS)
+{
+ QUERYTYPE *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+ QUERYTYPE *ex = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
+ QUERYTYPE *subst = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(2)));
+ QUERYTYPE *rewrited = query;
+ QTNode *tree,
+ *qex,
+ *subs = NULL;
+
+ if (query->size == 0 || ex->size == 0)
+ {
+ PG_FREE_IF_COPY(ex, 1);
+ PG_FREE_IF_COPY(subst, 2);
+ PG_RETURN_POINTER(rewrited);
+ }
+
+ tree = QT2QTN(GETQUERY(query), GETOPERAND(query));
+ QTNTernary(tree);
+ QTNSort(tree);
+
+ qex = QT2QTN(GETQUERY(ex), GETOPERAND(ex));
+ QTNTernary(qex);
+ QTNSort(qex);
+
+ if (subst->size)
+ subs = QT2QTN(GETQUERY(subst), GETOPERAND(subst));
+
+ tree = findsubquery(tree, qex, PlainMemory, subs, NULL);
+ QTNFree(qex);
+ QTNFree(subs);
+
+ if (!tree)
+ {
rewrited->len = HDRSIZEQT;
rewrited->size = 0;
- PG_FREE_IF_COPY(ex, 1);
- PG_FREE_IF_COPY(subst, 2);
- PG_RETURN_POINTER( rewrited );
- } else {
- QTNBinary( tree );
- rewrited = QTN2QT( tree, PlainMemory );
- QTNFree( tree );
+ PG_FREE_IF_COPY(ex, 1);
+ PG_FREE_IF_COPY(subst, 2);
+ PG_RETURN_POINTER(rewrited);
+ }
+ else
+ {
+ QTNBinary(tree);
+ rewrited = QTN2QT(tree, PlainMemory);
+ QTNFree(tree);
}
- PG_FREE_IF_COPY(query, 0);
- PG_FREE_IF_COPY(ex, 1);
- PG_FREE_IF_COPY(subst, 2);
- PG_RETURN_POINTER( rewrited );
+ PG_FREE_IF_COPY(query, 0);
+ PG_FREE_IF_COPY(ex, 1);
+ PG_FREE_IF_COPY(subst, 2);
+ PG_RETURN_POINTER(rewrited);
}
-
#include "query_util.h"
PG_FUNCTION_INFO_V1(tsquery_numnode);
-Datum tsquery_numnode(PG_FUNCTION_ARGS);
+Datum tsquery_numnode(PG_FUNCTION_ARGS);
Datum
-tsquery_numnode(PG_FUNCTION_ARGS) {
+tsquery_numnode(PG_FUNCTION_ARGS)
+{
QUERYTYPE *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
- int nnode = query->size;
- PG_FREE_IF_COPY(query,0);
+ int nnode = query->size;
+
+ PG_FREE_IF_COPY(query, 0);
PG_RETURN_INT32(nnode);
}
-static QTNode*
-join_tsqueries(QUERYTYPE *a, QUERYTYPE *b) {
- QTNode *res=(QTNode*)palloc0( sizeof(QTNode) );
+static QTNode *
+join_tsqueries(QUERYTYPE * a, QUERYTYPE * b)
+{
+ QTNode *res = (QTNode *) palloc0(sizeof(QTNode));
res->flags |= QTN_NEEDFREE;
- res->valnode = (ITEM*)palloc0( sizeof(ITEM) );
+ res->valnode = (ITEM *) palloc0(sizeof(ITEM));
res->valnode->type = OPR;
- res->child = (QTNode**)palloc0( sizeof(QTNode*)*2 );
- res->child[0] = QT2QTN( GETQUERY(b), GETOPERAND(b) );
- res->child[1] = QT2QTN( GETQUERY(a), GETOPERAND(a) );
+ res->child = (QTNode **) palloc0(sizeof(QTNode *) * 2);
+ res->child[0] = QT2QTN(GETQUERY(b), GETOPERAND(b));
+ res->child[1] = QT2QTN(GETQUERY(a), GETOPERAND(a));
res->nchild = 2;
return res;
}
PG_FUNCTION_INFO_V1(tsquery_and);
-Datum tsquery_and(PG_FUNCTION_ARGS);
+Datum tsquery_and(PG_FUNCTION_ARGS);
Datum
-tsquery_and(PG_FUNCTION_ARGS) {
+tsquery_and(PG_FUNCTION_ARGS)
+{
QUERYTYPE *a = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
QUERYTYPE *b = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
- QTNode *res;
+ QTNode *res;
QUERYTYPE *query;
- if ( a->size == 0 ) {
- PG_FREE_IF_COPY(a,1);
+ if (a->size == 0)
+ {
+ PG_FREE_IF_COPY(a, 1);
PG_RETURN_POINTER(b);
- } else if ( b->size == 0 ) {
- PG_FREE_IF_COPY(b,1);
+ }
+ else if (b->size == 0)
+ {
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_POINTER(a);
- }
+ }
res = join_tsqueries(a, b);
res->valnode->val = '&';
- query = QTN2QT( res, PlainMemory );
+ query = QTN2QT(res, PlainMemory);
QTNFree(res);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_POINTER(query);
}
PG_FUNCTION_INFO_V1(tsquery_or);
-Datum tsquery_or(PG_FUNCTION_ARGS);
+Datum tsquery_or(PG_FUNCTION_ARGS);
Datum
-tsquery_or(PG_FUNCTION_ARGS) {
+tsquery_or(PG_FUNCTION_ARGS)
+{
QUERYTYPE *a = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
QUERYTYPE *b = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
- QTNode *res;
+ QTNode *res;
QUERYTYPE *query;
- if ( a->size == 0 ) {
- PG_FREE_IF_COPY(a,1);
+ if (a->size == 0)
+ {
+ PG_FREE_IF_COPY(a, 1);
PG_RETURN_POINTER(b);
- } else if ( b->size == 0 ) {
- PG_FREE_IF_COPY(b,1);
+ }
+ else if (b->size == 0)
+ {
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_POINTER(a);
- }
+ }
res = join_tsqueries(a, b);
res->valnode->val = '|';
- query = QTN2QT( res, PlainMemory );
+ query = QTN2QT(res, PlainMemory);
QTNFree(res);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_POINTER(query);
}
PG_FUNCTION_INFO_V1(tsquery_not);
-Datum tsquery_not(PG_FUNCTION_ARGS);
+Datum tsquery_not(PG_FUNCTION_ARGS);
Datum
-tsquery_not(PG_FUNCTION_ARGS) {
+tsquery_not(PG_FUNCTION_ARGS)
+{
QUERYTYPE *a = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
- QTNode *res;
+ QTNode *res;
QUERYTYPE *query;
- if ( a->size == 0 )
+ if (a->size == 0)
PG_RETURN_POINTER(a);
- res=(QTNode*)palloc0( sizeof(QTNode) );
+ res = (QTNode *) palloc0(sizeof(QTNode));
res->flags |= QTN_NEEDFREE;
- res->valnode = (ITEM*)palloc0( sizeof(ITEM) );
+ res->valnode = (ITEM *) palloc0(sizeof(ITEM));
res->valnode->type = OPR;
res->valnode->val = '!';
- res->child = (QTNode**)palloc0( sizeof(QTNode*) );
- res->child[0] = QT2QTN( GETQUERY(a), GETOPERAND(a) );
+ res->child = (QTNode **) palloc0(sizeof(QTNode *));
+ res->child[0] = QT2QTN(GETQUERY(a), GETOPERAND(a));
res->nchild = 1;
- query = QTN2QT( res, PlainMemory );
+ query = QTN2QT(res, PlainMemory);
QTNFree(res);
- PG_FREE_IF_COPY(a,0);
+ PG_FREE_IF_COPY(a, 0);
PG_RETURN_POINTER(query);
}
static int
-CompareTSQ( QUERYTYPE *a, QUERYTYPE *b ) {
- if ( a->size != b->size ) {
- return ( a->size < b->size ) ? -1 : 1;
- } else if ( a->len != b->len ) {
- return ( a->len < b->len ) ? -1 : 1;
- } else {
- QTNode *an = QT2QTN( GETQUERY(a), GETOPERAND(a) );
- QTNode *bn = QT2QTN( GETQUERY(b), GETOPERAND(b) );
- int res = QTNodeCompare(an, bn);
+CompareTSQ(QUERYTYPE * a, QUERYTYPE * b)
+{
+ if (a->size != b->size)
+ {
+ return (a->size < b->size) ? -1 : 1;
+ }
+ else if (a->len != b->len)
+ {
+ return (a->len < b->len) ? -1 : 1;
+ }
+ else
+ {
+ QTNode *an = QT2QTN(GETQUERY(a), GETOPERAND(a));
+ QTNode *bn = QT2QTN(GETQUERY(b), GETOPERAND(b));
+ int res = QTNodeCompare(an, bn);
QTNFree(an);
QTNFree(bn);
- return res;
+ return res;
}
return 0;
}
-PG_FUNCTION_INFO_V1(tsquery_cmp); \
-Datum tsquery_cmp(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(tsquery_cmp);
+\
+Datum tsquery_cmp(PG_FUNCTION_ARGS);
Datum
-tsquery_cmp(PG_FUNCTION_ARGS) {
+tsquery_cmp(PG_FUNCTION_ARGS)
+{
QUERYTYPE *a = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
QUERYTYPE *b = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
- int res = CompareTSQ(a,b);
+ int res = CompareTSQ(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_INT32(res);
}
-#define CMPFUNC( NAME, ACTION ) \
+#define CMPFUNC( NAME, ACTION ) \
PG_FUNCTION_INFO_V1(NAME); \
Datum NAME(PG_FUNCTION_ARGS); \
\
Datum \
-NAME(PG_FUNCTION_ARGS) { \
+NAME(PG_FUNCTION_ARGS) { \
QUERYTYPE *a = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0))); \
QUERYTYPE *b = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1))); \
int res = CompareTSQ(a,b); \
PG_RETURN_BOOL( ACTION ); \
}
-CMPFUNC( tsquery_lt, res <0 );
-CMPFUNC( tsquery_le, res<=0 );
-CMPFUNC( tsquery_eq, res==0 );
-CMPFUNC( tsquery_ge, res>=0 );
-CMPFUNC( tsquery_gt, res >0 );
-CMPFUNC( tsquery_ne, res!=0 );
-
-
-
+CMPFUNC(tsquery_lt, res < 0);
+CMPFUNC(tsquery_le, res <= 0);
+CMPFUNC(tsquery_eq, res == 0);
+CMPFUNC(tsquery_ge, res >= 0);
+CMPFUNC(tsquery_gt, res > 0);
+CMPFUNC(tsquery_ne, res != 0);
#include "executor/spi.h"
#include "query_util.h"
-QTNode*
-QT2QTN( ITEM *in, char *operand ) {
- QTNode *node = (QTNode*)palloc0( sizeof(QTNode) );
+QTNode *
+QT2QTN(ITEM * in, char *operand)
+{
+ QTNode *node = (QTNode *) palloc0(sizeof(QTNode));
node->valnode = in;
-
- if (in->type == OPR) {
- node->child = (QTNode**)palloc0( sizeof(QTNode*) * 2 );
- node->child[0] = QT2QTN( in + 1, operand );
+
+ if (in->type == OPR)
+ {
+ node->child = (QTNode **) palloc0(sizeof(QTNode *) * 2);
+ node->child[0] = QT2QTN(in + 1, operand);
node->sign = node->child[0]->sign;
if (in->val == (int4) '!')
node->nchild = 1;
- else {
+ else
+ {
node->nchild = 2;
- node->child[1] = QT2QTN( in + in->left, operand );
+ node->child[1] = QT2QTN(in + in->left, operand);
node->sign |= node->child[1]->sign;
}
- } else if ( operand ) {
+ }
+ else if (operand)
+ {
node->word = operand + in->distance;
- node->sign = 1 << ( in->val % 32 );
+ node->sign = 1 << (in->val % 32);
}
-
- return node;
+
+ return node;
}
-void
-QTNFree( QTNode* in ) {
- if ( !in )
+void
+QTNFree(QTNode * in)
+{
+ if (!in)
return;
- if ( in->valnode->type == VAL && in->word && (in->flags & QTN_WORDFREE) !=0 )
- pfree( in->word );
+ if (in->valnode->type == VAL && in->word && (in->flags & QTN_WORDFREE) != 0)
+ pfree(in->word);
- if ( in->child ) {
- if ( in->valnode ) {
- if ( in->valnode->type == OPR && in->nchild > 0 ) {
- int i;
- for (i=0;i<in->nchild;i++)
- QTNFree( in->child[i] );
+ if (in->child)
+ {
+ if (in->valnode)
+ {
+ if (in->valnode->type == OPR && in->nchild > 0)
+ {
+ int i;
+
+ for (i = 0; i < in->nchild; i++)
+ QTNFree(in->child[i]);
}
- if ( in->flags & QTN_NEEDFREE )
- pfree( in->valnode );
+ if (in->flags & QTN_NEEDFREE)
+ pfree(in->valnode);
}
- pfree( in->child );
+ pfree(in->child);
}
- pfree( in );
+ pfree(in);
}
int
-QTNodeCompare( QTNode *an, QTNode *bn ) {
- if ( an->valnode->type != bn->valnode->type )
- return ( an->valnode->type > bn->valnode->type ) ? -1 : 1;
- else if ( an->valnode->val != bn->valnode->val )
- return ( an->valnode->val > bn->valnode->val ) ? -1 : 1;
- else if ( an->valnode->type == VAL ) {
- if ( an->valnode->length == bn->valnode->length )
- return strncmp( an->word, bn->word, an->valnode->length );
- else
- return ( an->valnode->length > bn->valnode->length ) ? -1 : 1;
- } else if ( an->nchild != bn->nchild ) {
- return ( an->nchild > bn->nchild ) ? -1 : 1;
- } else {
- int i,res;
-
- for( i=0; i<an->nchild; i++ )
- if ( (res=QTNodeCompare(an->child[i], bn->child[i]))!=0 )
+QTNodeCompare(QTNode * an, QTNode * bn)
+{
+ if (an->valnode->type != bn->valnode->type)
+ return (an->valnode->type > bn->valnode->type) ? -1 : 1;
+ else if (an->valnode->val != bn->valnode->val)
+ return (an->valnode->val > bn->valnode->val) ? -1 : 1;
+ else if (an->valnode->type == VAL)
+ {
+ if (an->valnode->length == bn->valnode->length)
+ return strncmp(an->word, bn->word, an->valnode->length);
+ else
+ return (an->valnode->length > bn->valnode->length) ? -1 : 1;
+ }
+ else if (an->nchild != bn->nchild)
+ {
+ return (an->nchild > bn->nchild) ? -1 : 1;
+ }
+ else
+ {
+ int i,
+ res;
+
+ for (i = 0; i < an->nchild; i++)
+ if ((res = QTNodeCompare(an->child[i], bn->child[i])) != 0)
return res;
- }
-
+ }
+
return 0;
}
static int
-cmpQTN( const void *a, const void *b ) {
- return QTNodeCompare( *(QTNode**)a, *(QTNode**)b );
+cmpQTN(const void *a, const void *b)
+{
+ return QTNodeCompare(*(QTNode **) a, *(QTNode **) b);
}
-
-void
-QTNSort( QTNode* in ) {
- int i;
- if ( in->valnode->type != OPR )
+void
+QTNSort(QTNode * in)
+{
+ int i;
+
+ if (in->valnode->type != OPR)
return;
-
- for (i=0;i<in->nchild;i++)
- QTNSort( in->child[i] );
- if ( in->nchild > 1 )
- qsort((void *) in->child, in->nchild, sizeof(QTNode*), cmpQTN);
+
+ for (i = 0; i < in->nchild; i++)
+ QTNSort(in->child[i]);
+ if (in->nchild > 1)
+ qsort((void *) in->child, in->nchild, sizeof(QTNode *), cmpQTN);
}
-bool
-QTNEq( QTNode* a, QTNode* b ) {
- uint32 sign = a->sign & b->sign;
- if ( !(sign == a->sign && sign == b->sign) )
+bool
+QTNEq(QTNode * a, QTNode * b)
+{
+ uint32 sign = a->sign & b->sign;
+
+ if (!(sign == a->sign && sign == b->sign))
return 0;
- return ( QTNodeCompare(a,b) == 0 ) ? true : false;
+ return (QTNodeCompare(a, b) == 0) ? true : false;
}
-void
-QTNTernary( QTNode* in ) {
- int i;
+void
+QTNTernary(QTNode * in)
+{
+ int i;
- if ( in->valnode->type != OPR )
+ if (in->valnode->type != OPR)
return;
- for (i=0;i<in->nchild;i++)
- QTNTernary( in->child[i] );
+ for (i = 0; i < in->nchild; i++)
+ QTNTernary(in->child[i]);
+
+ for (i = 0; i < in->nchild; i++)
+ {
+ if (in->valnode->type == in->child[i]->valnode->type && in->valnode->val == in->child[i]->valnode->val)
+ {
+ QTNode *cc = in->child[i];
+ int oldnchild = in->nchild;
- for (i=0;i<in->nchild;i++) {
- if ( in->valnode->type == in->child[i]->valnode->type && in->valnode->val == in->child[i]->valnode->val ) {
- QTNode* cc = in->child[i];
- int oldnchild = in->nchild;
+ in->nchild += cc->nchild - 1;
+ in->child = (QTNode **) repalloc(in->child, in->nchild * sizeof(QTNode *));
- in->nchild += cc->nchild-1;
- in->child = (QTNode**)repalloc( in->child, in->nchild * sizeof(QTNode*) );
-
- if ( i+1 != oldnchild )
- memmove( in->child + i + cc->nchild, in->child + i + 1,
- (oldnchild-i-1)*sizeof(QTNode*) );
+ if (i + 1 != oldnchild)
+ memmove(in->child + i + cc->nchild, in->child + i + 1,
+ (oldnchild - i - 1) * sizeof(QTNode *));
- memcpy( in->child + i, cc->child, cc->nchild * sizeof(QTNode*) );
- i += cc->nchild-1;
+ memcpy(in->child + i, cc->child, cc->nchild * sizeof(QTNode *));
+ i += cc->nchild - 1;
pfree(cc);
- }
+ }
}
}
-void
-QTNBinary( QTNode* in ) {
- int i;
+void
+QTNBinary(QTNode * in)
+{
+ int i;
- if ( in->valnode->type != OPR )
+ if (in->valnode->type != OPR)
return;
- for (i=0;i<in->nchild;i++)
- QTNBinary( in->child[i] );
+ for (i = 0; i < in->nchild; i++)
+ QTNBinary(in->child[i]);
+
+ if (in->nchild <= 2)
+ return;
- if ( in->nchild <= 2 )
- return;
+ while (in->nchild > 2)
+ {
+ QTNode *nn = (QTNode *) palloc0(sizeof(QTNode));
- while( in->nchild > 2 ) {
- QTNode *nn = (QTNode*)palloc0( sizeof(QTNode) );
- nn->valnode = (ITEM*)palloc0( sizeof(ITEM) );
- nn->child = (QTNode**)palloc0( sizeof(QTNode*) * 2 );
+ nn->valnode = (ITEM *) palloc0(sizeof(ITEM));
+ nn->child = (QTNode **) palloc0(sizeof(QTNode *) * 2);
nn->nchild = 2;
nn->flags = QTN_NEEDFREE;
nn->valnode->val = in->valnode->val;
in->child[0] = nn;
- in->child[1] = in->child[ in->nchild-1 ];
+ in->child[1] = in->child[in->nchild - 1];
in->nchild--;
- }
+ }
}
static void
-cntsize(QTNode *in, int4 *sumlen, int4 *nnode) {
+cntsize(QTNode * in, int4 *sumlen, int4 *nnode)
+{
*nnode += 1;
- if ( in->valnode->type == OPR ) {
- int i;
- for (i=0;i<in->nchild;i++)
+ if (in->valnode->type == OPR)
+ {
+ int i;
+
+ for (i = 0; i < in->nchild; i++)
cntsize(in->child[i], sumlen, nnode);
- } else {
- *sumlen += in->valnode->length+1;
+ }
+ else
+ {
+ *sumlen += in->valnode->length + 1;
}
}
-typedef struct {
- ITEM *curitem;
- char *operand;
- char *curoperand;
-} QTN2QTState;
+typedef struct
+{
+ ITEM *curitem;
+ char *operand;
+ char *curoperand;
+} QTN2QTState;
static void
-fillQT( QTN2QTState *state, QTNode *in ) {
+fillQT(QTN2QTState * state, QTNode * in)
+{
*(state->curitem) = *(in->valnode);
-
- if ( in->valnode->type == VAL ) {
- memcpy( state->curoperand, in->word, in->valnode->length );
+
+ if (in->valnode->type == VAL)
+ {
+ memcpy(state->curoperand, in->word, in->valnode->length);
state->curitem->distance = state->curoperand - state->operand;
- state->curoperand[ in->valnode->length ] = '\0';
- state->curoperand += in->valnode->length + 1;
+ state->curoperand[in->valnode->length] = '\0';
+ state->curoperand += in->valnode->length + 1;
state->curitem++;
- } else {
- ITEM *curitem = state->curitem;
+ }
+ else
+ {
+ ITEM *curitem = state->curitem;
- Assert( in->nchild<=2 );
+ Assert(in->nchild <= 2);
state->curitem++;
- fillQT( state, in->child[0] );
+ fillQT(state, in->child[0]);
- if ( in->nchild==2 ) {
+ if (in->nchild == 2)
+ {
curitem->left = state->curitem - curitem;
- fillQT( state, in->child[1] );
- }
+ fillQT(state, in->child[1]);
+ }
}
-}
+}
-QUERYTYPE*
-QTN2QT( QTNode* in, MemoryType memtype ) {
- QUERYTYPE *out;
- int len;
- int sumlen=0, nnode=0;
- QTN2QTState state;
+QUERYTYPE *
+QTN2QT(QTNode * in, MemoryType memtype)
+{
+ QUERYTYPE *out;
+ int len;
+ int sumlen = 0,
+ nnode = 0;
+ QTN2QTState state;
cntsize(in, &sumlen, &nnode);
- len = COMPUTESIZE( nnode, sumlen );
+ len = COMPUTESIZE(nnode, sumlen);
- out = (QUERYTYPE*)MEMALLOC(memtype, len);
- out->len = len;
- out->size = nnode;
+ out = (QUERYTYPE *) MEMALLOC(memtype, len);
+ out->len = len;
+ out->size = nnode;
- state.curitem = GETQUERY( out );
- state.operand = state.curoperand = GETOPERAND( out );
+ state.curitem = GETQUERY(out);
+ state.operand = state.curoperand = GETOPERAND(out);
- fillQT( &state, in );
- return out;
+ fillQT(&state, in);
+ return out;
}
QTNode *
-QTNCopy( QTNode* in, MemoryType memtype ) {
- QTNode *out = (QTNode*)MEMALLOC( memtype, sizeof(QTNode) );
+QTNCopy(QTNode * in, MemoryType memtype)
+{
+ QTNode *out = (QTNode *) MEMALLOC(memtype, sizeof(QTNode));
*out = *in;
- out->valnode = (ITEM*)MEMALLOC( memtype, sizeof(ITEM) );
+ out->valnode = (ITEM *) MEMALLOC(memtype, sizeof(ITEM));
*(out->valnode) = *(in->valnode);
out->flags |= QTN_NEEDFREE;
-
- if ( in->valnode->type == VAL ) {
- out->word = MEMALLOC( memtype, in->valnode->length + 1 );
- memcpy( out->word, in->word, in->valnode->length );
- out->word[ in->valnode->length ] = '\0';
+
+ if (in->valnode->type == VAL)
+ {
+ out->word = MEMALLOC(memtype, in->valnode->length + 1);
+ memcpy(out->word, in->word, in->valnode->length);
+ out->word[in->valnode->length] = '\0';
out->flags |= QTN_WORDFREE;
- } else {
- int i;
+ }
+ else
+ {
+ int i;
- out->child = (QTNode**)MEMALLOC( memtype, sizeof(QTNode*) * in->nchild );
+ out->child = (QTNode **) MEMALLOC(memtype, sizeof(QTNode *) * in->nchild);
- for(i=0;i<in->nchild;i++)
- out->child[i] = QTNCopy( in->child[i], memtype );
- }
+ for (i = 0; i < in->nchild; i++)
+ out->child[i] = QTNCopy(in->child[i], memtype);
+ }
return out;
}
#include "query.h"
-typedef struct QTNode {
- ITEM *valnode;
- uint32 flags;
- int4 nchild;
- char *word;
- uint32 sign;
- struct QTNode **child;
-} QTNode;
-
-#define QTN_NEEDFREE 0x01
-#define QTN_NOCHANGE 0x02
-#define QTN_WORDFREE 0x04
-
-typedef enum {
+typedef struct QTNode
+{
+ ITEM *valnode;
+ uint32 flags;
+ int4 nchild;
+ char *word;
+ uint32 sign;
+ struct QTNode **child;
+} QTNode;
+
+#define QTN_NEEDFREE 0x01
+#define QTN_NOCHANGE 0x02
+#define QTN_WORDFREE 0x04
+
+typedef enum
+{
PlainMemory,
SPIMemory,
AggMemory
-} MemoryType;
+} MemoryType;
-QTNode* QT2QTN( ITEM *in, char *operand );
-QUERYTYPE* QTN2QT( QTNode* in, MemoryType memtype );
-void QTNFree( QTNode* in );
-void QTNSort( QTNode* in );
-void QTNTernary( QTNode* in );
-void QTNBinary( QTNode* in );
-int QTNodeCompare( QTNode *an, QTNode *bn );
-QTNode* QTNCopy( QTNode* in, MemoryType memtype);
-bool QTNEq( QTNode* a, QTNode* b );
+QTNode *QT2QTN(ITEM * in, char *operand);
+QUERYTYPE *QTN2QT(QTNode * in, MemoryType memtype);
+void QTNFree(QTNode * in);
+void QTNSort(QTNode * in);
+void QTNTernary(QTNode * in);
+void QTNBinary(QTNode * in);
+int QTNodeCompare(QTNode * an, QTNode * bn);
+QTNode *QTNCopy(QTNode * in, MemoryType memtype);
+bool QTNEq(QTNode * a, QTNode * b);
-extern MemoryContext AggregateContext;
+extern MemoryContext AggregateContext;
-#define MEMALLOC(us, s) ( ((us)==SPIMemory) ? SPI_palloc(s) : ( ( (us)==PlainMemory ) ? palloc(s) : MemoryContextAlloc(AggregateContext, (s)) ) )
-#define MEMFREE(us, p) ( ((us)==SPIMemory) ? SPI_pfree(p) : pfree(p) )
+#define MEMALLOC(us, s) ( ((us)==SPIMemory) ? SPI_palloc(s) : ( ( (us)==PlainMemory ) ? palloc(s) : MemoryContextAlloc(AggregateContext, (s)) ) )
+#define MEMFREE(us, p) ( ((us)==SPIMemory) ? SPI_pfree(p) : pfree(p) )
#endif
for (i = 0; i < size; i++)
{
- float resj,wjm;
- int4 jm;
+ float resj,
+ wjm;
+ int4 jm;
+
entry = find_wordentry(t, q, item[i]);
if (!entry)
continue;
post = POSNULL + 1;
}
- resj = 0.0;
- wjm = -1.0;
- jm = 0;
- for (j = 0; j < dimt; j++)
- {
- resj = resj + wpos(post[j])/((j+1)*(j+1));
- if ( wpos(post[j]) > wjm ) {
- wjm = wpos(post[j]);
- jm = j;
- }
- }
-/*
- limit (sum(i/i^2),i->inf) = pi^2/6
- resj = sum(wi/i^2),i=1,noccurence,
- wi - should be sorted desc,
- don't sort for now, just choose maximum weight. This should be corrected
+ resj = 0.0;
+ wjm = -1.0;
+ jm = 0;
+ for (j = 0; j < dimt; j++)
+ {
+ resj = resj + wpos(post[j]) / ((j + 1) * (j + 1));
+ if (wpos(post[j]) > wjm)
+ {
+ wjm = wpos(post[j]);
+ jm = j;
+ }
+ }
+/*
+ limit (sum(i/i^2),i->inf) = pi^2/6
+ resj = sum(wi/i^2),i=1,noccurence,
+ wi - should be sorted desc,
+ don't sort for now, just choose maximum weight. This should be corrected
Oleg Bartunov
*/
- res = res + ( wjm + resj - wjm/((jm+1)*(jm+1)))/1.64493406685;
+ res = res + (wjm + resj - wjm / ((jm + 1) * (jm + 1))) / 1.64493406685;
}
- if ( size > 0 )
- res = res /size;
+ if (size > 0)
+ res = res / size;
pfree(item);
return res;
}
typedef struct
{
- ITEM **item;
+ ITEM **item;
int16 nitem;
bool needfree;
int32 pos;
}
static bool
-checkcondition_ITEM(void *checkval, ITEM * val) {
- return (bool)(val->istrue);
+checkcondition_ITEM(void *checkval, ITEM * val)
+{
+ return (bool) (val->istrue);
}
static void
-reset_istrue_flag(QUERYTYPE *query) {
- ITEM *item = GETQUERY(query);
- int i;
+reset_istrue_flag(QUERYTYPE * query)
+{
+ ITEM *item = GETQUERY(query);
+ int i;
/* reset istrue flag */
- for(i = 0; i < query->size; i++) {
- if ( item->type == VAL )
+ for (i = 0; i < query->size; i++)
+ {
+ if (item->type == VAL)
item->istrue = 0;
item++;
}
}
-
+
static bool
Cover(DocRepresentation * doc, int len, QUERYTYPE * query, int *pos, int *p, int *q)
{
DocRepresentation *ptr;
int lastpos = *pos;
- int i;
- bool found=false;
+ int i;
+ bool found = false;
reset_istrue_flag(query);
-
+
*p = 0x7fffffff;
*q = 0;
ptr = doc + *pos;
/* find upper bound of cover from current position, move up */
- while (ptr - doc < len) {
- for(i=0;i<ptr->nitem;i++)
+ while (ptr - doc < len)
+ {
+ for (i = 0; i < ptr->nitem; i++)
ptr->item[i]->istrue = 1;
- if ( TS_execute(GETQUERY(query), NULL, false, checkcondition_ITEM) ) {
- if (ptr->pos > *q) {
+ if (TS_execute(GETQUERY(query), NULL, false, checkcondition_ITEM))
+ {
+ if (ptr->pos > *q)
+ {
*q = ptr->pos;
lastpos = ptr - doc;
found = true;
- }
+ }
break;
}
ptr++;
}
- if (!found)
+ if (!found)
return false;
reset_istrue_flag(query);
ptr = doc + lastpos;
/* find lower bound of cover from founded upper bound, move down */
- while (ptr >= doc ) {
- for(i=0;i<ptr->nitem;i++)
+ while (ptr >= doc)
+ {
+ for (i = 0; i < ptr->nitem; i++)
ptr->item[i]->istrue = 1;
- if ( TS_execute(GETQUERY(query), NULL, true, checkcondition_ITEM) ) {
- if (ptr->pos < *p)
+ if (TS_execute(GETQUERY(query), NULL, true, checkcondition_ITEM))
+ {
+ if (ptr->pos < *p)
*p = ptr->pos;
break;
}
ptr--;
}
- if ( *p <= *q ) {
- /* set position for next try to next lexeme after begining of founded cover */
- *pos= (ptr-doc) + 1;
+ if (*p <= *q)
+ {
+ /*
+ * set position for next try to next lexeme after begining of founded
+ * cover
+ */
+ *pos = (ptr - doc) + 1;
return true;
}
(*pos)++;
- return Cover( doc, len, query, pos, p, q );
+ return Cover(doc, len, query, pos, p, q);
}
static DocRepresentation *
for (j = 0; j < dimt; j++)
{
- if ( j == 0 ) {
- ITEM *kptr, *iptr = item+i;
- int k;
-
+ if (j == 0)
+ {
+ ITEM *kptr,
+ *iptr = item + i;
+ int k;
+
doc[cur].needfree = false;
doc[cur].nitem = 0;
- doc[cur].item = (ITEM**)palloc( sizeof(ITEM*) * query->size );
+ doc[cur].item = (ITEM **) palloc(sizeof(ITEM *) * query->size);
- for(k=0; k < query->size; k++) {
- kptr = item+k;
- if ( k==i || ( item[k].type == VAL && compareITEM( &kptr, &iptr ) == 0 ) ) {
- doc[cur].item[ doc[cur].nitem ] = item+k;
+ for (k = 0; k < query->size; k++)
+ {
+ kptr = item + k;
+ if (k == i || (item[k].type == VAL && compareITEM(&kptr, &iptr) == 0))
+ {
+ doc[cur].item[doc[cur].nitem] = item + k;
doc[cur].nitem++;
kptr->istrue = 1;
}
- }
- } else {
+ }
+ }
+ else
+ {
doc[cur].needfree = false;
- doc[cur].nitem = doc[cur-1].nitem;
- doc[cur].item = doc[cur-1].item;
+ doc[cur].nitem = doc[cur - 1].nitem;
+ doc[cur].item = doc[cur - 1].item;
}
doc[cur].pos = WEP_GETPOS(post[j]);
cur++;
len,
cur,
i,
- doclen=0;
+ doclen = 0;
doc = get_docrep(txt, query, &doclen);
if (!doc)
elog(ERROR, "unrecognized normalization method: %d", method);
}
- for(i=0;i<doclen;i++)
- if ( doc[i].needfree )
- pfree( doc[i].item );
+ for (i = 0; i < doclen; i++)
+ if (doc[i].needfree)
+ pfree(doc[i].item);
pfree(doc);
PG_FREE_IF_COPY(txt, 1);
PG_FREE_IF_COPY(query, 2);
VARATT_SIZEP(out) = cptr - ((char *) out);
pfree(dw);
- for(i=0;i<rlen;i++)
- if ( doc[i].needfree )
- pfree( doc[i].item );
+ for (i = 0; i < rlen; i++)
+ if (doc[i].needfree)
+ pfree(doc[i].item);
pfree(doc);
PG_FREE_IF_COPY(txt, 0);
int S_size;
int I_size;
int B_size;
- symbol **S;
+ symbol **S;
int *I;
symbol *B;
};
static struct among a_0[2] =
{
- /* 0 */ {6, s_0_0, -1, -1, 0},
- /* 1 */ {5, s_0_1, -1, -1, 0}
+ /* 0 */ {6, s_0_0, -1, -1, 0},
+ /* 1 */ {5, s_0_1, -1, -1, 0}
};
static symbol s_1_0[1] = {'\''};
static struct among a_1[3] =
{
- /* 0 */ {1, s_1_0, -1, 1, 0},
- /* 1 */ {3, s_1_1, 0, 1, 0},
- /* 2 */ {2, s_1_2, -1, 1, 0}
+ /* 0 */ {1, s_1_0, -1, 1, 0},
+ /* 1 */ {3, s_1_1, 0, 1, 0},
+ /* 2 */ {2, s_1_2, -1, 1, 0}
};
static symbol s_2_0[3] = {'i', 'e', 'd'};
static struct among a_2[6] =
{
- /* 0 */ {3, s_2_0, -1, 2, 0},
- /* 1 */ {1, s_2_1, -1, 3, 0},
- /* 2 */ {3, s_2_2, 1, 2, 0},
- /* 3 */ {4, s_2_3, 1, 1, 0},
- /* 4 */ {2, s_2_4, 1, -1, 0},
- /* 5 */ {2, s_2_5, 1, -1, 0}
+ /* 0 */ {3, s_2_0, -1, 2, 0},
+ /* 1 */ {1, s_2_1, -1, 3, 0},
+ /* 2 */ {3, s_2_2, 1, 2, 0},
+ /* 3 */ {4, s_2_3, 1, 1, 0},
+ /* 4 */ {2, s_2_4, 1, -1, 0},
+ /* 5 */ {2, s_2_5, 1, -1, 0}
};
static symbol s_3_1[2] = {'b', 'b'};
static struct among a_3[13] =
{
- /* 0 */ {0, 0, -1, 3, 0},
- /* 1 */ {2, s_3_1, 0, 2, 0},
- /* 2 */ {2, s_3_2, 0, 2, 0},
- /* 3 */ {2, s_3_3, 0, 2, 0},
- /* 4 */ {2, s_3_4, 0, 2, 0},
- /* 5 */ {2, s_3_5, 0, 1, 0},
- /* 6 */ {2, s_3_6, 0, 2, 0},
- /* 7 */ {2, s_3_7, 0, 2, 0},
- /* 8 */ {2, s_3_8, 0, 2, 0},
- /* 9 */ {2, s_3_9, 0, 2, 0},
+ /* 0 */ {0, 0, -1, 3, 0},
+ /* 1 */ {2, s_3_1, 0, 2, 0},
+ /* 2 */ {2, s_3_2, 0, 2, 0},
+ /* 3 */ {2, s_3_3, 0, 2, 0},
+ /* 4 */ {2, s_3_4, 0, 2, 0},
+ /* 5 */ {2, s_3_5, 0, 1, 0},
+ /* 6 */ {2, s_3_6, 0, 2, 0},
+ /* 7 */ {2, s_3_7, 0, 2, 0},
+ /* 8 */ {2, s_3_8, 0, 2, 0},
+ /* 9 */ {2, s_3_9, 0, 2, 0},
/* 10 */ {2, s_3_10, 0, 1, 0},
/* 11 */ {2, s_3_11, 0, 2, 0},
/* 12 */ {2, s_3_12, 0, 1, 0}
static struct among a_4[6] =
{
- /* 0 */ {2, s_4_0, -1, 2, 0},
- /* 1 */ {3, s_4_1, 0, 1, 0},
- /* 2 */ {3, s_4_2, -1, 2, 0},
- /* 3 */ {4, s_4_3, -1, 2, 0},
- /* 4 */ {5, s_4_4, 3, 1, 0},
- /* 5 */ {5, s_4_5, -1, 2, 0}
+ /* 0 */ {2, s_4_0, -1, 2, 0},
+ /* 1 */ {3, s_4_1, 0, 1, 0},
+ /* 2 */ {3, s_4_2, -1, 2, 0},
+ /* 3 */ {4, s_4_3, -1, 2, 0},
+ /* 4 */ {5, s_4_4, 3, 1, 0},
+ /* 5 */ {5, s_4_5, -1, 2, 0}
};
static symbol s_5_0[4] = {'a', 'n', 'c', 'i'};
static struct among a_5[24] =
{
- /* 0 */ {4, s_5_0, -1, 3, 0},
- /* 1 */ {4, s_5_1, -1, 2, 0},
- /* 2 */ {3, s_5_2, -1, 13, 0},
- /* 3 */ {2, s_5_3, -1, 16, 0},
- /* 4 */ {3, s_5_4, 3, 12, 0},
- /* 5 */ {4, s_5_5, 4, 4, 0},
- /* 6 */ {4, s_5_6, 3, 8, 0},
- /* 7 */ {5, s_5_7, 3, 14, 0},
- /* 8 */ {6, s_5_8, 3, 15, 0},
- /* 9 */ {5, s_5_9, 3, 10, 0},
+ /* 0 */ {4, s_5_0, -1, 3, 0},
+ /* 1 */ {4, s_5_1, -1, 2, 0},
+ /* 2 */ {3, s_5_2, -1, 13, 0},
+ /* 3 */ {2, s_5_3, -1, 16, 0},
+ /* 4 */ {3, s_5_4, 3, 12, 0},
+ /* 5 */ {4, s_5_5, 4, 4, 0},
+ /* 6 */ {4, s_5_6, 3, 8, 0},
+ /* 7 */ {5, s_5_7, 3, 14, 0},
+ /* 8 */ {6, s_5_8, 3, 15, 0},
+ /* 9 */ {5, s_5_9, 3, 10, 0},
/* 10 */ {5, s_5_10, 3, 5, 0},
/* 11 */ {5, s_5_11, -1, 8, 0},
/* 12 */ {6, s_5_12, -1, 12, 0},
static struct among a_6[9] =
{
- /* 0 */ {5, s_6_0, -1, 4, 0},
- /* 1 */ {5, s_6_1, -1, 6, 0},
- /* 2 */ {5, s_6_2, -1, 3, 0},
- /* 3 */ {5, s_6_3, -1, 4, 0},
- /* 4 */ {4, s_6_4, -1, 4, 0},
- /* 5 */ {6, s_6_5, -1, 1, 0},
- /* 6 */ {7, s_6_6, 5, 2, 0},
- /* 7 */ {3, s_6_7, -1, 5, 0},
- /* 8 */ {4, s_6_8, -1, 5, 0}
+ /* 0 */ {5, s_6_0, -1, 4, 0},
+ /* 1 */ {5, s_6_1, -1, 6, 0},
+ /* 2 */ {5, s_6_2, -1, 3, 0},
+ /* 3 */ {5, s_6_3, -1, 4, 0},
+ /* 4 */ {4, s_6_4, -1, 4, 0},
+ /* 5 */ {6, s_6_5, -1, 1, 0},
+ /* 6 */ {7, s_6_6, 5, 2, 0},
+ /* 7 */ {3, s_6_7, -1, 5, 0},
+ /* 8 */ {4, s_6_8, -1, 5, 0}
};
static symbol s_7_0[2] = {'i', 'c'};
static struct among a_7[18] =
{
- /* 0 */ {2, s_7_0, -1, 1, 0},
- /* 1 */ {4, s_7_1, -1, 1, 0},
- /* 2 */ {4, s_7_2, -1, 1, 0},
- /* 3 */ {4, s_7_3, -1, 1, 0},
- /* 4 */ {4, s_7_4, -1, 1, 0},
- /* 5 */ {3, s_7_5, -1, 1, 0},
- /* 6 */ {3, s_7_6, -1, 1, 0},
- /* 7 */ {3, s_7_7, -1, 1, 0},
- /* 8 */ {3, s_7_8, -1, 1, 0},
- /* 9 */ {2, s_7_9, -1, 1, 0},
+ /* 0 */ {2, s_7_0, -1, 1, 0},
+ /* 1 */ {4, s_7_1, -1, 1, 0},
+ /* 2 */ {4, s_7_2, -1, 1, 0},
+ /* 3 */ {4, s_7_3, -1, 1, 0},
+ /* 4 */ {4, s_7_4, -1, 1, 0},
+ /* 5 */ {3, s_7_5, -1, 1, 0},
+ /* 6 */ {3, s_7_6, -1, 1, 0},
+ /* 7 */ {3, s_7_7, -1, 1, 0},
+ /* 8 */ {3, s_7_8, -1, 1, 0},
+ /* 9 */ {2, s_7_9, -1, 1, 0},
/* 10 */ {3, s_7_10, -1, 1, 0},
/* 11 */ {3, s_7_11, -1, 2, 0},
/* 12 */ {2, s_7_12, -1, 1, 0},
static struct among a_8[2] =
{
- /* 0 */ {1, s_8_0, -1, 1, 0},
- /* 1 */ {1, s_8_1, -1, 2, 0}
+ /* 0 */ {1, s_8_0, -1, 1, 0},
+ /* 1 */ {1, s_8_1, -1, 2, 0}
};
static symbol s_9_0[7] = {'s', 'u', 'c', 'c', 'e', 'e', 'd'};
static struct among a_9[8] =
{
- /* 0 */ {7, s_9_0, -1, -1, 0},
- /* 1 */ {7, s_9_1, -1, -1, 0},
- /* 2 */ {6, s_9_2, -1, -1, 0},
- /* 3 */ {7, s_9_3, -1, -1, 0},
- /* 4 */ {6, s_9_4, -1, -1, 0},
- /* 5 */ {7, s_9_5, -1, -1, 0},
- /* 6 */ {7, s_9_6, -1, -1, 0},
- /* 7 */ {6, s_9_7, -1, -1, 0}
+ /* 0 */ {7, s_9_0, -1, -1, 0},
+ /* 1 */ {7, s_9_1, -1, -1, 0},
+ /* 2 */ {6, s_9_2, -1, -1, 0},
+ /* 3 */ {7, s_9_3, -1, -1, 0},
+ /* 4 */ {6, s_9_4, -1, -1, 0},
+ /* 5 */ {7, s_9_5, -1, -1, 0},
+ /* 6 */ {7, s_9_6, -1, -1, 0},
+ /* 7 */ {6, s_9_7, -1, -1, 0}
};
static symbol s_10_0[5] = {'a', 'n', 'd', 'e', 's'};
static struct among a_10[18] =
{
- /* 0 */ {5, s_10_0, -1, -1, 0},
- /* 1 */ {5, s_10_1, -1, -1, 0},
- /* 2 */ {4, s_10_2, -1, -1, 0},
- /* 3 */ {6, s_10_3, -1, -1, 0},
- /* 4 */ {5, s_10_4, -1, 3, 0},
- /* 5 */ {5, s_10_5, -1, 9, 0},
- /* 6 */ {6, s_10_6, -1, 7, 0},
- /* 7 */ {4, s_10_7, -1, -1, 0},
- /* 8 */ {4, s_10_8, -1, 6, 0},
- /* 9 */ {5, s_10_9, -1, 4, 0},
+ /* 0 */ {5, s_10_0, -1, -1, 0},
+ /* 1 */ {5, s_10_1, -1, -1, 0},
+ /* 2 */ {4, s_10_2, -1, -1, 0},
+ /* 3 */ {6, s_10_3, -1, -1, 0},
+ /* 4 */ {5, s_10_4, -1, 3, 0},
+ /* 5 */ {5, s_10_5, -1, 9, 0},
+ /* 6 */ {6, s_10_6, -1, 7, 0},
+ /* 7 */ {4, s_10_7, -1, -1, 0},
+ /* 8 */ {4, s_10_8, -1, 6, 0},
+ /* 9 */ {5, s_10_9, -1, 4, 0},
/* 10 */ {4, s_10_10, -1, -1, 0},
/* 11 */ {4, s_10_11, -1, 10, 0},
/* 12 */ {6, s_10_12, -1, 11, 0},
return 1;
}
-extern struct SN_env *english_ISO_8859_1_create_env(void)
+extern struct SN_env *
+english_ISO_8859_1_create_env(void)
{
return SN_create_env(0, 2, 1);
}
-extern void english_ISO_8859_1_close_env(struct SN_env * z)
+extern void
+english_ISO_8859_1_close_env(struct SN_env * z)
{
SN_close_env(z);
}
{
#endif
- extern struct SN_env *english_ISO_8859_1_create_env(void);
- extern void english_ISO_8859_1_close_env(struct SN_env * z);
+extern struct SN_env *english_ISO_8859_1_create_env(void);
+extern void english_ISO_8859_1_close_env(struct SN_env * z);
- extern int english_ISO_8859_1_stem(struct SN_env * z);
+extern int english_ISO_8859_1_stem(struct SN_env * z);
#ifdef __cplusplus
}
static struct among a_0[9] =
{
- /* 0 */ {3, s_0_0, -1, 1, 0},
- /* 1 */ {4, s_0_1, 0, 2, 0},
- /* 2 */ {4, s_0_2, 0, 2, 0},
- /* 3 */ {1, s_0_3, -1, 1, 0},
- /* 4 */ {2, s_0_4, 3, 2, 0},
- /* 5 */ {2, s_0_5, 3, 2, 0},
- /* 6 */ {5, s_0_6, -1, 1, 0},
- /* 7 */ {6, s_0_7, 6, 2, 0},
- /* 8 */ {6, s_0_8, 6, 2, 0}
+ /* 0 */ {3, s_0_0, -1, 1, 0},
+ /* 1 */ {4, s_0_1, 0, 2, 0},
+ /* 2 */ {4, s_0_2, 0, 2, 0},
+ /* 3 */ {1, s_0_3, -1, 1, 0},
+ /* 4 */ {2, s_0_4, 3, 2, 0},
+ /* 5 */ {2, s_0_5, 3, 2, 0},
+ /* 6 */ {5, s_0_6, -1, 1, 0},
+ /* 7 */ {6, s_0_7, 6, 2, 0},
+ /* 8 */ {6, s_0_8, 6, 2, 0}
};
static symbol s_1_0[2] = {0xC0, 0xC0};
static struct among a_1[26] =
{
- /* 0 */ {2, s_1_0, -1, 1, 0},
- /* 1 */ {2, s_1_1, -1, 1, 0},
- /* 2 */ {2, s_1_2, -1, 1, 0},
- /* 3 */ {2, s_1_3, -1, 1, 0},
- /* 4 */ {2, s_1_4, -1, 1, 0},
- /* 5 */ {2, s_1_5, -1, 1, 0},
- /* 6 */ {2, s_1_6, -1, 1, 0},
- /* 7 */ {2, s_1_7, -1, 1, 0},
- /* 8 */ {2, s_1_8, -1, 1, 0},
- /* 9 */ {2, s_1_9, -1, 1, 0},
+ /* 0 */ {2, s_1_0, -1, 1, 0},
+ /* 1 */ {2, s_1_1, -1, 1, 0},
+ /* 2 */ {2, s_1_2, -1, 1, 0},
+ /* 3 */ {2, s_1_3, -1, 1, 0},
+ /* 4 */ {2, s_1_4, -1, 1, 0},
+ /* 5 */ {2, s_1_5, -1, 1, 0},
+ /* 6 */ {2, s_1_6, -1, 1, 0},
+ /* 7 */ {2, s_1_7, -1, 1, 0},
+ /* 8 */ {2, s_1_8, -1, 1, 0},
+ /* 9 */ {2, s_1_9, -1, 1, 0},
/* 10 */ {3, s_1_10, -1, 1, 0},
/* 11 */ {3, s_1_11, -1, 1, 0},
/* 12 */ {2, s_1_12, -1, 1, 0},
static struct among a_2[8] =
{
- /* 0 */ {2, s_2_0, -1, 1, 0},
- /* 1 */ {2, s_2_1, -1, 1, 0},
- /* 2 */ {2, s_2_2, -1, 1, 0},
- /* 3 */ {3, s_2_3, 2, 2, 0},
- /* 4 */ {3, s_2_4, 2, 2, 0},
- /* 5 */ {1, s_2_5, -1, 1, 0},
- /* 6 */ {2, s_2_6, 5, 1, 0},
- /* 7 */ {3, s_2_7, 6, 2, 0}
+ /* 0 */ {2, s_2_0, -1, 1, 0},
+ /* 1 */ {2, s_2_1, -1, 1, 0},
+ /* 2 */ {2, s_2_2, -1, 1, 0},
+ /* 3 */ {3, s_2_3, 2, 2, 0},
+ /* 4 */ {3, s_2_4, 2, 2, 0},
+ /* 5 */ {1, s_2_5, -1, 1, 0},
+ /* 6 */ {2, s_2_6, 5, 1, 0},
+ /* 7 */ {3, s_2_7, 6, 2, 0}
};
static symbol s_3_0[2] = {0xD3, 0xD1};
static struct among a_3[2] =
{
- /* 0 */ {2, s_3_0, -1, 1, 0},
- /* 1 */ {2, s_3_1, -1, 1, 0}
+ /* 0 */ {2, s_3_0, -1, 1, 0},
+ /* 1 */ {2, s_3_1, -1, 1, 0}
};
static symbol s_4_0[1] = {0xC0};
static struct among a_4[46] =
{
- /* 0 */ {1, s_4_0, -1, 2, 0},
- /* 1 */ {2, s_4_1, 0, 2, 0},
- /* 2 */ {2, s_4_2, -1, 1, 0},
- /* 3 */ {3, s_4_3, 2, 2, 0},
- /* 4 */ {3, s_4_4, 2, 2, 0},
- /* 5 */ {2, s_4_5, -1, 1, 0},
- /* 6 */ {3, s_4_6, 5, 2, 0},
- /* 7 */ {3, s_4_7, -1, 1, 0},
- /* 8 */ {3, s_4_8, -1, 2, 0},
- /* 9 */ {3, s_4_9, -1, 1, 0},
+ /* 0 */ {1, s_4_0, -1, 2, 0},
+ /* 1 */ {2, s_4_1, 0, 2, 0},
+ /* 2 */ {2, s_4_2, -1, 1, 0},
+ /* 3 */ {3, s_4_3, 2, 2, 0},
+ /* 4 */ {3, s_4_4, 2, 2, 0},
+ /* 5 */ {2, s_4_5, -1, 1, 0},
+ /* 6 */ {3, s_4_6, 5, 2, 0},
+ /* 7 */ {3, s_4_7, -1, 1, 0},
+ /* 8 */ {3, s_4_8, -1, 2, 0},
+ /* 9 */ {3, s_4_9, -1, 1, 0},
/* 10 */ {4, s_4_10, 9, 2, 0},
/* 11 */ {4, s_4_11, 9, 2, 0},
/* 12 */ {2, s_4_12, -1, 1, 0},
static struct among a_5[36] =
{
- /* 0 */ {1, s_5_0, -1, 1, 0},
- /* 1 */ {2, s_5_1, 0, 1, 0},
- /* 2 */ {2, s_5_2, 0, 1, 0},
- /* 3 */ {1, s_5_3, -1, 1, 0},
- /* 4 */ {1, s_5_4, -1, 1, 0},
- /* 5 */ {2, s_5_5, 4, 1, 0},
- /* 6 */ {2, s_5_6, 4, 1, 0},
- /* 7 */ {2, s_5_7, -1, 1, 0},
- /* 8 */ {2, s_5_8, -1, 1, 0},
- /* 9 */ {3, s_5_9, 8, 1, 0},
+ /* 0 */ {1, s_5_0, -1, 1, 0},
+ /* 1 */ {2, s_5_1, 0, 1, 0},
+ /* 2 */ {2, s_5_2, 0, 1, 0},
+ /* 3 */ {1, s_5_3, -1, 1, 0},
+ /* 4 */ {1, s_5_4, -1, 1, 0},
+ /* 5 */ {2, s_5_5, 4, 1, 0},
+ /* 6 */ {2, s_5_6, 4, 1, 0},
+ /* 7 */ {2, s_5_7, -1, 1, 0},
+ /* 8 */ {2, s_5_8, -1, 1, 0},
+ /* 9 */ {3, s_5_9, 8, 1, 0},
/* 10 */ {1, s_5_10, -1, 1, 0},
/* 11 */ {2, s_5_11, 10, 1, 0},
/* 12 */ {2, s_5_12, 10, 1, 0},
static struct among a_6[2] =
{
- /* 0 */ {3, s_6_0, -1, 1, 0},
- /* 1 */ {4, s_6_1, -1, 1, 0}
+ /* 0 */ {3, s_6_0, -1, 1, 0},
+ /* 1 */ {4, s_6_1, -1, 1, 0}
};
static symbol s_7_0[4] = {0xC5, 0xCA, 0xDB, 0xC5};
static struct among a_7[4] =
{
- /* 0 */ {4, s_7_0, -1, 1, 0},
- /* 1 */ {1, s_7_1, -1, 2, 0},
- /* 2 */ {1, s_7_2, -1, 3, 0},
- /* 3 */ {3, s_7_3, -1, 1, 0}
+ /* 0 */ {4, s_7_0, -1, 1, 0},
+ /* 1 */ {1, s_7_1, -1, 2, 0},
+ /* 2 */ {1, s_7_2, -1, 3, 0},
+ /* 3 */ {3, s_7_3, -1, 1, 0}
};
static unsigned char g_v[] = {35, 130, 34, 18};
return 1;
}
-extern struct SN_env *russian_KOI8_R_create_env(void)
+extern struct SN_env *
+russian_KOI8_R_create_env(void)
{
return SN_create_env(0, 2, 0);
}
-extern void russian_KOI8_R_close_env(struct SN_env * z)
+extern void
+russian_KOI8_R_close_env(struct SN_env * z)
{
SN_close_env(z);
}
{
#endif
- extern struct SN_env *russian_KOI8_R_create_env(void);
- extern void russian_KOI8_R_close_env(struct SN_env * z);
+extern struct SN_env *russian_KOI8_R_create_env(void);
+extern void russian_KOI8_R_close_env(struct SN_env * z);
- extern int russian_KOI8_R_stem(struct SN_env * z);
+extern int russian_KOI8_R_stem(struct SN_env * z);
#ifdef __cplusplus
}
#if defined(TS_USE_WIDE) && defined(WIN32)
size_t
-wchar2char( char *to, const wchar_t *from, size_t len ) {
- if (GetDatabaseEncoding() == PG_UTF8) {
- int r, nbytes;
-
- if (len==0)
+wchar2char(char *to, const wchar_t *from, size_t len)
+{
+ if (GetDatabaseEncoding() == PG_UTF8)
+ {
+ int r,
+ nbytes;
+
+ if (len == 0)
return 0;
/* in any case, *to should be allocated with enough space */
nbytes = WideCharToMultiByte(CP_UTF8, 0, from, len, NULL, 0, NULL, NULL);
- if ( nbytes==0 )
+ if (nbytes == 0)
ereport(ERROR,
- (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
- errmsg("UTF-16 to UTF-8 translation failed: %lu",
- GetLastError())));
+ (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
+ errmsg("UTF-16 to UTF-8 translation failed: %lu",
+ GetLastError())));
r = WideCharToMultiByte(CP_UTF8, 0, from, len, to, nbytes,
- NULL, NULL);
+ NULL, NULL);
- if ( r==0 )
+ if (r == 0)
ereport(ERROR,
- (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
- errmsg("UTF-16 to UTF-8 translation failed: %lu",
- GetLastError())));
+ (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
+ errmsg("UTF-16 to UTF-8 translation failed: %lu",
+ GetLastError())));
return r;
}
return wcstombs(to, from, len);
}
-size_t
-char2wchar( wchar_t *to, const char *from, size_t len ) {
- if (GetDatabaseEncoding() == PG_UTF8) {
- int r;
+size_t
+char2wchar(wchar_t *to, const char *from, size_t len)
+{
+ if (GetDatabaseEncoding() == PG_UTF8)
+ {
+ int r;
- if (len==0)
+ if (len == 0)
return 0;
r = MultiByteToWideChar(CP_UTF8, 0, from, len, to, len);
- if (!r) {
+ if (!r)
+ {
pg_verifymbstr(from, len, false);
ereport(ERROR,
- (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
- errmsg("invalid multibyte character for locale"),
- errhint("The server's LC_CTYPE locale is probably incompatible with the database encoding.")));
+ (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
+ errmsg("invalid multibyte character for locale"),
+ errhint("The server's LC_CTYPE locale is probably incompatible with the database encoding.")));
}
- Assert( r <= len );
+ Assert(r <= len);
return r;
}
-
+
return mbstowcs(to, from, len);
}
#ifdef WIN32
-size_t wchar2char( char *to, const wchar_t *from, size_t len );
-size_t char2wchar( wchar_t *to, const char *from, size_t len );
-
-#else /* WIN32 */
+size_t wchar2char(char *to, const wchar_t *from, size_t len);
+size_t char2wchar(wchar_t *to, const char *from, size_t len);
+#else /* WIN32 */
/* correct mbstowcs */
#define char2wchar mbstowcs
#define wchar2char wcstombs
+#endif /* WIN32 */
+#endif /* defined(HAVE_WCSTOMBS) &&
+ * defined(HAVE_TOWLOWER) */
-#endif /* WIN32 */
-
-#endif /* defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER) */
-
-#endif /* __TSLOCALE_H__ */
+#endif /* __TSLOCALE_H__ */
#include "ts_locale.h"
-static TParserPosition*
-newTParserPosition(TParserPosition *prev) {
- TParserPosition *res = (TParserPosition*)palloc(sizeof(TParserPosition));
+static TParserPosition *
+newTParserPosition(TParserPosition * prev)
+{
+ TParserPosition *res = (TParserPosition *) palloc(sizeof(TParserPosition));
- if ( prev )
+ if (prev)
memcpy(res, prev, sizeof(TParserPosition));
else
memset(res, 0, sizeof(TParserPosition));
return res;
}
-TParser*
-TParserInit( char *str, int len ) {
- TParser *prs = (TParser*)palloc0( sizeof(TParser) );
+TParser *
+TParserInit(char *str, int len)
+{
+ TParser *prs = (TParser *) palloc0(sizeof(TParser));
prs->charmaxlen = pg_database_encoding_max_length();
- prs->str = str;
+ prs->str = str;
prs->lenstr = len;
#ifdef TS_USE_WIDE
- /*
- * Use wide char code only when max encoding length > 1 and ctype != C.
- * Some operating systems fail with multi-byte encodings and a C locale.
- * Also, for a C locale there is no need to process as multibyte.
- * From backend/utils/adt/oracle_compat.c Teodor
- */
-
- if ( prs->charmaxlen > 1 && !lc_ctype_is_c() ) {
- prs->usewide=true;
- prs->wstr = (wchar_t*)palloc( sizeof(wchar_t) * prs->lenstr );
- prs->lenwstr = char2wchar( prs->wstr, prs->str, prs->lenstr );
- } else
+
+ /*
+ * Use wide char code only when max encoding length > 1 and ctype != C.
+ * Some operating systems fail with multi-byte encodings and a C locale.
+ * Also, for a C locale there is no need to process as multibyte. From
+ * backend/utils/adt/oracle_compat.c Teodor
+ */
+
+ if (prs->charmaxlen > 1 && !lc_ctype_is_c())
+ {
+ prs->usewide = true;
+ prs->wstr = (wchar_t *) palloc(sizeof(wchar_t) * prs->lenstr);
+ prs->lenwstr = char2wchar(prs->wstr, prs->str, prs->lenstr);
+ }
+ else
#endif
- prs->usewide=false;
+ prs->usewide = false;
prs->state = newTParserPosition(NULL);
prs->state->state = TPS_Base;
}
void
-TParserClose( TParser* prs ) {
- while( prs->state ) {
+TParserClose(TParser * prs)
+{
+ while (prs->state)
+ {
TParserPosition *ptr = prs->state->prev;
- pfree( prs->state );
+
+ pfree(prs->state);
prs->state = ptr;
}
- if ( prs->wstr )
- pfree( prs->wstr );
- pfree( prs );
+ if (prs->wstr)
+ pfree(prs->wstr);
+ pfree(prs);
}
/*
* working with any possible encodings and locales
*/
-#ifdef TS_USE_WIDE
+#ifdef TS_USE_WIDE
-#define p_iswhat(type) \
+#define p_iswhat(type) \
static int \
p_is##type(TParser *prs) { \
Assert( prs->state ); \
- return ( ( prs->usewide ) ? isw##type( (wint_t)*( prs->wstr + prs->state->poschar ) ) : \
+ return ( ( prs->usewide ) ? isw##type( (wint_t)*( prs->wstr + prs->state->poschar ) ) : \
is##type( (unsigned char)*( prs->str + prs->state->posbyte ) ) ); \
-} \
+} \
\
static int \
p_isnot##type(TParser *prs) { \
/* p_iseq should be used only for ascii symbols */
static int
-p_iseq(TParser *prs, char c) {
- Assert( prs->state );
- return ( ( prs->state->charlen==1 && *( prs->str + prs->state->posbyte ) == c ) ) ? 1 : 0;
+p_iseq(TParser * prs, char c)
+{
+ Assert(prs->state);
+ return ((prs->state->charlen == 1 && *(prs->str + prs->state->posbyte) == c)) ? 1 : 0;
}
+#else /* TS_USE_WIDE */
-#else /* TS_USE_WIDE */
-
-#define p_iswhat(type) \
+#define p_iswhat(type) \
static int \
p_is##type(TParser *prs) { \
Assert( prs->state ); \
return is##type( (unsigned char)*( prs->str + prs->state->posbyte ) ); \
-} \
+} \
\
static int \
p_isnot##type(TParser *prs) { \
static int
-p_iseq(TParser *prs, char c) {
- Assert( prs->state );
- return ( *( prs->str + prs->state->posbyte ) == c ) ? 1 : 0;
+p_iseq(TParser * prs, char c)
+{
+ Assert(prs->state);
+ return (*(prs->str + prs->state->posbyte) == c) ? 1 : 0;
}
-
-#endif /* TS_USE_WIDE */
+#endif /* TS_USE_WIDE */
p_iswhat(alnum)
p_iswhat(alpha)
p_iswhat(xdigit)
static int
-p_isEOF(TParser *prs) {
- Assert( prs->state );
- return (prs->state->posbyte == prs->lenstr || prs->state->charlen==0) ? 1 : 0;
+p_isEOF(TParser * prs)
+{
+ Assert(prs->state);
+ return (prs->state->posbyte == prs->lenstr || prs->state->charlen == 0) ? 1 : 0;
}
static int
-p_iseqC(TParser *prs) {
- return p_iseq(prs, prs->c);
+p_iseqC(TParser * prs)
+{
+ return p_iseq(prs, prs->c);
}
static int
-p_isneC(TParser *prs) {
+p_isneC(TParser * prs)
+{
return !p_iseq(prs, prs->c);
}
static int
-p_isascii(TParser *prs) {
- return ( prs->state->charlen==1 && isascii( (unsigned char) *( prs->str + prs->state->posbyte ) ) ) ? 1 : 0;
+p_isascii(TParser * prs)
+{
+ return (prs->state->charlen == 1 && isascii((unsigned char) *(prs->str + prs->state->posbyte))) ? 1 : 0;
}
static int
-p_islatin(TParser *prs) {
- return ( p_isalpha(prs) && p_isascii(prs) ) ? 1 : 0;
+p_islatin(TParser * prs)
+{
+ return (p_isalpha(prs) && p_isascii(prs)) ? 1 : 0;
}
static int
-p_isnonlatin(TParser *prs) {
- return ( p_isalpha(prs) && !p_isascii(prs) ) ? 1 : 0;
+p_isnonlatin(TParser * prs)
+{
+ return (p_isalpha(prs) && !p_isascii(prs)) ? 1 : 0;
}
-void _make_compiler_happy(void);
+void _make_compiler_happy(void);
void
-_make_compiler_happy(void) {
- p_isalnum(NULL); p_isnotalnum(NULL);
- p_isalpha(NULL); p_isnotalpha(NULL);
- p_isdigit(NULL); p_isnotdigit(NULL);
- p_islower(NULL); p_isnotlower(NULL);
- p_isprint(NULL); p_isnotprint(NULL);
- p_ispunct(NULL); p_isnotpunct(NULL);
- p_isspace(NULL); p_isnotspace(NULL);
- p_isupper(NULL); p_isnotupper(NULL);
- p_isxdigit(NULL); p_isnotxdigit(NULL);
- p_isEOF(NULL);
- p_iseqC(NULL); p_isneC(NULL);
+_make_compiler_happy(void)
+{
+ p_isalnum(NULL);
+ p_isnotalnum(NULL);
+ p_isalpha(NULL);
+ p_isnotalpha(NULL);
+ p_isdigit(NULL);
+ p_isnotdigit(NULL);
+ p_islower(NULL);
+ p_isnotlower(NULL);
+ p_isprint(NULL);
+ p_isnotprint(NULL);
+ p_ispunct(NULL);
+ p_isnotpunct(NULL);
+ p_isspace(NULL);
+ p_isnotspace(NULL);
+ p_isupper(NULL);
+ p_isnotupper(NULL);
+ p_isxdigit(NULL);
+ p_isnotxdigit(NULL);
+ p_isEOF(NULL);
+ p_iseqC(NULL);
+ p_isneC(NULL);
}
static void
-SpecialTags(TParser *prs) {
- switch( prs->state->lencharlexeme ) {
- case 8: /* </script */
- if ( pg_strncasecmp( prs->lexeme, "</script", 8 ) == 0 )
+SpecialTags(TParser * prs)
+{
+ switch (prs->state->lencharlexeme)
+ {
+ case 8: /* </script */
+ if (pg_strncasecmp(prs->lexeme, "</script", 8) == 0)
prs->ignore = false;
break;
- case 7: /* <script || </style */
- if ( pg_strncasecmp( prs->lexeme, "</style", 7 ) == 0 )
+ case 7: /* <script || </style */
+ if (pg_strncasecmp(prs->lexeme, "</style", 7) == 0)
prs->ignore = false;
- else if ( pg_strncasecmp( prs->lexeme, "<script", 7 ) == 0 )
+ else if (pg_strncasecmp(prs->lexeme, "<script", 7) == 0)
prs->ignore = true;
break;
- case 6: /* <style */
- if ( pg_strncasecmp( prs->lexeme, "<style", 6 ) == 0 )
+ case 6: /* <style */
+ if (pg_strncasecmp(prs->lexeme, "<style", 6) == 0)
prs->ignore = true;
break;
- default: break;
+ default:
+ break;
}
}
static void
-SpecialFURL(TParser *prs) {
+SpecialFURL(TParser * prs)
+{
prs->wanthost = true;
prs->state->posbyte -= prs->state->lenbytelexeme;
prs->state->poschar -= prs->state->lencharlexeme;
}
static void
-SpecialHyphen(TParser *prs) {
+SpecialHyphen(TParser * prs)
+{
prs->state->posbyte -= prs->state->lenbytelexeme;
prs->state->poschar -= prs->state->lencharlexeme;
}
static int
-p_isstophost(TParser *prs) {
- if ( prs->wanthost ) {
+p_isstophost(TParser * prs)
+{
+ if (prs->wanthost)
+ {
prs->wanthost = false;
return 1;
}
}
static int
-p_isignore(TParser *prs) {
+p_isignore(TParser * prs)
+{
return (prs->ignore) ? 1 : 0;
}
static int
-p_ishost(TParser *prs) {
- TParser *tmpprs = TParserInit( prs->str+prs->state->posbyte, prs->lenstr - prs->state->posbyte );
- int res = 0;
+p_ishost(TParser * prs)
+{
+ TParser *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte);
+ int res = 0;
- if ( TParserGet(tmpprs) && tmpprs->type == HOST ) {
+ if (TParserGet(tmpprs) && tmpprs->type == HOST)
+ {
prs->state->posbyte += tmpprs->lenbytelexeme;
prs->state->poschar += tmpprs->lencharlexeme;
prs->state->lenbytelexeme += tmpprs->lenbytelexeme;
prs->state->lencharlexeme += tmpprs->lencharlexeme;
- prs->state->charlen = tmpprs->state->charlen;
+ prs->state->charlen = tmpprs->state->charlen;
res = 1;
}
TParserClose(tmpprs);
}
static int
-p_isURI(TParser *prs) {
- TParser *tmpprs = TParserInit( prs->str+prs->state->posbyte, prs->lenstr - prs->state->posbyte );
- int res = 0;
+p_isURI(TParser * prs)
+{
+ TParser *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte);
+ int res = 0;
- tmpprs->state = newTParserPosition( tmpprs->state );
+ tmpprs->state = newTParserPosition(tmpprs->state);
tmpprs->state->state = TPS_InFileFirst;
- if ( TParserGet(tmpprs) && (tmpprs->type == URI || tmpprs->type == FILEPATH) ) {
+ if (TParserGet(tmpprs) && (tmpprs->type == URI || tmpprs->type == FILEPATH))
+ {
prs->state->posbyte += tmpprs->lenbytelexeme;
prs->state->poschar += tmpprs->lencharlexeme;
prs->state->lenbytelexeme += tmpprs->lenbytelexeme;
prs->state->lencharlexeme += tmpprs->lencharlexeme;
- prs->state->charlen = tmpprs->state->charlen;
+ prs->state->charlen = tmpprs->state->charlen;
res = 1;
}
TParserClose(tmpprs);
#define A_CLRALL 0x0040
static TParserStateActionItem actionTPS_Base[] = {
- {p_isEOF, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '<', A_PUSH, TPS_InTagFirst, 0, NULL},
- {p_isignore, 0, A_NEXT, TPS_InSpace, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InLatWord, 0, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InCyrWord, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InUnsignedInt, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InSignedIntFirst, 0, NULL},
- {p_iseqC, '+', A_PUSH, TPS_InSignedIntFirst, 0, NULL},
- {p_iseqC, '&', A_PUSH, TPS_InHTMLEntityFirst, 0, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
- {NULL, 0, A_NEXT, TPS_InSpace, 0, NULL}
-};
+ {p_isEOF, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '<', A_PUSH, TPS_InTagFirst, 0, NULL},
+ {p_isignore, 0, A_NEXT, TPS_InSpace, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InLatWord, 0, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InCyrWord, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InUnsignedInt, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InSignedIntFirst, 0, NULL},
+ {p_iseqC, '+', A_PUSH, TPS_InSignedIntFirst, 0, NULL},
+ {p_iseqC, '&', A_PUSH, TPS_InHTMLEntityFirst, 0, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
+ {NULL, 0, A_NEXT, TPS_InSpace, 0, NULL}
+};
static TParserStateActionItem actionTPS_InUWord[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, UWORD, NULL},
- {p_isalnum, 0, A_NEXT, TPS_InUWord, 0, NULL},
- {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, UWORD, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, UWORD, NULL},
+ {p_isalnum, 0, A_NEXT, TPS_InUWord, 0, NULL},
+ {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, UWORD, NULL}
};
static TParserStateActionItem actionTPS_InLatWord[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, LATWORD, NULL},
- {p_islatin, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InFileFirst, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenLatWordFirst,0, NULL},
- {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
- {p_iseqC, ':', A_PUSH, TPS_InProtocolFirst, 0, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
- {p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
- {p_isalnum, 0, A_NEXT, TPS_InUWord, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, LATWORD, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, LATWORD, NULL},
+ {p_islatin, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InFileFirst, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenLatWordFirst, 0, NULL},
+ {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
+ {p_iseqC, ':', A_PUSH, TPS_InProtocolFirst, 0, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
+ {p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
+ {p_isalnum, 0, A_NEXT, TPS_InUWord, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, LATWORD, NULL}
};
static TParserStateActionItem actionTPS_InCyrWord[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, CYRWORD, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_isalnum, 0, A_NEXT, TPS_InUWord, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenCyrWordFirst,0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, CYRWORD, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, CYRWORD, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_isalnum, 0, A_NEXT, TPS_InUWord, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenCyrWordFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, CYRWORD, NULL}
};
-
+
static TParserStateActionItem actionTPS_InUnsignedInt[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL},
- {p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InUDecimalFirst, 0, NULL},
- {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {p_islatin, 0, A_PUSH, TPS_InHost, 0, NULL},
- {p_isalpha, 0, A_NEXT, TPS_InUWord, 0, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL}
-};
-
+ {p_isEOF, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InUDecimalFirst, 0, NULL},
+ {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {p_islatin, 0, A_PUSH, TPS_InHost, 0, NULL},
+ {p_isalpha, 0, A_NEXT, TPS_InUWord, 0, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL}
+};
+
static TParserStateActionItem actionTPS_InSignedIntFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT|A_CLEAR, TPS_InSignedInt, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT | A_CLEAR, TPS_InSignedInt, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
-
+
static TParserStateActionItem actionTPS_InSignedInt[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, SIGNEDINT, NULL},
- {p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InDecimalFirst, 0, NULL},
- {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, SIGNEDINT, NULL}
-};
-
+ {p_isEOF, 0, A_BINGO, TPS_Base, SIGNEDINT, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InDecimalFirst, 0, NULL},
+ {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, SIGNEDINT, NULL}
+};
+
static TParserStateActionItem actionTPS_InSpace[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, SPACE, NULL},
- {p_iseqC, '<', A_BINGO, TPS_Base, SPACE, NULL},
- {p_isignore, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_BINGO, TPS_Base, SPACE, NULL},
- {p_iseqC, '+', A_BINGO, TPS_Base, SPACE, NULL},
- {p_iseqC, '&', A_BINGO, TPS_Base, SPACE, NULL},
- {p_iseqC, '/', A_BINGO, TPS_Base, SPACE, NULL},
- {p_isnotalnum, 0, A_NEXT, TPS_InSpace, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, SPACE, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, SPACE, NULL},
+ {p_iseqC, '<', A_BINGO, TPS_Base, SPACE, NULL},
+ {p_isignore, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_BINGO, TPS_Base, SPACE, NULL},
+ {p_iseqC, '+', A_BINGO, TPS_Base, SPACE, NULL},
+ {p_iseqC, '&', A_BINGO, TPS_Base, SPACE, NULL},
+ {p_iseqC, '/', A_BINGO, TPS_Base, SPACE, NULL},
+ {p_isnotalnum, 0, A_NEXT, TPS_InSpace, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, SPACE, NULL}
};
static TParserStateActionItem actionTPS_InUDecimalFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InUDecimal, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InUDecimal, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InUDecimal[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, DECIMAL, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InUDecimal, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InVersionFirst, 0, NULL},
- {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, DECIMAL, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, DECIMAL, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InUDecimal, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InVersionFirst, 0, NULL},
+ {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, DECIMAL, NULL}
};
static TParserStateActionItem actionTPS_InDecimalFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InDecimal, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InDecimal, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InDecimal[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, DECIMAL, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InDecimal, 0, NULL},
- {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, DECIMAL, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, DECIMAL, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InDecimal, 0, NULL},
+ {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, DECIMAL, NULL}
};
static TParserStateActionItem actionTPS_InVersionFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InVersion, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InVersion, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InVersion[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InVersion, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InVersionFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InVersion, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InVersionFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL}
};
static TParserStateActionItem actionTPS_InMantissaFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InMantissa, 0, NULL},
- {p_iseqC, '+', A_NEXT, TPS_InMantissaSign, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_InMantissaSign, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InMantissa, 0, NULL},
+ {p_iseqC, '+', A_NEXT, TPS_InMantissaSign, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_InMantissaSign, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InMantissaSign[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InMantissa, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InMantissa, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InMantissa[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, SCIENTIFIC, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InMantissa, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, SCIENTIFIC, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, SCIENTIFIC, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InMantissa, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, SCIENTIFIC, NULL}
};
static TParserStateActionItem actionTPS_InHTMLEntityFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '#', A_NEXT, TPS_InHTMLEntityNumFirst,0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHTMLEntity, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '#', A_NEXT, TPS_InHTMLEntityNumFirst, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHTMLEntity, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHTMLEntity[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHTMLEntity, 0, NULL},
- {p_iseqC, ';', A_NEXT, TPS_InHTMLEntityEnd, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHTMLEntity, 0, NULL},
+ {p_iseqC, ';', A_NEXT, TPS_InHTMLEntityEnd, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHTMLEntityNumFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHTMLEntityNum, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHTMLEntityNum, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHTMLEntityNum[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHTMLEntityNum, 0, NULL},
- {p_iseqC, ';', A_NEXT, TPS_InHTMLEntityEnd, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHTMLEntityNum, 0, NULL},
+ {p_iseqC, ';', A_NEXT, TPS_InHTMLEntityEnd, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHTMLEntityEnd[] = {
- {NULL, 0, A_BINGO|A_CLEAR,TPS_Base, HTMLENTITY, NULL}
+ {NULL, 0, A_BINGO | A_CLEAR, TPS_Base, HTMLENTITY, NULL}
};
static TParserStateActionItem actionTPS_InTagFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InTagCloseFirst, 0, NULL},
- {p_iseqC, '!', A_PUSH, TPS_InCommentFirst, 0, NULL},
- {p_islatin, 0, A_PUSH, TPS_InTag, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InTagCloseFirst, 0, NULL},
+ {p_iseqC, '!', A_PUSH, TPS_InCommentFirst, 0, NULL},
+ {p_islatin, 0, A_PUSH, TPS_InTag, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InTagCloseFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InTag, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InTag, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InTag[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '>', A_NEXT, TPS_InTagEnd, 0, SpecialTags},
- {p_iseqC, '\'', A_NEXT, TPS_InTagEscapeK, 0, NULL},
- {p_iseqC, '"', A_NEXT, TPS_InTagEscapeKK, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '=', A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '#', A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '%', A_NEXT, TPS_Null, 0, NULL},
- {p_isspace, 0, A_NEXT, TPS_Null, 0, SpecialTags},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '>', A_NEXT, TPS_InTagEnd, 0, SpecialTags},
+ {p_iseqC, '\'', A_NEXT, TPS_InTagEscapeK, 0, NULL},
+ {p_iseqC, '"', A_NEXT, TPS_InTagEscapeKK, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '=', A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '#', A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '%', A_NEXT, TPS_Null, 0, NULL},
+ {p_isspace, 0, A_NEXT, TPS_Null, 0, SpecialTags},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InTagEscapeK[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '\\', A_PUSH, TPS_InTagBackSleshed, 0, NULL},
- {p_iseqC, '\'', A_NEXT, TPS_InTag, 0, NULL},
- {NULL, 0, A_NEXT, TPS_InTagEscapeK, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '\\', A_PUSH, TPS_InTagBackSleshed, 0, NULL},
+ {p_iseqC, '\'', A_NEXT, TPS_InTag, 0, NULL},
+ {NULL, 0, A_NEXT, TPS_InTagEscapeK, 0, NULL}
};
static TParserStateActionItem actionTPS_InTagEscapeKK[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '\\', A_PUSH, TPS_InTagBackSleshed, 0, NULL},
- {p_iseqC, '"', A_NEXT, TPS_InTag, 0, NULL},
- {NULL, 0, A_NEXT, TPS_InTagEscapeKK, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '\\', A_PUSH, TPS_InTagBackSleshed, 0, NULL},
+ {p_iseqC, '"', A_NEXT, TPS_InTag, 0, NULL},
+ {NULL, 0, A_NEXT, TPS_InTagEscapeKK, 0, NULL}
};
static TParserStateActionItem actionTPS_InTagBackSleshed[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {NULL, 0, A_MERGE, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {NULL, 0, A_MERGE, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InTagEnd[] = {
- {NULL, 0, A_BINGO|A_CLRALL,TPS_Base, TAG, NULL}
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_Base, TAG, NULL}
};
static TParserStateActionItem actionTPS_InCommentFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_InCommentLast, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_InCommentLast, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InCommentLast[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_InComment, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_InComment, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InComment[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_InCloseCommentFirst,0, NULL},
- {NULL, 0, A_NEXT, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_InCloseCommentFirst, 0, NULL},
+ {NULL, 0, A_NEXT, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InCloseCommentFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_InCloseCommentLast, 0, NULL},
- {NULL, 0, A_NEXT, TPS_InComment, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_InCloseCommentLast, 0, NULL},
+ {NULL, 0, A_NEXT, TPS_InComment, 0, NULL}
};
static TParserStateActionItem actionTPS_InCloseCommentLast[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
- {p_iseqC, '>', A_NEXT, TPS_InCommentEnd, 0, NULL},
- {NULL, 0, A_NEXT, TPS_InComment, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
+ {p_iseqC, '>', A_NEXT, TPS_InCommentEnd, 0, NULL},
+ {NULL, 0, A_NEXT, TPS_InComment, 0, NULL}
};
static TParserStateActionItem actionTPS_InCommentEnd[] = {
- {NULL, 0, A_BINGO|A_CLRALL,TPS_Base, TAG, NULL}
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_Base, TAG, NULL}
};
static TParserStateActionItem actionTPS_InHostFirstDomen[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHostDomenSecond, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHostDomenSecond, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHostDomenSecond[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHostDomen, 0, NULL},
- {p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
- {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHostDomen, 0, NULL},
+ {p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
+ {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHostDomen[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_Base, HOST, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHostDomen, 0, NULL},
- {p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
- {p_iseqC, ':', A_PUSH, TPS_InPortFirst, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
- {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
- {p_isdigit, 0, A_POP, TPS_Null, 0, NULL},
- {p_isstophost, 0, A_BINGO|A_CLRALL,TPS_InURIStart, HOST, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_Base, HOST, NULL}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHostDomen, 0, NULL},
+ {p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
+ {p_iseqC, ':', A_PUSH, TPS_InPortFirst, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
+ {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
+ {p_isdigit, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isstophost, 0, A_BINGO | A_CLRALL, TPS_InURIStart, HOST, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL}
};
static TParserStateActionItem actionTPS_InPortFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InPort[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_Base, HOST, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
- {p_isstophost, 0, A_BINGO|A_CLRALL,TPS_InURIStart, HOST, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_Base, HOST, NULL}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
+ {p_isstophost, 0, A_BINGO | A_CLRALL, TPS_InURIStart, HOST, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL}
};
static TParserStateActionItem actionTPS_InHostFirstAN[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHost, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHost, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHost[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHost, 0, NULL},
- {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHost, 0, NULL},
+ {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHostFirstDomen, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InEmail[] = {
- {p_ishost, 0, A_BINGO|A_CLRALL, TPS_Base, EMAIL, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_ishost, 0, A_BINGO | A_CLRALL, TPS_Base, EMAIL, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InFileFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_CLEAR, TPS_InFile, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InFile, 0, NULL},
- {p_iseqC, '.', A_CLEAR, TPS_InFile, 0, NULL},
- {p_iseqC, '_', A_CLEAR, TPS_InFile, 0, NULL},
- {p_iseqC, '?', A_PUSH, TPS_InURIFirst, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_CLEAR, TPS_InFile, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InFile, 0, NULL},
+ {p_iseqC, '.', A_CLEAR, TPS_InFile, 0, NULL},
+ {p_iseqC, '_', A_CLEAR, TPS_InFile, 0, NULL},
+ {p_iseqC, '?', A_PUSH, TPS_InURIFirst, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InFile[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, FILEPATH, NULL},
- {p_islatin, 0, A_NEXT, TPS_InFile, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InFileNext, 0, NULL},
- {p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
- {p_iseqC, '-', A_NEXT, TPS_InFile, 0, NULL},
- {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
- {p_iseqC, '?', A_PUSH, TPS_InURIFirst, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, FILEPATH, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, FILEPATH, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InFile, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InFileNext, 0, NULL},
+ {p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
+ {p_iseqC, '-', A_NEXT, TPS_InFile, 0, NULL},
+ {p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
+ {p_iseqC, '?', A_PUSH, TPS_InURIFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, FILEPATH, NULL}
};
static TParserStateActionItem actionTPS_InFileNext[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_CLEAR, TPS_InFile, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InFile, 0, NULL},
- {p_iseqC, '_', A_CLEAR, TPS_InFile, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_CLEAR, TPS_InFile, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InFile, 0, NULL},
+ {p_iseqC, '_', A_CLEAR, TPS_InFile, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InURIFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '"', A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '\'', A_POP, TPS_Null, 0, NULL},
- {p_isnotspace, 0, A_CLEAR, TPS_InURI, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '"', A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '\'', A_POP, TPS_Null, 0, NULL},
+ {p_isnotspace, 0, A_CLEAR, TPS_InURI, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL},
};
-
+
static TParserStateActionItem actionTPS_InURIStart[] = {
- {NULL, 0, A_NEXT, TPS_InURI, 0, NULL}
+ {NULL, 0, A_NEXT, TPS_InURI, 0, NULL}
};
static TParserStateActionItem actionTPS_InURI[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, URI, NULL},
- {p_iseqC, '"', A_BINGO, TPS_Base, URI, NULL},
- {p_iseqC, '\'', A_BINGO, TPS_Base, URI, NULL},
- {p_isnotspace, 0, A_NEXT, TPS_InURI, 0, NULL},
- {NULL, 0, A_BINGO, TPS_Base, URI, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, URI, NULL},
+ {p_iseqC, '"', A_BINGO, TPS_Base, URI, NULL},
+ {p_iseqC, '\'', A_BINGO, TPS_Base, URI, NULL},
+ {p_isnotspace, 0, A_NEXT, TPS_InURI, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_Base, URI, NULL}
};
static TParserStateActionItem actionTPS_InFURL[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isURI, 0, A_BINGO|A_CLRALL,TPS_Base, FURL, SpecialFURL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isURI, 0, A_BINGO | A_CLRALL, TPS_Base, FURL, SpecialFURL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
-
+
static TParserStateActionItem actionTPS_InProtocolFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '/', A_NEXT, TPS_InProtocolSecond, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '/', A_NEXT, TPS_InProtocolSecond, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
-
+
static TParserStateActionItem actionTPS_InProtocolSecond[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_iseqC, '/', A_NEXT, TPS_InProtocolEnd, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_iseqC, '/', A_NEXT, TPS_InProtocolEnd, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
-
+
static TParserStateActionItem actionTPS_InProtocolEnd[] = {
- {NULL, 0, A_BINGO|A_CLRALL,TPS_Base, PROTOCOL, NULL}
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_Base, PROTOCOL, NULL}
};
-
+
static TParserStateActionItem actionTPS_InHyphenLatWordFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHyphenLatWord, 0, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenLatWord, 0, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHyphenLatWord[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, LATHYPHENWORD, SpecialHyphen},
- {p_islatin, 0, A_NEXT, TPS_InHyphenLatWord, 0, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenLatWordFirst,0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, LATHYPHENWORD, SpecialHyphen}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, LATHYPHENWORD, SpecialHyphen},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenLatWord, 0, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenLatWordFirst, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, LATHYPHENWORD, SpecialHyphen}
};
static TParserStateActionItem actionTPS_InHyphenCyrWordFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWord, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWord, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHyphenCyrWord[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, CYRHYPHENWORD, SpecialHyphen},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWord, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenCyrWordFirst,0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, CYRHYPHENWORD, SpecialHyphen}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, CYRHYPHENWORD, SpecialHyphen},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWord, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenCyrWordFirst, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, CYRHYPHENWORD, SpecialHyphen}
};
static TParserStateActionItem actionTPS_InHyphenUWordFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
- {p_isalnum, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
+ {p_isalnum, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHyphenUWord[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, HYPHENWORD, SpecialHyphen},
- {p_isalnum, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst,0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, HYPHENWORD, SpecialHyphen}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, HYPHENWORD, SpecialHyphen},
+ {p_isalnum, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, HYPHENWORD, SpecialHyphen}
};
static TParserStateActionItem actionTPS_InHyphenValueFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenValueExact, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenValueExact, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHyphenValue[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, HYPHENWORD, SpecialHyphen},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHyphenValueFirst, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst,0, NULL},
- {p_isalpha, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, HYPHENWORD, SpecialHyphen}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, HYPHENWORD, SpecialHyphen},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenValue, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHyphenValueFirst, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst, 0, NULL},
+ {p_isalpha, 0, A_NEXT, TPS_InHyphenUWord, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, HYPHENWORD, SpecialHyphen}
};
static TParserStateActionItem actionTPS_InHyphenValueExact[] = {
- {p_isEOF, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, HYPHENWORD, SpecialHyphen},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenValueExact, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHyphenValueFirst, 0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst, 0, NULL},
- {NULL, 0, A_BINGO|A_CLRALL,TPS_InParseHyphen, HYPHENWORD, SpecialHyphen}
+ {p_isEOF, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, HYPHENWORD, SpecialHyphen},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenValueExact, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHyphenValueFirst, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InHyphenUWordFirst, 0, NULL},
+ {NULL, 0, A_BINGO | A_CLRALL, TPS_InParseHyphen, HYPHENWORD, SpecialHyphen}
};
static TParserStateActionItem actionTPS_InParseHyphen[] = {
- {p_isEOF, 0, A_RERUN, TPS_Base, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHyphenLatWordPart,0, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWordPart,0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUnsignedInt,0, NULL},
- {p_iseqC, '-', A_PUSH, TPS_InParseHyphenHyphen,0, NULL},
- {NULL, 0, A_RERUN, TPS_Base, 0, NULL}
+ {p_isEOF, 0, A_RERUN, TPS_Base, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenLatWordPart, 0, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWordPart, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUnsignedInt, 0, NULL},
+ {p_iseqC, '-', A_PUSH, TPS_InParseHyphenHyphen, 0, NULL},
+ {NULL, 0, A_RERUN, TPS_Base, 0, NULL}
};
static TParserStateActionItem actionTPS_InParseHyphenHyphen[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isalnum, 0, A_BINGO|A_CLEAR,TPS_InParseHyphen, SPACE, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isalnum, 0, A_BINGO | A_CLEAR, TPS_InParseHyphen, SPACE, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHyphenCyrWordPart[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, CYRPARTHYPHENWORD,NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWordPart,0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
- {NULL, 0, A_BINGO, TPS_InParseHyphen, CYRPARTHYPHENWORD,NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, CYRPARTHYPHENWORD, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenCyrWordPart, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_InParseHyphen, CYRPARTHYPHENWORD, NULL}
};
static TParserStateActionItem actionTPS_InHyphenLatWordPart[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, LATPARTHYPHENWORD,NULL},
- {p_islatin, 0, A_NEXT, TPS_InHyphenLatWordPart,0, NULL},
- {p_isnonlatin, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
- {NULL, 0, A_BINGO, TPS_InParseHyphen, LATPARTHYPHENWORD,NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, LATPARTHYPHENWORD, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InHyphenLatWordPart, 0, NULL},
+ {p_isnonlatin, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_InParseHyphen, LATPARTHYPHENWORD, NULL}
};
static TParserStateActionItem actionTPS_InHyphenUWordPart[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, PARTHYPHENWORD, NULL},
- {p_isalnum, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
- {NULL, 0, A_BINGO, TPS_InParseHyphen, PARTHYPHENWORD, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, PARTHYPHENWORD, NULL},
+ {p_isalnum, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_InParseHyphen, PARTHYPHENWORD, NULL}
};
static TParserStateActionItem actionTPS_InHyphenUnsignedInt[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHyphenUnsignedInt,0, NULL},
- {p_isalpha, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHDecimalPartFirst,0, NULL},
- {NULL, 0, A_BINGO, TPS_InParseHyphen, UNSIGNEDINT, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHyphenUnsignedInt, 0, NULL},
+ {p_isalpha, 0, A_NEXT, TPS_InHyphenUWordPart, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHDecimalPartFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_InParseHyphen, UNSIGNEDINT, NULL}
};
static TParserStateActionItem actionTPS_InHDecimalPartFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InHDecimalPart, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InHDecimalPart, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHDecimalPart[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, DECIMAL, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHDecimalPart, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHVersionPartFirst,0, NULL},
- {NULL, 0, A_BINGO, TPS_InParseHyphen, DECIMAL, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, DECIMAL, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHDecimalPart, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHVersionPartFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_InParseHyphen, DECIMAL, NULL}
};
static TParserStateActionItem actionTPS_InHVersionPartFirst[] = {
- {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_isdigit, 0, A_CLEAR, TPS_InHVersionPart, 0, NULL},
- {NULL, 0, A_POP, TPS_Null, 0, NULL}
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ {p_isdigit, 0, A_CLEAR, TPS_InHVersionPart, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
};
static TParserStateActionItem actionTPS_InHVersionPart[] = {
- {p_isEOF, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL},
- {p_isdigit, 0, A_NEXT, TPS_InHVersionPart, 0, NULL},
- {p_iseqC, '.', A_PUSH, TPS_InHVersionPartFirst,0, NULL},
- {NULL, 0, A_BINGO, TPS_InParseHyphen, VERSIONNUMBER, NULL}
+ {p_isEOF, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL},
+ {p_isdigit, 0, A_NEXT, TPS_InHVersionPart, 0, NULL},
+ {p_iseqC, '.', A_PUSH, TPS_InHVersionPartFirst, 0, NULL},
+ {NULL, 0, A_BINGO, TPS_InParseHyphen, VERSIONNUMBER, NULL}
};
-/*
+/*
* order should be the same as in typedef enum {} TParserState!!
*/
static const TParserStateAction Actions[] = {
- { TPS_Base, actionTPS_Base },
- { TPS_InUWord, actionTPS_InUWord },
- { TPS_InLatWord, actionTPS_InLatWord },
- { TPS_InCyrWord, actionTPS_InCyrWord },
- { TPS_InUnsignedInt, actionTPS_InUnsignedInt },
- { TPS_InSignedIntFirst, actionTPS_InSignedIntFirst },
- { TPS_InSignedInt, actionTPS_InSignedInt },
- { TPS_InSpace, actionTPS_InSpace },
- { TPS_InUDecimalFirst, actionTPS_InUDecimalFirst },
- { TPS_InUDecimal, actionTPS_InUDecimal },
- { TPS_InDecimalFirst, actionTPS_InDecimalFirst },
- { TPS_InDecimal, actionTPS_InDecimal },
- { TPS_InVersionFirst, actionTPS_InVersionFirst },
- { TPS_InVersion, actionTPS_InVersion },
- { TPS_InMantissaFirst, actionTPS_InMantissaFirst },
- { TPS_InMantissaSign, actionTPS_InMantissaSign },
- { TPS_InMantissa, actionTPS_InMantissa },
- { TPS_InHTMLEntityFirst, actionTPS_InHTMLEntityFirst },
- { TPS_InHTMLEntity, actionTPS_InHTMLEntity },
- { TPS_InHTMLEntityNumFirst, actionTPS_InHTMLEntityNumFirst },
- { TPS_InHTMLEntityNum, actionTPS_InHTMLEntityNum },
- { TPS_InHTMLEntityEnd, actionTPS_InHTMLEntityEnd },
- { TPS_InTagFirst, actionTPS_InTagFirst },
- { TPS_InTagCloseFirst, actionTPS_InTagCloseFirst },
- { TPS_InTag, actionTPS_InTag },
- { TPS_InTagEscapeK, actionTPS_InTagEscapeK },
- { TPS_InTagEscapeKK, actionTPS_InTagEscapeKK },
- { TPS_InTagBackSleshed, actionTPS_InTagBackSleshed },
- { TPS_InTagEnd, actionTPS_InTagEnd },
- { TPS_InCommentFirst, actionTPS_InCommentFirst },
- { TPS_InCommentLast, actionTPS_InCommentLast },
- { TPS_InComment, actionTPS_InComment },
- { TPS_InCloseCommentFirst, actionTPS_InCloseCommentFirst },
- { TPS_InCloseCommentLast, actionTPS_InCloseCommentLast },
- { TPS_InCommentEnd, actionTPS_InCommentEnd },
- { TPS_InHostFirstDomen, actionTPS_InHostFirstDomen },
- { TPS_InHostDomenSecond, actionTPS_InHostDomenSecond },
- { TPS_InHostDomen, actionTPS_InHostDomen },
- { TPS_InPortFirst, actionTPS_InPortFirst },
- { TPS_InPort, actionTPS_InPort },
- { TPS_InHostFirstAN, actionTPS_InHostFirstAN },
- { TPS_InHost, actionTPS_InHost },
- { TPS_InEmail, actionTPS_InEmail },
- { TPS_InFileFirst, actionTPS_InFileFirst },
- { TPS_InFile, actionTPS_InFile },
- { TPS_InFileNext, actionTPS_InFileNext },
- { TPS_InURIFirst, actionTPS_InURIFirst },
- { TPS_InURIStart, actionTPS_InURIStart },
- { TPS_InURI, actionTPS_InURI },
- { TPS_InFURL, actionTPS_InFURL },
- { TPS_InProtocolFirst, actionTPS_InProtocolFirst },
- { TPS_InProtocolSecond, actionTPS_InProtocolSecond },
- { TPS_InProtocolEnd, actionTPS_InProtocolEnd },
- { TPS_InHyphenLatWordFirst, actionTPS_InHyphenLatWordFirst },
- { TPS_InHyphenLatWord, actionTPS_InHyphenLatWord },
- { TPS_InHyphenCyrWordFirst, actionTPS_InHyphenCyrWordFirst },
- { TPS_InHyphenCyrWord, actionTPS_InHyphenCyrWord },
- { TPS_InHyphenUWordFirst, actionTPS_InHyphenUWordFirst },
- { TPS_InHyphenUWord, actionTPS_InHyphenUWord },
- { TPS_InHyphenValueFirst, actionTPS_InHyphenValueFirst },
- { TPS_InHyphenValue, actionTPS_InHyphenValue },
- { TPS_InHyphenValueExact, actionTPS_InHyphenValueExact },
- { TPS_InParseHyphen, actionTPS_InParseHyphen },
- { TPS_InParseHyphenHyphen, actionTPS_InParseHyphenHyphen },
- { TPS_InHyphenCyrWordPart, actionTPS_InHyphenCyrWordPart },
- { TPS_InHyphenLatWordPart, actionTPS_InHyphenLatWordPart },
- { TPS_InHyphenUWordPart, actionTPS_InHyphenUWordPart },
- { TPS_InHyphenUnsignedInt, actionTPS_InHyphenUnsignedInt },
- { TPS_InHDecimalPartFirst, actionTPS_InHDecimalPartFirst },
- { TPS_InHDecimalPart, actionTPS_InHDecimalPart },
- { TPS_InHVersionPartFirst, actionTPS_InHVersionPartFirst },
- { TPS_InHVersionPart, actionTPS_InHVersionPart },
- { TPS_Null, NULL }
+ {TPS_Base, actionTPS_Base},
+ {TPS_InUWord, actionTPS_InUWord},
+ {TPS_InLatWord, actionTPS_InLatWord},
+ {TPS_InCyrWord, actionTPS_InCyrWord},
+ {TPS_InUnsignedInt, actionTPS_InUnsignedInt},
+ {TPS_InSignedIntFirst, actionTPS_InSignedIntFirst},
+ {TPS_InSignedInt, actionTPS_InSignedInt},
+ {TPS_InSpace, actionTPS_InSpace},
+ {TPS_InUDecimalFirst, actionTPS_InUDecimalFirst},
+ {TPS_InUDecimal, actionTPS_InUDecimal},
+ {TPS_InDecimalFirst, actionTPS_InDecimalFirst},
+ {TPS_InDecimal, actionTPS_InDecimal},
+ {TPS_InVersionFirst, actionTPS_InVersionFirst},
+ {TPS_InVersion, actionTPS_InVersion},
+ {TPS_InMantissaFirst, actionTPS_InMantissaFirst},
+ {TPS_InMantissaSign, actionTPS_InMantissaSign},
+ {TPS_InMantissa, actionTPS_InMantissa},
+ {TPS_InHTMLEntityFirst, actionTPS_InHTMLEntityFirst},
+ {TPS_InHTMLEntity, actionTPS_InHTMLEntity},
+ {TPS_InHTMLEntityNumFirst, actionTPS_InHTMLEntityNumFirst},
+ {TPS_InHTMLEntityNum, actionTPS_InHTMLEntityNum},
+ {TPS_InHTMLEntityEnd, actionTPS_InHTMLEntityEnd},
+ {TPS_InTagFirst, actionTPS_InTagFirst},
+ {TPS_InTagCloseFirst, actionTPS_InTagCloseFirst},
+ {TPS_InTag, actionTPS_InTag},
+ {TPS_InTagEscapeK, actionTPS_InTagEscapeK},
+ {TPS_InTagEscapeKK, actionTPS_InTagEscapeKK},
+ {TPS_InTagBackSleshed, actionTPS_InTagBackSleshed},
+ {TPS_InTagEnd, actionTPS_InTagEnd},
+ {TPS_InCommentFirst, actionTPS_InCommentFirst},
+ {TPS_InCommentLast, actionTPS_InCommentLast},
+ {TPS_InComment, actionTPS_InComment},
+ {TPS_InCloseCommentFirst, actionTPS_InCloseCommentFirst},
+ {TPS_InCloseCommentLast, actionTPS_InCloseCommentLast},
+ {TPS_InCommentEnd, actionTPS_InCommentEnd},
+ {TPS_InHostFirstDomen, actionTPS_InHostFirstDomen},
+ {TPS_InHostDomenSecond, actionTPS_InHostDomenSecond},
+ {TPS_InHostDomen, actionTPS_InHostDomen},
+ {TPS_InPortFirst, actionTPS_InPortFirst},
+ {TPS_InPort, actionTPS_InPort},
+ {TPS_InHostFirstAN, actionTPS_InHostFirstAN},
+ {TPS_InHost, actionTPS_InHost},
+ {TPS_InEmail, actionTPS_InEmail},
+ {TPS_InFileFirst, actionTPS_InFileFirst},
+ {TPS_InFile, actionTPS_InFile},
+ {TPS_InFileNext, actionTPS_InFileNext},
+ {TPS_InURIFirst, actionTPS_InURIFirst},
+ {TPS_InURIStart, actionTPS_InURIStart},
+ {TPS_InURI, actionTPS_InURI},
+ {TPS_InFURL, actionTPS_InFURL},
+ {TPS_InProtocolFirst, actionTPS_InProtocolFirst},
+ {TPS_InProtocolSecond, actionTPS_InProtocolSecond},
+ {TPS_InProtocolEnd, actionTPS_InProtocolEnd},
+ {TPS_InHyphenLatWordFirst, actionTPS_InHyphenLatWordFirst},
+ {TPS_InHyphenLatWord, actionTPS_InHyphenLatWord},
+ {TPS_InHyphenCyrWordFirst, actionTPS_InHyphenCyrWordFirst},
+ {TPS_InHyphenCyrWord, actionTPS_InHyphenCyrWord},
+ {TPS_InHyphenUWordFirst, actionTPS_InHyphenUWordFirst},
+ {TPS_InHyphenUWord, actionTPS_InHyphenUWord},
+ {TPS_InHyphenValueFirst, actionTPS_InHyphenValueFirst},
+ {TPS_InHyphenValue, actionTPS_InHyphenValue},
+ {TPS_InHyphenValueExact, actionTPS_InHyphenValueExact},
+ {TPS_InParseHyphen, actionTPS_InParseHyphen},
+ {TPS_InParseHyphenHyphen, actionTPS_InParseHyphenHyphen},
+ {TPS_InHyphenCyrWordPart, actionTPS_InHyphenCyrWordPart},
+ {TPS_InHyphenLatWordPart, actionTPS_InHyphenLatWordPart},
+ {TPS_InHyphenUWordPart, actionTPS_InHyphenUWordPart},
+ {TPS_InHyphenUnsignedInt, actionTPS_InHyphenUnsignedInt},
+ {TPS_InHDecimalPartFirst, actionTPS_InHDecimalPartFirst},
+ {TPS_InHDecimalPart, actionTPS_InHDecimalPart},
+ {TPS_InHVersionPartFirst, actionTPS_InHVersionPartFirst},
+ {TPS_InHVersionPart, actionTPS_InHVersionPart},
+ {TPS_Null, NULL}
};
bool
-TParserGet( TParser *prs ) {
- TParserStateActionItem *item=NULL;
+TParserGet(TParser * prs)
+{
+ TParserStateActionItem *item = NULL;
- if ( prs->state->posbyte >= prs->lenstr )
+ if (prs->state->posbyte >= prs->lenstr)
return false;
- Assert( prs->state );
- prs->lexeme = prs->str + prs->state->posbyte;
+ Assert(prs->state);
+ prs->lexeme = prs->str + prs->state->posbyte;
prs->state->pushedAtAction = NULL;
/* look at string */
- while (prs->state->posbyte <= prs->lenstr) {
- if ( prs->state->posbyte == prs->lenstr )
+ while (prs->state->posbyte <= prs->lenstr)
+ {
+ if (prs->state->posbyte == prs->lenstr)
prs->state->charlen = 0;
else
- prs->state->charlen = ( prs->charmaxlen == 1 ) ? prs->charmaxlen :
- pg_mblen( prs->str + prs->state->posbyte );
+ prs->state->charlen = (prs->charmaxlen == 1) ? prs->charmaxlen :
+ pg_mblen(prs->str + prs->state->posbyte);
- Assert( prs->state->posbyte + prs->state->charlen <= prs->lenstr );
- Assert( prs->state->state >=TPS_Base && prs->state->state < TPS_Null );
- Assert( Actions[ prs->state->state ].state == prs->state->state );
+ Assert(prs->state->posbyte + prs->state->charlen <= prs->lenstr);
+ Assert(prs->state->state >= TPS_Base && prs->state->state < TPS_Null);
+ Assert(Actions[prs->state->state].state == prs->state->state);
- item = Actions[ prs->state->state ].action;
- Assert(item!=NULL);
+ item = Actions[prs->state->state].action;
+ Assert(item != NULL);
- if ( item < prs->state->pushedAtAction )
- item = prs->state->pushedAtAction;
+ if (item < prs->state->pushedAtAction)
+ item = prs->state->pushedAtAction;
/* find action by character class */
- while( item->isclass ) {
+ while (item->isclass)
+ {
prs->c = item->c;
- if ( item->isclass(prs)!=0 ) {
- if ( item > prs->state->pushedAtAction ) /* remember: after pushing we were by false way */
+ if (item->isclass(prs) != 0)
+ {
+ if (item > prs->state->pushedAtAction) /* remember: after
+ * pushing we were by
+ * false way */
break;
- }
+ }
item++;
}
prs->state->pushedAtAction = NULL;
/* call special handler if exists */
- if ( item->special )
+ if (item->special)
item->special(prs);
/* BINGO, lexeme is found */
- if ( item->flags & A_BINGO ) {
- Assert( item->type>0 );
+ if (item->flags & A_BINGO)
+ {
+ Assert(item->type > 0);
prs->lenbytelexeme = prs->state->lenbytelexeme;
prs->lencharlexeme = prs->state->lencharlexeme;
prs->state->lenbytelexeme = prs->state->lencharlexeme = 0;
prs->type = item->type;
- }
+ }
- /* do various actions by flags */
- if ( item->flags & A_POP ) { /* pop stored state in stack */
+ /* do various actions by flags */
+ if (item->flags & A_POP)
+ { /* pop stored state in stack */
TParserPosition *ptr = prs->state->prev;
- pfree( prs->state );
+
+ pfree(prs->state);
prs->state = ptr;
- Assert( prs->state );
- } else if ( item->flags & A_PUSH ) { /* push (store) state in stack */
- prs->state->pushedAtAction = item; /* remember where we push */
- prs->state = newTParserPosition( prs->state );
- } else if ( item->flags & A_CLEAR ) { /* clear previous pushed state */
+ Assert(prs->state);
+ }
+ else if (item->flags & A_PUSH)
+ { /* push (store) state in stack */
+ prs->state->pushedAtAction = item; /* remember where we push */
+ prs->state = newTParserPosition(prs->state);
+ }
+ else if (item->flags & A_CLEAR)
+ { /* clear previous pushed state */
TParserPosition *ptr;
- Assert( prs->state->prev );
+
+ Assert(prs->state->prev);
ptr = prs->state->prev->prev;
- pfree( prs->state->prev );
+ pfree(prs->state->prev);
prs->state->prev = ptr;
- } else if ( item->flags & A_CLRALL ) { /* clear all previous pushed state */
+ }
+ else if (item->flags & A_CLRALL)
+ { /* clear all previous pushed state */
TParserPosition *ptr;
- while( prs->state->prev ) {
+
+ while (prs->state->prev)
+ {
ptr = prs->state->prev->prev;
- pfree( prs->state->prev );
+ pfree(prs->state->prev);
prs->state->prev = ptr;
}
- } else if ( item->flags & A_MERGE ) { /* merge posinfo with current and pushed state */
+ }
+ else if (item->flags & A_MERGE)
+ { /* merge posinfo with current and pushed state */
TParserPosition *ptr = prs->state;
- Assert( prs->state->prev );
+
+ Assert(prs->state->prev);
prs->state = prs->state->prev;
prs->state->posbyte = ptr->posbyte;
prs->state->charlen = ptr->charlen;
prs->state->lenbytelexeme = ptr->lenbytelexeme;
prs->state->lencharlexeme = ptr->lencharlexeme;
- pfree(ptr);
+ pfree(ptr);
}
/* set new state if pointed */
- if ( item->tostate != TPS_Null )
+ if (item->tostate != TPS_Null)
prs->state->state = item->tostate;
- /* check for go away */
- if ( (item->flags & A_BINGO) || (prs->state->posbyte >= prs->lenstr && (item->flags & A_RERUN)==0 ) )
+ /* check for go away */
+ if ((item->flags & A_BINGO) || (prs->state->posbyte >= prs->lenstr && (item->flags & A_RERUN) == 0))
break;
/* go to begining of loop if we should rerun or we just restore state */
- if ( item->flags & ( A_RERUN | A_POP ) )
+ if (item->flags & (A_RERUN | A_POP))
continue;
-
- /* move forward */
- if ( prs->state->charlen ) {
+
+ /* move forward */
+ if (prs->state->charlen)
+ {
prs->state->posbyte += prs->state->charlen;
prs->state->lenbytelexeme += prs->state->charlen;
- prs->state->poschar ++;
- prs->state->lencharlexeme ++;
+ prs->state->poschar++;
+ prs->state->lencharlexeme++;
}
- }
+ }
return (item && (item->flags & A_BINGO)) ? true : false;
}
-
-
#include <limits.h>
#include "ts_locale.h"
-typedef enum {
+typedef enum
+{
TPS_Base = 0,
TPS_InUWord,
TPS_InLatWord,
TPS_InHDecimalPart,
TPS_InHVersionPartFirst,
TPS_InHVersionPart,
- TPS_Null /* last state (fake value) */
-} TParserState;
+ TPS_Null /* last state (fake value) */
+} TParserState;
/* forward declaration */
struct TParser;
-typedef int (*TParserCharTest)(struct TParser*); /* any p_is* functions except p_iseq */
-typedef void (*TParserSpecial)(struct TParser*); /* special handler for special cases... */
-
-typedef struct {
- TParserCharTest isclass;
- char c;
- uint16 flags;
- TParserState tostate;
- int type;
- TParserSpecial special;
-} TParserStateActionItem;
-
-typedef struct {
- TParserState state;
- TParserStateActionItem *action;
-} TParserStateAction;
-
-typedef struct TParserPosition {
- int posbyte; /* position of parser in bytes */
- int poschar; /* osition of parser in characters */
- int charlen; /* length of current char */
- int lenbytelexeme;
- int lencharlexeme;
- TParserState state;
- struct TParserPosition *prev;
- int flags;
- TParserStateActionItem *pushedAtAction;
-} TParserPosition;
-
-typedef struct TParser {
+typedef int (*TParserCharTest) (struct TParser *); /* any p_is* functions
+ * except p_iseq */
+typedef void (*TParserSpecial) (struct TParser *); /* special handler for
+ * special cases... */
+
+typedef struct
+{
+ TParserCharTest isclass;
+ char c;
+ uint16 flags;
+ TParserState tostate;
+ int type;
+ TParserSpecial special;
+} TParserStateActionItem;
+
+typedef struct
+{
+ TParserState state;
+ TParserStateActionItem *action;
+} TParserStateAction;
+
+typedef struct TParserPosition
+{
+ int posbyte; /* position of parser in bytes */
+ int poschar; /* osition of parser in characters */
+ int charlen; /* length of current char */
+ int lenbytelexeme;
+ int lencharlexeme;
+ TParserState state;
+ struct TParserPosition *prev;
+ int flags;
+ TParserStateActionItem *pushedAtAction;
+} TParserPosition;
+
+typedef struct TParser
+{
/* string and position information */
- char *str; /* multibyte string */
- int lenstr; /* length of mbstring */
- wchar_t *wstr; /* wide character string */
- int lenwstr; /* length of wsting */
+ char *str; /* multibyte string */
+ int lenstr; /* length of mbstring */
+ wchar_t *wstr; /* wide character string */
+ int lenwstr; /* length of wsting */
/* State of parse */
- int charmaxlen;
+ int charmaxlen;
bool usewide;
- TParserPosition *state;
+ TParserPosition *state;
bool ignore;
bool wanthost;
/* silly char */
- char c;
+ char c;
/* out */
- char *lexeme;
- int lenbytelexeme;
- int lencharlexeme;
- int type;
-
-} TParser;
+ char *lexeme;
+ int lenbytelexeme;
+ int lencharlexeme;
+ int type;
+
+} TParser;
-TParser* TParserInit( char *, int );
-bool TParserGet( TParser* );
-void TParserClose( TParser* );
+TParser *TParserInit(char *, int);
+bool TParserGet(TParser *);
+void TParserClose(TParser *);
#endif
Datum
prsd_start(PG_FUNCTION_ARGS)
{
- PG_RETURN_POINTER(TParserInit( (char *) PG_GETARG_POINTER(0), PG_GETARG_INT32(1)));
+ PG_RETURN_POINTER(TParserInit((char *) PG_GETARG_POINTER(0), PG_GETARG_INT32(1)));
}
PG_FUNCTION_INFO_V1(prsd_getlexeme);
Datum
prsd_getlexeme(PG_FUNCTION_ARGS)
{
- TParser *p=(TParser*)PG_GETARG_POINTER(0);
+ TParser *p = (TParser *) PG_GETARG_POINTER(0);
char **t = (char **) PG_GETARG_POINTER(1);
int *tlen = (int *) PG_GETARG_POINTER(2);
- if ( !TParserGet(p) )
+ if (!TParserGet(p))
PG_RETURN_INT32(0);
- *t = p->lexeme;
+ *t = p->lexeme;
*tlen = p->lenbytelexeme;
PG_RETURN_INT32(p->type);
Datum
prsd_end(PG_FUNCTION_ARGS)
{
- TParser *p=(TParser*)PG_GETARG_POINTER(0);
- TParserClose(p);
+ TParser *p = (TParser *) PG_GETARG_POINTER(0);
+
+ TParserClose(p);
PG_RETURN_VOID();
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.103 2005/11/20 19:49:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.104 2005/11/22 18:17:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Now we know that we have to walk the tuple CAREFULLY.
*
- * Note - This loop is a little tricky. For each non-null attribute, we
- * have to first account for alignment padding before the attr, then
- * advance over the attr based on its length. Nulls have no storage
- * and no alignment padding either. We can use/set attcacheoff until
- * we pass either a null or a var-width attribute.
+ * Note - This loop is a little tricky. For each non-null attribute,
+ * we have to first account for alignment padding before the attr,
+ * then advance over the attr based on its length. Nulls have no
+ * storage and no alignment padding either. We can use/set
+ * attcacheoff until we pass either a null or a var-width attribute.
*/
for (i = 0; i < attnum; i++)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.112 2005/10/15 02:49:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.113 2005/11/22 18:17:05 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
* Allocate enough memory for the tuple descriptor, including the
* attribute rows, and set up the attribute row pointers.
*
- * Note: we assume that sizeof(struct tupleDesc) is a multiple of the struct
- * pointer alignment requirement, and hence we don't need to insert
+ * Note: we assume that sizeof(struct tupleDesc) is a multiple of the
+ * struct pointer alignment requirement, and hence we don't need to insert
* alignment padding between the struct and the array of attribute row
* pointers.
*/
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.53 2005/11/06 22:39:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.54 2005/11/22 18:17:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* are the index datum (as a GISTENTRY*), the comparison datum, and
* the comparison operator's strategy number and subtype from pg_amop.
*
- * (Presently there's no need to pass the subtype since it'll always be
- * zero, but might as well pass it for possible future use.)
+ * (Presently there's no need to pass the subtype since it'll always
+ * be zero, but might as well pass it for possible future use.)
*/
test = FunctionCall4(&key->sk_func,
PointerGetDatum(&de),
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.8 2005/11/06 22:39:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.9 2005/11/22 18:17:05 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
Page page = BufferGetPage(buf);
/*
- * ReadBuffer verifies that every newly-read page passes PageHeaderIsValid,
- * which means it either contains a reasonably sane page header or is
- * all-zero. We have to defend against the all-zero case, however.
+ * ReadBuffer verifies that every newly-read page passes
+ * PageHeaderIsValid, which means it either contains a reasonably sane
+ * page header or is all-zero. We have to defend against the all-zero
+ * case, however.
*/
if (PageIsNew(page))
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
- errmsg("index \"%s\" contains unexpected zero page at block %u",
- RelationGetRelationName(rel),
- BufferGetBlockNumber(buf)),
+ errmsg("index \"%s\" contains unexpected zero page at block %u",
+ RelationGetRelationName(rel),
+ BufferGetBlockNumber(buf)),
errhint("Please REINDEX it.")));
/*
break; /* nothing left in FSM */
buffer = ReadBuffer(r, blkno);
+
/*
* We have to guard against the possibility that someone else already
* recycled this page; the buffer may be locked if so.
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.10 2005/11/06 22:39:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.11 2005/11/22 18:17:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
lencompleted = 16;
buffer = ReadBuffer(gv->index, blkno);
+
/*
* This is only used during VACUUM FULL, so we need not bother to lock
* individual index pages
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.48 2005/11/06 19:29:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.49 2005/11/22 18:17:05 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
* It is okay to write-lock the new bitmap page while holding metapage
* write lock, because no one else could be contending for the new page.
*
- * There is some loss of concurrency in possibly doing I/O for the new page
- * while holding the metapage lock, but this path is taken so seldom that
- * it's not worth worrying about.
+ * There is some loss of concurrency in possibly doing I/O for the new
+ * page while holding the metapage lock, but this path is taken so seldom
+ * that it's not worth worrying about.
*/
buf = _hash_getbuf(rel, blkno, HASH_WRITE);
pg = BufferGetPage(buf);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.53 2005/11/06 19:29:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.54 2005/11/22 18:17:05 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
* The lock protects us against other backends, but not against our own
* backend. Must check for active scans separately.
*
- * Ideally we would lock the new bucket too before proceeding, but if we are
- * about to cross a splitpoint then the BUCKET_TO_BLKNO mapping isn't
+ * Ideally we would lock the new bucket too before proceeding, but if we
+ * are about to cross a splitpoint then the BUCKET_TO_BLKNO mapping isn't
* correct yet. For simplicity we update the metapage first and then
* lock. This should be okay because no one else should be trying to lock
* the new bucket yet...
/*
* Okay to proceed with split. Update the metapage bucket mapping info.
*
- * Since we are scribbling on the metapage data right in the shared buffer,
- * any failure in this next little bit leaves us with a big problem: the
- * metapage is effectively corrupt but could get written back to disk. We
- * don't really expect any failure, but just to be sure, establish a
- * critical section.
+ * Since we are scribbling on the metapage data right in the shared
+ * buffer, any failure in this next little bit leaves us with a big
+ * problem: the metapage is effectively corrupt but could get written back
+ * to disk. We don't really expect any failure, but just to be sure,
+ * establish a critical section.
*/
START_CRIT_SECTION();
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.43 2005/11/06 19:29:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.44 2005/11/22 18:17:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Page page = BufferGetPage(buf);
/*
- * ReadBuffer verifies that every newly-read page passes PageHeaderIsValid,
- * which means it either contains a reasonably sane page header or is
- * all-zero. We have to defend against the all-zero case, however.
+ * ReadBuffer verifies that every newly-read page passes
+ * PageHeaderIsValid, which means it either contains a reasonably sane
+ * page header or is all-zero. We have to defend against the all-zero
+ * case, however.
*/
if (PageIsNew(page))
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
- errmsg("index \"%s\" contains unexpected zero page at block %u",
- RelationGetRelationName(rel),
- BufferGetBlockNumber(buf)),
+ errmsg("index \"%s\" contains unexpected zero page at block %u",
+ RelationGetRelationName(rel),
+ BufferGetBlockNumber(buf)),
errhint("Please REINDEX it.")));
/*
* Additionally check that the special area looks sane.
*/
if (((PageHeader) (page))->pd_special !=
- (BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))))
+ (BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))))
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index \"%s\" contains corrupted page at block %u",
if ((opaque->hasho_flag & flags) == 0)
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
- errmsg("index \"%s\" contains corrupted page at block %u",
- RelationGetRelationName(rel),
- BufferGetBlockNumber(buf)),
+ errmsg("index \"%s\" contains corrupted page at block %u",
+ RelationGetRelationName(rel),
+ BufferGetBlockNumber(buf)),
errhint("Please REINDEX it.")));
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.202 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.203 2005/11/22 18:17:06 momjian Exp $
*
*
* INTERFACE ROUTINES
* The return value is the OID assigned to the tuple (either here or by the
* caller), or InvalidOid if no OID. The header fields of *tup are updated
* to match the stored tuple; in particular tup->t_self receives the actual
- * TID where the tuple was stored. But note that any toasting of fields
+ * TID where the tuple was stored. But note that any toasting of fields
* within the tuple data is NOT reflected into *tup.
*/
Oid
* If the new tuple is too big for storage or contains already toasted
* out-of-line attributes from some other relation, invoke the toaster.
*
- * Note: below this point, heaptup is the data we actually intend to
- * store into the relation; tup is the caller's original untoasted data.
+ * Note: below this point, heaptup is the data we actually intend to store
+ * into the relation; tup is the caller's original untoasted data.
*/
if (HeapTupleHasExternal(tup) ||
(MAXALIGN(tup->t_len) > TOAST_TUPLE_THRESHOLD))
/*
* If tuple is cachable, mark it for invalidation from the caches in case
* we abort. Note it is OK to do this after WriteBuffer releases the
- * buffer, because the heaptup data structure is all in local memory,
- * not in the shared buffer.
+ * buffer, because the heaptup data structure is all in local memory, not
+ * in the shared buffer.
*/
CacheInvalidateHeapTuple(relation, heaptup);
* heap_lock_tuple). LockTuple will release us when we are
* next-in-line for the tuple.
*
- * If we are forced to "start over" below, we keep the tuple lock; this
- * arranges that we stay at the head of the line while rechecking
+ * If we are forced to "start over" below, we keep the tuple lock;
+ * this arranges that we stay at the head of the line while rechecking
* tuple state.
*/
if (!have_tuple_lock)
*
* On success, the header fields of *newtup are updated to match the new
* stored tuple; in particular, newtup->t_self is set to the TID where the
- * new tuple was inserted. However, any TOAST changes in the new tuple's
+ * new tuple was inserted. However, any TOAST changes in the new tuple's
* data are not reflected into *newtup.
*
* In the failure cases, the routine returns the tuple's t_ctid and t_xmax.
* heap_lock_tuple). LockTuple will release us when we are
* next-in-line for the tuple.
*
- * If we are forced to "start over" below, we keep the tuple lock; this
- * arranges that we stay at the head of the line while rechecking
+ * If we are forced to "start over" below, we keep the tuple lock;
+ * this arranges that we stay at the head of the line while rechecking
* tuple state.
*/
if (!have_tuple_lock)
* show that it's already being updated, else other processes may try to
* update it themselves.
*
- * We need to invoke the toaster if there are already any out-of-line toasted
- * values present, or if the new tuple is over-threshold.
+ * We need to invoke the toaster if there are already any out-of-line
+ * toasted values present, or if the new tuple is over-threshold.
*/
newtupsize = MAXALIGN(newtup->t_len);
/* NO EREPORT(ERROR) from here till changes are logged */
START_CRIT_SECTION();
- RelationPutHeapTuple(relation, newbuf, heaptup); /* insert new tuple */
+ RelationPutHeapTuple(relation, newbuf, heaptup); /* insert new tuple */
if (!already_marked)
{
* LockTuple will release us when we are next-in-line for the tuple.
* We must do this even if we are share-locking.
*
- * If we are forced to "start over" below, we keep the tuple lock; this
- * arranges that we stay at the head of the line while rechecking
+ * If we are forced to "start over" below, we keep the tuple lock;
+ * this arranges that we stay at the head of the line while rechecking
* tuple state.
*/
if (!have_tuple_lock)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.58 2005/10/15 02:49:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.59 2005/11/22 18:17:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Remember the new page as our target for future insertions.
*
- * XXX should we enter the new page into the free space map immediately, or
- * just keep it for this backend's exclusive use in the short run (until
- * VACUUM sees it)? Seems to depend on whether you expect the current
- * backend to make more insertions or not, which is probably a good bet
- * most of the time. So for now, don't add it to FSM yet.
+ * XXX should we enter the new page into the free space map immediately,
+ * or just keep it for this backend's exclusive use in the short run
+ * (until VACUUM sees it)? Seems to depend on whether you expect the
+ * current backend to make more insertions or not, which is probably a
+ * good bet most of the time. So for now, don't add it to FSM yet.
*/
relation->rd_targblock = BufferGetBlockNumber(buffer);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.55 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.56 2005/11/22 18:17:06 momjian Exp $
*
*
* INTERFACE ROUTINES
* FormIndexDatum: this relies on the knowledge that the index columns
* are the same as the initial columns of the table.
*
- * Note also that there had better not be any user-created index on the
- * TOAST table, since we don't bother to update anything else.
+ * Note also that there had better not be any user-created index on
+ * the TOAST table, since we don't bother to update anything else.
*/
index_insert(toastidx, t_values, t_isnull,
&(toasttup->t_self),
/*
* Read the chunks by index
*
- * Note that because the index is actually on (valueid, chunkidx) we will see
- * the chunks in chunkidx order, even though we didn't explicitly ask for
- * it.
+ * Note that because the index is actually on (valueid, chunkidx) we will
+ * see the chunks in chunkidx order, even though we didn't explicitly ask
+ * for it.
*/
nextidx = 0;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.50 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.51 2005/11/22 18:17:06 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
/*
* Change attribute numbers to be index column numbers.
*
- * This code could be generalized to search for the index key numbers to
- * substitute, but for now there's no need.
+ * This code could be generalized to search for the index key numbers
+ * to substitute, but for now there's no need.
*/
for (i = 0; i < nkeys; i++)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.128 2005/11/06 19:29:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.129 2005/11/22 18:17:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* If we're not allowing duplicates, make sure the key isn't already in
* the index.
*
- * NOTE: obviously, _bt_check_unique can only detect keys that are already in
- * the index; so it cannot defend against concurrent insertions of the
+ * NOTE: obviously, _bt_check_unique can only detect keys that are already
+ * in the index; so it cannot defend against concurrent insertions of the
* same key. We protect against that by means of holding a write lock on
* the target page. Any other would-be inserter of the same key must
* acquire a write lock on the same target page, so only one would-be
* our insertion, so no later inserter can fail to see our insertion.
* (This requires some care in _bt_insertonpg.)
*
- * If we must wait for another xact, we release the lock while waiting, and
- * then must start over completely.
+ * If we must wait for another xact, we release the lock while waiting,
+ * and then must start over completely.
*/
if (index_is_unique)
{
/*
* We can skip items that are marked killed.
*
- * Formerly, we applied _bt_isequal() before checking the kill flag,
- * so as to fall out of the item loop as soon as possible.
+ * Formerly, we applied _bt_isequal() before checking the kill
+ * flag, so as to fall out of the item loop as soon as possible.
* However, in the presence of heavy update activity an index may
* contain many killed items with the same key; running
* _bt_isequal() on each killed item gets expensive. Furthermore
/*
* step right to next non-dead page
*
- * must write-lock that page before releasing write lock on current
- * page; else someone else's _bt_check_unique scan could fail to
- * see our insertion. write locks on intermediate dead pages
- * won't do because we don't know when they will get de-linked
- * from the tree.
+ * must write-lock that page before releasing write lock on
+ * current page; else someone else's _bt_check_unique scan could
+ * fail to see our insertion. write locks on intermediate dead
+ * pages won't do because we don't know when they will get
+ * de-linked from the tree.
*/
Buffer rbuf = InvalidBuffer;
/*
* Do we need to split the page to fit the item on it?
*
- * Note: PageGetFreeSpace() subtracts sizeof(ItemIdData) from its result, so
- * this comparison is correct even though we appear to be accounting only
- * for the item and not for its line pointer.
+ * Note: PageGetFreeSpace() subtracts sizeof(ItemIdData) from its result,
+ * so this comparison is correct even though we appear to be accounting
+ * only for the item and not for its line pointer.
*/
if (PageGetFreeSpace(page) < itemsz)
{
* the next higher level that someone constructed meanwhile, and find the
* right place to insert as for the normal case.
*
- * If we have to search for the parent level, we do so by re-descending from
- * the root. This is not super-efficient, but it's rare enough not to
- * matter. (This path is also taken when called from WAL recovery --- we
- * have no stack in that case.)
+ * If we have to search for the parent level, we do so by re-descending
+ * from the root. This is not super-efficient, but it's rare enough not
+ * to matter. (This path is also taken when called from WAL recovery ---
+ * we have no stack in that case.)
*/
if (is_root)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.89 2005/11/06 19:29:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.90 2005/11/22 18:17:06 momjian Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
Page page = BufferGetPage(buf);
/*
- * ReadBuffer verifies that every newly-read page passes PageHeaderIsValid,
- * which means it either contains a reasonably sane page header or is
- * all-zero. We have to defend against the all-zero case, however.
+ * ReadBuffer verifies that every newly-read page passes
+ * PageHeaderIsValid, which means it either contains a reasonably sane
+ * page header or is all-zero. We have to defend against the all-zero
+ * case, however.
*/
if (PageIsNew(page))
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
- errmsg("index \"%s\" contains unexpected zero page at block %u",
- RelationGetRelationName(rel),
- BufferGetBlockNumber(buf)),
+ errmsg("index \"%s\" contains unexpected zero page at block %u",
+ RelationGetRelationName(rel),
+ BufferGetBlockNumber(buf)),
errhint("Please REINDEX it.")));
/*
/*
* _bt_getbuf() -- Get a buffer by block number for read or write.
*
- * blkno == P_NEW means to get an unallocated index page. The page
+ * blkno == P_NEW means to get an unallocated index page. The page
* will be initialized before returning it.
*
* When this routine returns, the appropriate lock is set on the
* have been re-used between the time the last VACUUM scanned it and
* the time the VACUUM made its FSM updates.)
*
- * In fact, it's worse than that: we can't even assume that it's safe to
- * take a lock on the reported page. If somebody else has a lock on
- * it, or even worse our own caller does, we could deadlock. (The
+ * In fact, it's worse than that: we can't even assume that it's safe
+ * to take a lock on the reported page. If somebody else has a lock
+ * on it, or even worse our own caller does, we could deadlock. (The
* own-caller scenario is actually not improbable. Consider an index
* on a serial or timestamp column. Nearly all splits will be at the
* rightmost page, so it's entirely likely that _bt_split will call us
- * while holding a lock on the page most recently acquired from FSM.
- * A VACUUM running concurrently with the previous split could well
- * have placed that page back in FSM.)
+ * while holding a lock on the page most recently acquired from FSM. A
+ * VACUUM running concurrently with the previous split could well have
+ * placed that page back in FSM.)
*
- * To get around that, we ask for only a conditional lock on the reported
- * page. If we fail, then someone else is using the page, and we may
- * reasonably assume it's not free. (If we happen to be wrong, the
- * worst consequence is the page will be lost to use till the next
- * VACUUM, which is no big problem.)
+ * To get around that, we ask for only a conditional lock on the
+ * reported page. If we fail, then someone else is using the page,
+ * and we may reasonably assume it's not free. (If we happen to be
+ * wrong, the worst consequence is the page will be lost to use till
+ * the next VACUUM, which is no big problem.)
*/
for (;;)
{
* We have to lock the pages we need to modify in the standard order:
* moving right, then up. Else we will deadlock against other writers.
*
- * So, we need to find and write-lock the current left sibling of the target
- * page. The sibling that was current a moment ago could have split, so
- * we may have to move right. This search could fail if either the
- * sibling or the target page was deleted by someone else meanwhile; if
- * so, give up. (Right now, that should never happen, since page deletion
- * is only done in VACUUM and there shouldn't be multiple VACUUMs
+ * So, we need to find and write-lock the current left sibling of the
+ * target page. The sibling that was current a moment ago could have
+ * split, so we may have to move right. This search could fail if either
+ * the sibling or the target page was deleted by someone else meanwhile;
+ * if so, give up. (Right now, that should never happen, since page
+ * deletion is only done in VACUUM and there shouldn't be multiple VACUUMs
* concurrently on the same table.)
*/
if (leftsib != P_NONE)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.133 2005/11/06 19:29:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.134 2005/11/22 18:17:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Save heap TID to use it in _bt_restscan. Then release the read lock on
* the buffer so that we aren't blocking other backends.
*
- * NOTE: we do keep the pin on the buffer! This is essential to ensure that
- * someone else doesn't delete the index entry we are stopped on.
+ * NOTE: we do keep the pin on the buffer! This is essential to ensure
+ * that someone else doesn't delete the index entry we are stopped on.
*/
if (res)
{
/*
* We can't use _bt_getbuf() here because it always applies
- * _bt_checkpage(), which will barf on an all-zero page.
- * We want to recycle all-zero pages, not fail.
+ * _bt_checkpage(), which will barf on an all-zero page. We want to
+ * recycle all-zero pages, not fail.
*/
buf = ReadBuffer(rel, blkno);
LockBuffer(buf, BT_READ);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.96 2005/10/18 01:06:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.97 2005/11/22 18:17:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*
* When nextkey = true: move right if the scan key is >= page's high key.
*
- * The page could even have split more than once, so scan as far as needed.
+ * The page could even have split more than once, so scan as far as
+ * needed.
*
- * We also have to move right if we followed a link that brought us to a dead
- * page.
+ * We also have to move right if we followed a link that brought us to a
+ * dead page.
*/
cmpval = nextkey ? 0 : 1;
* For nextkey=false (cmpval=1), the loop invariant is: all slots before
* 'low' are < scan key, all slots at or after 'high' are >= scan key.
*
- * For nextkey=true (cmpval=0), the loop invariant is: all slots before 'low'
- * are <= scan key, all slots at or after 'high' are > scan key.
+ * For nextkey=true (cmpval=0), the loop invariant is: all slots before
+ * 'low' are <= scan key, all slots at or after 'high' are > scan key.
*
* We can fall out when high == low.
*/
* At this point we have high == low, but be careful: they could point
* past the last slot on the page.
*
- * On a leaf page, we always return the first key >= scan key (resp. > scan
- * key), which could be the last slot + 1.
+ * On a leaf page, we always return the first key >= scan key (resp. >
+ * scan key), which could be the last slot + 1.
*/
if (P_ISLEAF(opaque))
return low;
* you think about how multi-key ordering works, you'll understand why
* this is.
*
- * We don't test for violation of this condition here, however. The initial
- * setup for the index scan had better have gotten it right (see
+ * We don't test for violation of this condition here, however. The
+ * initial setup for the index scan had better have gotten it right (see
* _bt_first).
*/
* where we need to start the scan, and set flag variables to control the
* code below.
*
- * If nextkey = false, _bt_search and _bt_binsrch will locate the first item
- * >= scan key. If nextkey = true, they will locate the first item > scan
- * key.
+ * If nextkey = false, _bt_search and _bt_binsrch will locate the first
+ * item >= scan key. If nextkey = true, they will locate the first item >
+ * scan key.
*
* If goback = true, we will then step back one item, while if goback =
* false, we will start the scan on the located item.
* than or equal to the scan key and we know that everything on later
* pages is greater than scan key.
*
- * The actually desired starting point is either this item or the prior one,
- * or in the end-of-page case it's the first item on the next page or the
- * last item on this page. We apply _bt_step if needed to get to the
+ * The actually desired starting point is either this item or the prior
+ * one, or in the end-of-page case it's the first item on the next page or
+ * the last item on this page. We apply _bt_step if needed to get to the
* right place.
*
* If _bt_step fails (meaning we fell off the end of the index in one
* the original page got deleted and isn't in the sibling chain at all
* anymore, not that its left sibling got split more than four times.
*
- * Note that it is correct to test P_ISDELETED not P_IGNORE here, because
- * half-dead pages are still in the sibling chain. Caller must reject
- * half-dead pages if wanted.
+ * Note that it is correct to test P_ISDELETED not P_IGNORE here,
+ * because half-dead pages are still in the sibling chain. Caller
+ * must reject half-dead pages if wanted.
*/
tries = 0;
for (;;)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.95 2005/10/15 02:49:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.96 2005/11/22 18:17:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* the per-page available space. Note that at this point, btisz doesn't
* include the ItemId.
*
- * NOTE: similar code appears in _bt_insertonpg() to defend against oversize
- * items being inserted into an already-existing index. But during
- * creation of an index, we don't go through there.
+ * NOTE: similar code appears in _bt_insertonpg() to defend against
+ * oversize items being inserted into an already-existing index. But
+ * during creation of an index, we don't go through there.
*/
if (btisz > BTMaxItemSize(npage))
ereport(ERROR,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.65 2005/10/18 01:06:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.66 2005/11/22 18:17:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* able to conclude no further tuples will pass, either. We have
* to look at the scan direction and the qual type.
*
- * Note: the only case in which we would keep going after failing a
- * required qual is if there are partially-redundant quals that
+ * Note: the only case in which we would keep going after failing
+ * a required qual is if there are partially-redundant quals that
* _bt_preprocess_keys() was unable to eliminate. For example,
* given "x > 4 AND x > 10" where both are cross-type comparisons
* and so not removable, we might start the scan at the x = 4
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.12 2005/11/05 21:19:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.13 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* member of a MultiXact, and that MultiXact would have to be created
* during or after the lock acquisition.)
*
- * OldestVisibleMXactId[k] is the oldest MultiXactId each backend's current
- * transaction(s) think is potentially live, or InvalidMultiXactId when
- * not in a transaction or not in a transaction that's paid any attention
- * to MultiXacts yet. This is computed when first needed in a given
- * transaction, and cleared at transaction end. We can compute it as the
- * minimum of the valid OldestMemberMXactId[] entries at the time we
- * compute it (using nextMXact if none are valid). Each backend is
+ * OldestVisibleMXactId[k] is the oldest MultiXactId each backend's
+ * current transaction(s) think is potentially live, or InvalidMultiXactId
+ * when not in a transaction or not in a transaction that's paid any
+ * attention to MultiXacts yet. This is computed when first needed in a
+ * given transaction, and cleared at transaction end. We can compute it
+ * as the minimum of the valid OldestMemberMXactId[] entries at the time
+ * we compute it (using nextMXact if none are valid). Each backend is
* required not to attempt to access any SLRU data for MultiXactIds older
* than its own OldestVisibleMXactId[] setting; this is necessary because
* the checkpointer could truncate away such data at any instant.
*
- * The checkpointer can compute the safe truncation point as the oldest valid
- * value among all the OldestMemberMXactId[] and OldestVisibleMXactId[]
- * entries, or nextMXact if none are valid. Clearly, it is not possible
- * for any later-computed OldestVisibleMXactId value to be older than
- * this, and so there is no risk of truncating data that is still needed.
+ * The checkpointer can compute the safe truncation point as the oldest
+ * valid value among all the OldestMemberMXactId[] and
+ * OldestVisibleMXactId[] entries, or nextMXact if none are valid.
+ * Clearly, it is not possible for any later-computed OldestVisibleMXactId
+ * value to be older than this, and so there is no risk of truncating data
+ * that is still needed.
*/
MultiXactId perBackendXactIds[1]; /* VARIABLE LENGTH ARRAY */
} MultiXactStateData;
}
/*
- * Assign the MXID and offsets range to use, and make sure there is
- * space in the OFFSETs and MEMBERs files. NB: this routine does
+ * Assign the MXID and offsets range to use, and make sure there is space
+ * in the OFFSETs and MEMBERs files. NB: this routine does
* START_CRIT_SECTION().
*/
multi = GetNewMultiXactId(nxids, &offset);
ExtendMultiXactOffset(result);
/*
- * Reserve the members space, similarly to above. Also, be
- * careful not to return zero as the starting offset for any multixact.
- * See GetMultiXactIdMembers() for motivation.
+ * Reserve the members space, similarly to above. Also, be careful not to
+ * return zero as the starting offset for any multixact. See
+ * GetMultiXactIdMembers() for motivation.
*/
nextOffset = MultiXactState->nextOffset;
if (nextOffset == 0)
ExtendMultiXactMember(nextOffset, nxids);
/*
- * Critical section from here until caller has written the data into
- * the just-reserved SLRU space; we don't want to error out with a partly
+ * Critical section from here until caller has written the data into the
+ * just-reserved SLRU space; we don't want to error out with a partly
* written MultiXact structure. (In particular, failing to write our
* start offset after advancing nextMXact would effectively corrupt the
* previous MultiXact.)
* We don't care about MultiXactId wraparound here; it will be handled by
* the next iteration. But note that nextMXact may be InvalidMultiXactId
* after this routine exits, so anyone else looking at the variable must
- * be prepared to deal with that. Similarly, nextOffset may be zero,
- * but we won't use that as the actual start offset of the next multixact.
+ * be prepared to deal with that. Similarly, nextOffset may be zero, but
+ * we won't use that as the actual start offset of the next multixact.
*/
(MultiXactState->nextMXact)++;
* SLRU data if we did try to examine it.
*
* Conversely, an ID >= nextMXact shouldn't ever be seen here; if it is
- * seen, it implies undetected ID wraparound has occurred. We just
+ * seen, it implies undetected ID wraparound has occurred. We just
* silently assume that such an ID is no longer running.
*
* Shared lock is enough here since we aren't modifying any global state.
/*
* Acquire the shared lock just long enough to grab the current counter
- * values. We may need both nextMXact and nextOffset; see below.
+ * values. We may need both nextMXact and nextOffset; see below.
*/
LWLockAcquire(MultiXactGenLock, LW_SHARED);
/*
* Find out the offset at which we need to start reading MultiXactMembers
- * and the number of members in the multixact. We determine the latter
- * as the difference between this multixact's starting offset and the
- * next one's. However, there are some corner cases to worry about:
+ * and the number of members in the multixact. We determine the latter as
+ * the difference between this multixact's starting offset and the next
+ * one's. However, there are some corner cases to worry about:
*
- * 1. This multixact may be the latest one created, in which case there
- * is no next one to look at. In this case the nextOffset value we just
+ * 1. This multixact may be the latest one created, in which case there is
+ * no next one to look at. In this case the nextOffset value we just
* saved is the correct endpoint.
*
- * 2. The next multixact may still be in process of being filled in:
- * that is, another process may have done GetNewMultiXactId but not yet
- * written the offset entry for that ID. In that scenario, it is
- * guaranteed that the offset entry for that multixact exists (because
- * GetNewMultiXactId won't release MultiXactGenLock until it does)
- * but contains zero (because we are careful to pre-zero offset pages).
- * Because GetNewMultiXactId will never return zero as the starting offset
- * for a multixact, when we read zero as the next multixact's offset, we
- * know we have this case. We sleep for a bit and try again.
+ * 2. The next multixact may still be in process of being filled in: that
+ * is, another process may have done GetNewMultiXactId but not yet written
+ * the offset entry for that ID. In that scenario, it is guaranteed that
+ * the offset entry for that multixact exists (because GetNewMultiXactId
+ * won't release MultiXactGenLock until it does) but contains zero
+ * (because we are careful to pre-zero offset pages). Because
+ * GetNewMultiXactId will never return zero as the starting offset for a
+ * multixact, when we read zero as the next multixact's offset, we know we
+ * have this case. We sleep for a bit and try again.
*
- * 3. Because GetNewMultiXactId increments offset zero to offset one
- * to handle case #2, there is an ambiguity near the point of offset
- * wraparound. If we see next multixact's offset is one, is that our
+ * 3. Because GetNewMultiXactId increments offset zero to offset one to
+ * handle case #2, there is an ambiguity near the point of offset
+ * wraparound. If we see next multixact's offset is one, is that our
* multixact's actual endpoint, or did it end at zero with a subsequent
* increment? We handle this using the knowledge that if the zero'th
* member slot wasn't filled, it'll contain zero, and zero isn't a valid
*
* We use a control LWLock to protect the shared data structures, plus
* per-buffer LWLocks that synchronize I/O for each buffer. The control lock
- * must be held to examine or modify any shared state. A process that is
+ * must be held to examine or modify any shared state. A process that is
* reading in or writing out a page buffer does not hold the control lock,
* only the per-buffer lock for the buffer it is working on.
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.30 2005/11/05 21:19:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.31 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
LWLockAcquire(shared->buffer_locks[slotno], LW_SHARED);
LWLockRelease(shared->buffer_locks[slotno]);
LWLockAcquire(shared->ControlLock, LW_EXCLUSIVE);
+
/*
* If the slot is still in an io-in-progress state, then either someone
* already started a new I/O on the slot, or a previous I/O failed and
- * neglected to reset the page state. That shouldn't happen, really,
- * but it seems worth a few extra cycles to check and recover from it.
- * We can cheaply test for failure by seeing if the buffer lock is still
- * held (we assume that transaction abort would release the lock).
+ * neglected to reset the page state. That shouldn't happen, really, but
+ * it seems worth a few extra cycles to check and recover from it. We can
+ * cheaply test for failure by seeing if the buffer lock is still held (we
+ * assume that transaction abort would release the lock).
*/
if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS ||
shared->page_status[slotno] == SLRU_PAGE_WRITE_IN_PROGRESS)
/* indeed, the I/O must have failed */
if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS)
shared->page_status[slotno] = SLRU_PAGE_EMPTY;
- else /* write_in_progress */
+ else
+ /* write_in_progress */
{
shared->page_status[slotno] = SLRU_PAGE_VALID;
shared->page_dirty[slotno] = true;
}
/*
- * Do nothing if page is not dirty, or if buffer no longer contains
- * the same page we were called for.
+ * Do nothing if page is not dirty, or if buffer no longer contains the
+ * same page we were called for.
*/
if (!shared->page_dirty[slotno] ||
shared->page_status[slotno] != SLRU_PAGE_VALID ||
return;
/*
- * Mark the slot write-busy, and clear the dirtybit. After this point,
- * a transaction status update on this page will mark it dirty again.
+ * Mark the slot write-busy, and clear the dirtybit. After this point, a
+ * transaction status update on this page will mark it dirty again.
*/
shared->page_status[slotno] = SLRU_PAGE_WRITE_IN_PROGRESS;
shared->page_dirty[slotno] = false;
/*
* Hmm, we have (or may have) I/O operations acting on the page, so
* we've got to wait for them to finish and then start again. This is
- * the same logic as in SlruSelectLRUPage. (XXX if page is dirty,
+ * the same logic as in SlruSelectLRUPage. (XXX if page is dirty,
* wouldn't it be OK to just discard it without writing it? For now,
* keep the logic the same as it was.)
*/
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/subtrans.c,v 1.12 2005/11/05 21:19:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/subtrans.c,v 1.13 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Flush dirty SUBTRANS pages to disk
*
- * This is not actually necessary from a correctness point of view. We do it
- * merely as a debugging aid.
+ * This is not actually necessary from a correctness point of view. We do
+ * it merely as a debugging aid.
*/
SimpleLruFlush(SubTransCtl, false);
}
/*
* Flush dirty SUBTRANS pages to disk
*
- * This is not actually necessary from a correctness point of view. We do it
- * merely to improve the odds that writing of dirty pages is done by the
- * checkpoint process and not by backends.
+ * This is not actually necessary from a correctness point of view. We do
+ * it merely to improve the odds that writing of dirty pages is done by
+ * the checkpoint process and not by backends.
*/
SimpleLruFlush(SubTransCtl, true);
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/transam.c,v 1.66 2005/10/15 02:49:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/transam.c,v 1.67 2005/11/22 18:17:07 momjian Exp $
*
* NOTES
* This file contains the high level access-method interface to the
* pg_subtrans; instead assume that the parent crashed without cleaning up
* its children.
*
- * Originally we Assert'ed that the result of SubTransGetParent was not zero.
- * However with the introduction of prepared transactions, there can be a
- * window just after database startup where we do not have complete
+ * Originally we Assert'ed that the result of SubTransGetParent was not
+ * zero. However with the introduction of prepared transactions, there can
+ * be a window just after database startup where we do not have complete
* knowledge in pg_subtrans of the transactions after TransactionXmin.
* StartupSUBTRANS() has ensured that any missing information will be
* zeroed. Since this case should not happen under normal conditions, it
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.16 2005/10/29 00:31:50 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.17 2005/11/22 18:17:07 momjian Exp $
*
* NOTES
* Each global transaction is associated with a global transaction
/*
* Create the 2PC state file.
*
- * Note: because we use BasicOpenFile(), we are responsible for ensuring the
- * FD gets closed in any error exit path. Once we get into the critical
- * section, though, it doesn't matter since any failure causes PANIC
- * anyway.
+ * Note: because we use BasicOpenFile(), we are responsible for ensuring
+ * the FD gets closed in any error exit path. Once we get into the
+ * critical section, though, it doesn't matter since any failure causes
+ * PANIC anyway.
*/
TwoPhaseFilePath(path, xid);
* The state file isn't valid yet, because we haven't written the correct
* CRC yet. Before we do that, insert entry in WAL and flush it to disk.
*
- * Between the time we have written the WAL entry and the time we write out
- * the correct state file CRC, we have an inconsistency: the xact is
+ * Between the time we have written the WAL entry and the time we write
+ * out the correct state file CRC, we have an inconsistency: the xact is
* prepared according to WAL but not according to our on-disk state. We
* use a critical section to force a PANIC if we are unable to complete
* the write --- then, WAL replay should repair the inconsistency. The
* it just long enough to make a list of the XIDs that require fsyncing,
* and then do the I/O afterwards.
*
- * This approach creates a race condition: someone else could delete a GXACT
- * between the time we release TwoPhaseStateLock and the time we try to
- * open its state file. We handle this by special-casing ENOENT failures:
- * if we see that, we verify that the GXACT is no longer valid, and if so
- * ignore the failure.
+ * This approach creates a race condition: someone else could delete a
+ * GXACT between the time we release TwoPhaseStateLock and the time we try
+ * to open its state file. We handle this by special-casing ENOENT
+ * failures: if we see that, we verify that the GXACT is no longer valid,
+ * and if so ignore the failure.
*/
if (max_prepared_xacts <= 0)
return; /* nothing to do */
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.68 2005/10/29 00:31:50 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.69 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* (which gives an escape hatch to the DBA who ignored all those
* warnings).
*
- * Test is coded to fall out as fast as possible during normal operation, ie,
- * when the warn limit is set and we haven't violated it.
+ * Test is coded to fall out as fast as possible during normal operation,
+ * ie, when the warn limit is set and we haven't violated it.
*/
if (TransactionIdFollowsOrEquals(xid, ShmemVariableCache->xidWarnLimit) &&
TransactionIdIsValid(ShmemVariableCache->xidWarnLimit))
* right after a wrap occurs, so as to avoid a possibly large number of
* iterations in GetNewOid.) Note we are relying on unsigned comparison.
*
- * During initdb, we start the OID generator at FirstBootstrapObjectId, so we
- * only enforce wrapping to that point when in bootstrap or standalone
+ * During initdb, we start the OID generator at FirstBootstrapObjectId, so
+ * we only enforce wrapping to that point when in bootstrap or standalone
* mode. The first time through this routine after normal postmaster
* start, the counter will be forced up to FirstNormalObjectId. This
* mechanism leaves the OIDs between FirstBootstrapObjectId and
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.215 2005/10/15 02:49:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.216 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* XLOG record generated by nextval will hit the disk before we report
* the transaction committed.
*
- * Note: if we generated a commit record above, MyXactMadeXLogEntry will
- * certainly be set now.
+ * Note: if we generated a commit record above, MyXactMadeXLogEntry
+ * will certainly be set now.
*/
if (MyXactMadeXLogEntry)
{
* because on most Unixen, the minimum select() delay is 10msec or
* more, which is way too long.)
*
- * We do not sleep if enableFsync is not turned on, nor if there are
- * fewer than CommitSiblings other backends with active
+ * We do not sleep if enableFsync is not turned on, nor if there
+ * are fewer than CommitSiblings other backends with active
* transactions.
*/
if (CommitDelay > 0 && enableFsync &&
* nowhere in permanent storage, so no one else will ever care if it
* committed.)
*
- * We do not flush XLOG to disk unless deleting files, since the default
- * assumption after a crash would be that we aborted, anyway. For the
- * same reason, we don't need to worry about interlocking against
- * checkpoint start.
+ * We do not flush XLOG to disk unless deleting files, since the
+ * default assumption after a crash would be that we aborted, anyway.
+ * For the same reason, we don't need to worry about interlocking
+ * against checkpoint start.
*/
if (MyLastRecPtr.xrecoff != 0 || nrels > 0)
{
* Mark the transaction aborted in clog. This is not absolutely
* necessary but we may as well do it while we are here.
*
- * The ordering here isn't critical but it seems best to mark the parent
- * first. This assures an atomic transition of all the
+ * The ordering here isn't critical but it seems best to mark the
+ * parent first. This assures an atomic transition of all the
* subtransactions to aborted state from the point of view of
* concurrent TransactionIdDidAbort calls.
*/
* it's too late to abort the transaction. This should be just
* noncritical resource releasing.
*
- * The ordering of operations is not entirely random. The idea is: release
- * resources visible to other backends (eg, files, buffer pins); then
- * release locks; then release backend-local resources. We want to release
- * locks at the point where any backend waiting for us will see our
- * transaction as being fully cleaned up.
+ * The ordering of operations is not entirely random. The idea is:
+ * release resources visible to other backends (eg, files, buffer pins);
+ * then release locks; then release backend-local resources. We want to
+ * release locks at the point where any backend waiting for us will see
+ * our transaction as being fully cleaned up.
*
* Resources that can be associated with individual queries are handled by
* the ResourceOwner mechanism. The other calls here are for backend-wide
* Do pre-commit processing (most of this stuff requires database access,
* and in fact could still cause an error...)
*
- * It is possible for PrepareHoldablePortals to invoke functions that queue
- * deferred triggers, and it's also possible that triggers create holdable
- * cursors. So we have to loop until there's nothing left to do.
+ * It is possible for PrepareHoldablePortals to invoke functions that
+ * queue deferred triggers, and it's also possible that triggers create
+ * holdable cursors. So we have to loop until there's nothing left to do.
*/
for (;;)
{
/*
* Here is where we really truly prepare.
*
- * We have to record transaction prepares even if we didn't make any updates,
- * because the transaction manager might get confused if we lose a global
- * transaction.
+ * We have to record transaction prepares even if we didn't make any
+ * updates, because the transaction manager might get confused if we lose
+ * a global transaction.
*/
EndPrepare(gxact);
* s->currentUser, since it may not be set yet; instead rely on internal
* state of miscinit.c.
*
- * (Note: it is not necessary to restore session authorization here because
- * that can only be changed via GUC, and GUC will take care of rolling it
- * back if need be. However, an error within a SECURITY DEFINER function
- * could send control here with the wrong current userid.)
+ * (Note: it is not necessary to restore session authorization here
+ * because that can only be changed via GUC, and GUC will take care of
+ * rolling it back if need be. However, an error within a SECURITY
+ * DEFINER function could send control here with the wrong current
+ * userid.)
*/
AtAbort_UserId();
/*
* Here, we are already in an aborted transaction state and are
- * waiting for a ROLLBACK, but for some reason we failed again!
- * So we just remain in the abort state.
+ * waiting for a ROLLBACK, but for some reason we failed again! So
+ * we just remain in the abort state.
*/
case TBLOCK_ABORT:
case TBLOCK_SUBABORT:
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.222 2005/10/29 00:31:50 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.223 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* the whole record in the order "rdata, then backup blocks, then record
* header".
*
- * We may have to loop back to here if a race condition is detected below. We
- * could prevent the race by doing all this work while holding the insert
- * lock, but it seems better to avoid doing CRC calculations while holding
- * the lock. This means we have to be careful about modifying the rdata
- * chain until we know we aren't going to loop back again. The only
+ * We may have to loop back to here if a race condition is detected below.
+ * We could prevent the race by doing all this work while holding the
+ * insert lock, but it seems better to avoid doing CRC calculations while
+ * holding the lock. This means we have to be careful about modifying the
+ * rdata chain until we know we aren't going to loop back again. The only
* change we allow ourselves to make earlier is to set rdt->data = NULL in
* chain items we have decided we will have to back up the whole buffer
* for. This is OK because we will certainly decide the same thing again
* now irrevocably changed the input rdata chain. At the exit of this
* loop, write_len includes the backup block data.
*
- * Also set the appropriate info bits to show which buffers were backed up.
- * The i'th XLR_SET_BKP_BLOCK bit corresponds to the i'th distinct buffer
- * value (ignoring InvalidBuffer) appearing in the rdata chain.
+ * Also set the appropriate info bits to show which buffers were backed
+ * up. The i'th XLR_SET_BKP_BLOCK bit corresponds to the i'th distinct
+ * buffer value (ignoring InvalidBuffer) appearing in the rdata chain.
*/
write_len = len;
for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++)
* problem; most likely, the requested flush point is past end of XLOG.
* This has been seen to occur when a disk page has a corrupted LSN.
*
- * Formerly we treated this as a PANIC condition, but that hurts the system's
- * robustness rather than helping it: we do not want to take down the
- * whole system due to corruption on one data page. In particular, if the
- * bad page is encountered again during recovery then we would be unable
- * to restart the database at all! (This scenario has actually happened
- * in the field several times with 7.1 releases. Note that we cannot get
- * here while InRedo is true, but if the bad page is brought in and marked
- * dirty during recovery then CreateCheckPoint will try to flush it at the
- * end of recovery.)
+ * Formerly we treated this as a PANIC condition, but that hurts the
+ * system's robustness rather than helping it: we do not want to take down
+ * the whole system due to corruption on one data page. In particular, if
+ * the bad page is encountered again during recovery then we would be
+ * unable to restart the database at all! (This scenario has actually
+ * happened in the field several times with 7.1 releases. Note that we
+ * cannot get here while InRedo is true, but if the bad page is brought in
+ * and marked dirty during recovery then CreateCheckPoint will try to
+ * flush it at the end of recovery.)
*
- * The current approach is to ERROR under normal conditions, but only WARNING
- * during recovery, so that the system can be brought up even if there's a
- * corrupt LSN. Note that for calls from xact.c, the ERROR will be
- * promoted to PANIC since xact.c calls this routine inside a critical
+ * The current approach is to ERROR under normal conditions, but only
+ * WARNING during recovery, so that the system can be brought up even if
+ * there's a corrupt LSN. Note that for calls from xact.c, the ERROR will
+ * be promoted to PANIC since xact.c calls this routine inside a critical
* section. However, calls from bufmgr.c are not within critical sections
* and so we will not force a restart for a bad LSN on a data page.
*/
* preserved correctly when we copied to archive. Our aim is robustness,
* so we elect not to do this.
*
- * If we cannot obtain the log file from the archive, however, we will try to
- * use the XLOGDIR file if it exists. This is so that we can make use of
- * log segments that weren't yet transferred to the archive.
+ * If we cannot obtain the log file from the archive, however, we will try
+ * to use the XLOGDIR file if it exists. This is so that we can make use
+ * of log segments that weren't yet transferred to the archive.
*
- * Notice that we don't actually overwrite any files when we copy back from
- * archive because the recoveryRestoreCommand may inadvertently restore
- * inappropriate xlogs, or they may be corrupt, so we may wish to fallback
- * to the segments remaining in current XLOGDIR later. The
+ * Notice that we don't actually overwrite any files when we copy back
+ * from archive because the recoveryRestoreCommand may inadvertently
+ * restore inappropriate xlogs, or they may be corrupt, so we may wish to
+ * fallback to the segments remaining in current XLOGDIR later. The
* copy-from-archive filename is always the same, ensuring that we don't
* run out of disk space on long recoveries.
*/
* command apparently succeeded, but let's make sure the file is
* really there now and has the correct size.
*
- * XXX I made wrong-size a fatal error to ensure the DBA would notice it,
- * but is that too strong? We could try to plow ahead with a local
- * copy of the file ... but the problem is that there probably isn't
- * one, and we'd incorrectly conclude we've reached the end of WAL and
- * we're done recovering ...
+ * XXX I made wrong-size a fatal error to ensure the DBA would notice
+ * it, but is that too strong? We could try to plow ahead with a
+ * local copy of the file ... but the problem is that there probably
+ * isn't one, and we'd incorrectly conclude we've reached the end of
+ * WAL and we're done recovering ...
*/
if (stat(xlogpath, &stat_buf) == 0)
{
/*
* Do compatibility checking immediately. We do this here for 2 reasons:
*
- * (1) if the database isn't compatible with the backend executable, we want
- * to abort before we can possibly do any damage;
+ * (1) if the database isn't compatible with the backend executable, we
+ * want to abort before we can possibly do any damage;
*
* (2) this code is executed in the postmaster, so the setlocale() will
* propagate to forked backends, which aren't going to read this file for
* descriptive of what our current database state is, because that is what
* we replayed from.
*
- * Note that if we are establishing a new timeline, ThisTimeLineID is already
- * set to the new value, and so we will create a new file instead of
- * overwriting any existing file.
+ * Note that if we are establishing a new timeline, ThisTimeLineID is
+ * already set to the new value, and so we will create a new file instead
+ * of overwriting any existing file.
*/
snprintf(recoveryPath, MAXPGPATH, XLOGDIR "/RECOVERYXLOG");
XLogFilePath(xlogpath, ThisTimeLineID, endLogId, endLogSeg);
/*
* Read control file and check XLOG status looks valid.
*
- * Note: in most control paths, *ControlFile is already valid and we need not
- * do ReadControlFile() here, but might as well do it to be sure.
+ * Note: in most control paths, *ControlFile is already valid and we need
+ * not do ReadControlFile() here, but might as well do it to be sure.
*/
ReadControlFile();
/*
* Perform a new checkpoint to update our recovery activity to disk.
*
- * Note that we write a shutdown checkpoint rather than an on-line one.
- * This is not particularly critical, but since we may be assigning a
- * new TLI, using a shutdown checkpoint allows us to have the rule
- * that TLI only changes in shutdown checkpoints, which allows some
- * extra error checking in xlog_redo.
+ * Note that we write a shutdown checkpoint rather than an on-line
+ * one. This is not particularly critical, but since we may be
+ * assigning a new TLI, using a shutdown checkpoint allows us to have
+ * the rule that TLI only changes in shutdown checkpoints, which
+ * allows some extra error checking in xlog_redo.
*
- * In case we had to use the secondary checkpoint, make sure that it will
- * still be shown as the secondary checkpoint after this
+ * In case we had to use the secondary checkpoint, make sure that it
+ * will still be shown as the secondary checkpoint after this
* CreateCheckPoint operation; we don't want the broken primary
* checkpoint to become prevCheckPoint...
*/
* (Perhaps it'd make even more sense to checkpoint only when the previous
* checkpoint record is in a different xlog page?)
*
- * We have to make two tests to determine that nothing has happened since the
- * start of the last checkpoint: current insertion point must match the
- * end of the last checkpoint record, and its redo pointer must point to
- * itself.
+ * We have to make two tests to determine that nothing has happened since
+ * the start of the last checkpoint: current insertion point must match
+ * the end of the last checkpoint record, and its redo pointer must point
+ * to itself.
*/
if (!shutdown && !force)
{
* Having constructed the checkpoint record, ensure all shmem disk buffers
* and commit-log buffers are flushed to disk.
*
- * This I/O could fail for various reasons. If so, we will fail to complete
- * the checkpoint, but there is no reason to force a system panic.
- * Accordingly, exit critical section while doing it. (If we are doing a
- * shutdown checkpoint, we probably *should* panic --- but that will
- * happen anyway because we'll still be inside the critical section
+ * This I/O could fail for various reasons. If so, we will fail to
+ * complete the checkpoint, but there is no reason to force a system
+ * panic. Accordingly, exit critical section while doing it. (If we are
+ * doing a shutdown checkpoint, we probably *should* panic --- but that
+ * will happen anyway because we'll still be inside the critical section
* established by ShutdownXLOG.)
*/
END_CRIT_SECTION();
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.208 2005/10/20 20:05:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.209 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Process bootstrap input.
*
- * the sed script boot.sed renamed yyparse to Int_yyparse for the bootstrap
- * parser to avoid conflicts with the normal SQL parser
+ * the sed script boot.sed renamed yyparse to Int_yyparse for the
+ * bootstrap parser to avoid conflicts with the normal SQL parser
*/
Int_yyparse();
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.121 2005/11/21 12:49:30 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.122 2005/11/22 18:17:07 momjian Exp $
*
* NOTES
* See acl.h.
foreach(j, grantees)
{
- AclItem aclitem;
+ AclItem aclitem;
Acl *newer_acl;
- aclitem.ai_grantee = lfirst_oid(j);
+ aclitem. ai_grantee = lfirst_oid(j);
/*
* Grant options can only be granted to individual roles, not PUBLIC.
AclMode privileges;
ListCell *cell;
bool all_privs;
- AclMode all_privileges = (AclMode) 0;
- char *errormsg = NULL;
+ AclMode all_privileges = (AclMode) 0;
+ char *errormsg = NULL;
/*
* Convert the PrivGrantee list into an Oid list. Note that at this point
* we insert an ACL_ID_PUBLIC into the list if an empty role name is
* detected (which is what the grammar uses if PUBLIC is found), so
- * downstream there shouldn't be any additional work needed to support this
- * case.
+ * downstream there shouldn't be any additional work needed to support
+ * this case.
*/
foreach(cell, stmt->grantees)
{
/*
* ExecGrantStmt_oids
*
- * "Internal" entrypoint for granting and revoking privileges. The arguments
+ * "Internal" entrypoint for granting and revoking privileges. The arguments
* it receives are lists of Oids or have been otherwise converted from text
* format to internal format.
*/
static List *
objectNamesToOids(GrantObjectType objtype, List *objnames)
{
- List *objects = NIL;
- ListCell *cell;
+ List *objects = NIL;
+ ListCell *cell;
Assert(objnames != NIL);
foreach(cell, objnames)
{
char *dbname = strVal(lfirst(cell));
- ScanKeyData entry[1];
+ ScanKeyData entry[1];
HeapScanDesc scan;
HeapTuple tuple;
Relation relation;
relation = heap_open(DatabaseRelationId, AccessShareLock);
/*
- * There's no syscache for pg_database, so we must
- * look the hard way.
+ * There's no syscache for pg_database, so we must look the
+ * hard way.
*/
ScanKeyInit(&entry[0],
Anum_pg_database_datname,
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE),
- errmsg("database \"%s\" does not exist", dbname)));
+ errmsg("database \"%s\" does not exist", dbname)));
objects = lappend_oid(objects, HeapTupleGetOid(tuple));
heap_close(relation, AccessShareLock);
case ACL_OBJECT_LANGUAGE:
foreach(cell, objnames)
{
- char *langname = strVal(lfirst(cell));
- HeapTuple tuple;
+ char *langname = strVal(lfirst(cell));
+ HeapTuple tuple;
tuple = SearchSysCache(LANGNAME,
PointerGetDatum(langname),
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("language \"%s\" does not exist", langname)));
+ errmsg("language \"%s\" does not exist", langname)));
objects = lappend_oid(objects, HeapTupleGetOid(tuple));
}
break;
case ACL_OBJECT_NAMESPACE:
- foreach (cell, objnames)
+ foreach(cell, objnames)
{
char *nspname = strVal(lfirst(cell));
HeapTuple tuple;
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
- errmsg("schema \"%s\" does not exist", nspname)));
+ errmsg("schema \"%s\" does not exist", nspname)));
objects = lappend_oid(objects, HeapTupleGetOid(tuple));
}
break;
case ACL_OBJECT_TABLESPACE:
- foreach (cell, objnames)
+ foreach(cell, objnames)
{
- char *spcname = strVal(lfirst(cell));
- ScanKeyData entry[1];
- HeapScanDesc scan;
- HeapTuple tuple;
- Relation relation;
+ char *spcname = strVal(lfirst(cell));
+ ScanKeyData entry[1];
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ Relation relation;
relation = heap_open(TableSpaceRelationId, AccessShareLock);
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("tablespace \"%s\" does not exist", spcname)));
+ errmsg("tablespace \"%s\" does not exist", spcname)));
objects = lappend_oid(objects, HeapTupleGetOid(tuple));
relation = heap_open(RelationRelationId, RowExclusiveLock);
- foreach (cell, objects)
+ foreach(cell, objects)
{
Oid relOid = lfirst_oid(cell);
Datum aclDatum;
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is a composite type",
NameStr(pg_class_tuple->relname))));
+
/*
* Get owner ID and working copy of existing ACL. If there's no ACL,
* substitute the proper default.
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
- foreach (cell, objects)
+ foreach(cell, objects)
{
Oid datId = lfirst_oid(cell);
Form_pg_database pg_database_tuple;
relation = heap_open(ProcedureRelationId, RowExclusiveLock);
- foreach (cell, objects)
+ foreach(cell, objects)
{
Oid funcId = lfirst_oid(cell);
Form_pg_proc pg_proc_tuple;
CatalogUpdateIndexes(relation, newtuple);
/* Update the shared dependency ACL info */
- updateAclDependencies(ProcedureRelationId, funcId,
+ updateAclDependencies(ProcedureRelationId, funcId,
ownerId, is_grant,
noldmembers, oldmembers,
nnewmembers, newmembers);
relation = heap_open(LanguageRelationId, RowExclusiveLock);
- foreach (cell, objects)
+ foreach(cell, objects)
{
Oid langid = lfirst_oid(cell);
Form_pg_language pg_language_tuple;
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("language \"%s\" is not trusted",
NameStr(pg_language_tuple->lanname)),
- errhint("Only superusers may use untrusted languages.")));
+ errhint("Only superusers may use untrusted languages.")));
/*
* Get owner ID and working copy of existing ACL. If there's no ACL,
* substitute the proper default.
*
- * Note: for now, languages are treated as owned by the bootstrap user.
- * We should add an owner column to pg_language instead.
+ * Note: for now, languages are treated as owned by the bootstrap
+ * user. We should add an owner column to pg_language instead.
*/
ownerId = BOOTSTRAP_SUPERUSERID;
aclDatum = SysCacheGetAttr(LANGNAME, tuple, Anum_pg_language_lanacl,
static void
ExecGrant_Namespace(bool is_grant, List *objects, bool all_privs,
- AclMode privileges, List *grantees, bool grant_option,
- DropBehavior behavior)
+ AclMode privileges, List *grantees, bool grant_option,
+ DropBehavior behavior)
{
Relation relation;
ListCell *cell;
int nnewmembers;
Oid *oldmembers;
Oid *newmembers;
- ScanKeyData entry[1];
+ ScanKeyData entry[1];
SysScanDesc scan;
HeapTuple tuple;
AclMode result;
Relation pg_database;
ScanKeyData entry[1];
- SysScanDesc scan;
+ SysScanDesc scan;
HeapTuple tuple;
Datum aclDatum;
bool isNull;
* the namespace. If we don't have CREATE TEMP, act as though we have
* only USAGE (and not CREATE) rights.
*
- * This may seem redundant given the check in InitTempTableNamespace, but it
- * really isn't since current user ID may have changed since then. The
+ * This may seem redundant given the check in InitTempTableNamespace, but
+ * it really isn't since current user ID may have changed since then. The
* upshot of this behavior is that a SECURITY DEFINER function can create
* temp tables that can then be accessed (if permission is granted) by
* code in the same session that doesn't have permissions to create temp
AclMode result;
Relation pg_tablespace;
ScanKeyData entry[1];
- SysScanDesc scan;
+ SysScanDesc scan;
HeapTuple tuple;
Datum aclDatum;
bool isNull;
{
Relation pg_tablespace;
ScanKeyData entry[1];
- SysScanDesc scan;
+ SysScanDesc scan;
HeapTuple spctuple;
Oid spcowner;
{
Relation pg_database;
ScanKeyData entry[1];
- SysScanDesc scan;
+ SysScanDesc scan;
HeapTuple dbtuple;
Oid dba;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.47 2005/10/15 02:49:12 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.48 2005/11/22 18:17:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* that depend on it. For each one that is AUTO or INTERNAL, visit the
* referencing object.
*
- * When dropping a whole object (subId = 0), find pg_depend records for its
- * sub-objects too.
+ * When dropping a whole object (subId = 0), find pg_depend records for
+ * its sub-objects too.
*/
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
* avoid infinite recursion in the case of cycles. Also, some dependency
* types require extra processing here.
*
- * When dropping a whole object (subId = 0), remove all pg_depend records for
- * its sub-objects too.
+ * When dropping a whole object (subId = 0), remove all pg_depend records
+ * for its sub-objects too.
*/
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.292 2005/10/18 01:06:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.293 2005/11/22 18:17:08 momjian Exp $
*
*
* INTERFACE ROUTINES
/*
* Allocate an OID for the relation, unless we were told what to use.
*
- * The OID will be the relfilenode as well, so make sure it doesn't collide
- * with either pg_class OIDs or existing physical files.
+ * The OID will be the relfilenode as well, so make sure it doesn't
+ * collide with either pg_class OIDs or existing physical files.
*/
if (!OidIsValid(relid))
relid = GetNewRelFileNode(reltablespace, shared_relation,
* since defining a relation also defines a complex type, we add a new
* system type corresponding to the new relation.
*
- * NOTE: we could get a unique-index failure here, in case the same name has
- * already been used for a type.
+ * NOTE: we could get a unique-index failure here, in case the same name
+ * has already been used for a type.
*/
new_type_oid = AddNewRelationType(relname,
relnamespace,
/*
* store constraints and defaults passed in the tupdesc, if any.
*
- * NB: this may do a CommandCounterIncrement and rebuild the relcache entry,
- * so the relation must be valid and self-consistent at this point. In
- * particular, there are not yet constraints and defaults anywhere.
+ * NB: this may do a CommandCounterIncrement and rebuild the relcache
+ * entry, so the relation must be valid and self-consistent at this point.
+ * In particular, there are not yet constraints and defaults anywhere.
*/
StoreConstraints(new_rel_desc, tupdesc);
/*
* Find columns of rel that are used in ccbin
*
- * NB: pull_var_clause is okay here only because we don't allow subselects in
- * check constraints; it would fail to examine the contents of subselects.
+ * NB: pull_var_clause is okay here only because we don't allow subselects
+ * in check constraints; it would fail to examine the contents of
+ * subselects.
*/
varList = pull_var_clause(expr, false);
keycount = list_length(varList);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.261 2005/10/15 02:49:12 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.262 2005/11/22 18:17:08 momjian Exp $
*
*
* INTERFACE ROUTINES
/*
* Allocate an OID for the index, unless we were told what to use.
*
- * The OID will be the relfilenode as well, so make sure it doesn't collide
- * with either pg_class OIDs or existing physical files.
+ * The OID will be the relfilenode as well, so make sure it doesn't
+ * collide with either pg_class OIDs or existing physical files.
*/
if (!OidIsValid(indexRelationId))
indexRelationId = GetNewRelFileNode(tableSpaceId, shared_relation,
/*
* Register constraint and dependencies for the index.
*
- * If the index is from a CONSTRAINT clause, construct a pg_constraint entry.
- * The index is then linked to the constraint, which in turn is linked to
- * the table. If it's not a CONSTRAINT, make the dependency directly on
- * the table.
+ * If the index is from a CONSTRAINT clause, construct a pg_constraint
+ * entry. The index is then linked to the constraint, which in turn is
+ * linked to the table. If it's not a CONSTRAINT, make the dependency
+ * directly on the table.
*
* We don't need a dependency on the namespace, because there'll be an
* indirect dependency via our parent table.
*
- * During bootstrap we can't register any dependencies, and we don't try to
- * make a constraint either.
+ * During bootstrap we can't register any dependencies, and we don't try
+ * to make a constraint either.
*/
if (!IsBootstrapProcessingMode())
{
* delayed till later (ALTER TABLE can save work in some cases with this).
* Otherwise, we call the AM routine that constructs the index.
*
- * In normal processing mode, the heap and index relations are closed, but we
- * continue to hold the ShareLock on the heap and the exclusive lock on
+ * In normal processing mode, the heap and index relations are closed, but
+ * we continue to hold the ShareLock on the heap and the exclusive lock on
* the index that we acquired above, until end of transaction.
*/
if (IsBootstrapProcessingMode())
* tuple in-place. (Note: as of PG 8.0 this isn't called during
* bootstrap, but leave the code here for possible future use.)
*
- * We also must cheat if reindexing pg_class itself, because the target index
- * may presently not be part of the set of indexes that
+ * We also must cheat if reindexing pg_class itself, because the target
+ * index may presently not be part of the set of indexes that
* CatalogUpdateIndexes would update (see reindex_relation). In this case
* the stats updates will not be WAL-logged and so could be lost in a
* crash. This seems OK considering VACUUM does the same thing.
* entry for its own pg_class row because we do setNewRelfilenode() before
* we do index_build().
*
- * Note that we also clear pg_class's rd_oidindex until the loop is done, so
- * that that index can't be accessed either. This means we cannot safely
- * generate new relation OIDs while in the loop; shouldn't be a problem.
+ * Note that we also clear pg_class's rd_oidindex until the loop is done,
+ * so that that index can't be accessed either. This means we cannot
+ * safely generate new relation OIDs while in the loop; shouldn't be a
+ * problem.
*/
is_pg_class = (RelationGetRelid(rel) == RelationRelationId);
doneIndexes = NIL;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.79 2005/10/15 02:49:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.80 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* something we already accepted? If so, keep only the one that
* appears earlier in the search path.
*
- * If we have an ordered list from SearchSysCacheList (the normal case),
- * then any conflicting opclass must immediately adjoin this one in
- * the list, so we only need to look at the newest result item. If we
- * have an unordered list, we have to scan the whole result list.
+ * If we have an ordered list from SearchSysCacheList (the normal
+ * case), then any conflicting opclass must immediately adjoin this
+ * one in the list, so we only need to look at the newest result item.
+ * If we have an unordered list, we have to scan the whole result
+ * list.
*/
if (resultList)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.76 2005/10/15 02:49:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.77 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* enforce_generic_type_consistency, if transtype isn't polymorphic) must
* exactly match declared transtype.
*
- * In the non-polymorphic-transtype case, it might be okay to allow a rettype
- * that's binary-coercible to transtype, but I'm not quite convinced that
- * it's either safe or useful. When transtype is polymorphic we *must*
- * demand exact equality.
+ * In the non-polymorphic-transtype case, it might be okay to allow a
+ * rettype that's binary-coercible to transtype, but I'm not quite
+ * convinced that it's either safe or useful. When transtype is
+ * polymorphic we *must* demand exact equality.
*/
if (rettype != aggTransType)
ereport(ERROR,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.27 2005/10/15 02:49:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.28 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* XXX for now, do nothing special when dropping a domain constraint
*
- * Probably there should be some form of locking on the domain type, but
- * we have no such concept at the moment.
+ * Probably there should be some form of locking on the domain type,
+ * but we have no such concept at the moment.
*/
}
else
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.16 2005/11/21 12:49:30 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.17 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
objectIsInternalDependency(Oid classId, Oid objectId)
{
Relation depRel;
- ScanKeyData key[2];
- SysScanDesc scan;
+ ScanKeyData key[2];
+ SysScanDesc scan;
HeapTuple tup;
bool isdep = false;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.136 2005/11/17 22:14:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.137 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* need to use deconstruct_array() since the array data is just going
* to look like a C array of OID values.
*/
- ArrayType *allParamArray = (ArrayType *) DatumGetPointer(allParameterTypes);
+ ArrayType *allParamArray = (ArrayType *) DatumGetPointer(allParameterTypes);
allParamCount = ARR_DIMS(allParamArray)[0];
if (ARR_NDIM(allParamArray) != 1 ||
* expression results will be unresolvable. The check will be done at
* runtime instead.
*
- * We can run the text through the raw parser though; this will at least
- * catch silly syntactic errors.
+ * We can run the text through the raw parser though; this will at
+ * least catch silly syntactic errors.
*/
if (!haspolyarg)
{
* Nothing to do unless we are dealing with a syntax error that has a
* cursor position.
*
- * Some PLs may prefer to report the error position as an internal error to
- * begin with, so check that too.
+ * Some PLs may prefer to report the error position as an internal error
+ * to begin with, so check that too.
*/
origerrposition = geterrposition();
if (origerrposition <= 0)
* string literal. It does not handle the SQL syntax for literals
* continued across line boundaries.
*
- * We do the comparison a character at a time, not a byte at a time, so that
- * we can do the correct cursorpos math.
+ * We do the comparison a character at a time, not a byte at a time, so
+ * that we can do the correct cursorpos math.
*/
while (*prosrc)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.4 2005/11/21 12:49:30 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.5 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Skip the owner: he has an OWNER shdep entry instead. (This is
- * not just a space optimization; it makes ALTER OWNER easier.
- * See notes in changeDependencyOnOwner.)
+ * not just a space optimization; it makes ALTER OWNER easier. See
+ * notes in changeDependencyOnOwner.)
*/
if (roleid == ownerId)
continue;
/*
* Report seems unreasonably long, so reduce it to per-database info
*
- * Note: we don't ever suppress per-database totals, which should be OK
- * as long as there aren't too many databases ...
+ * Note: we don't ever suppress per-database totals, which should be
+ * OK as long as there aren't too many databases ...
*/
descs.len = 0; /* reset to empty */
descs.data[0] = '\0';
/*
* shdepDropOwned
*
- * Drop the objects owned by any one of the given RoleIds. If a role has
+ * Drop the objects owned by any one of the given RoleIds. If a role has
* access to an object, the grant will be removed as well (but the object
* will not, of course.)
*/
foreach(cell, roleids)
{
Oid roleid = lfirst_oid(cell);
- ScanKeyData key[2];
- SysScanDesc scan;
+ ScanKeyData key[2];
+ SysScanDesc scan;
HeapTuple tuple;
/* Doesn't work for pinned objects */
ereport(ERROR,
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
- errmsg("cannot drop objects owned by %s because they are "
- "required by the database system",
- getObjectDescription(&obj))));
+ errmsg("cannot drop objects owned by %s because they are "
+ "required by the database system",
+ getObjectDescription(&obj))));
}
ScanKeyInit(&key[0],
switch (sdepForm->deptype)
{
- ObjectAddress obj;
- GrantObjectType objtype;
+ ObjectAddress obj;
+ GrantObjectType objtype;
- /* Shouldn't happen */
+ /* Shouldn't happen */
case SHARED_DEPENDENCY_PIN:
case SHARED_DEPENDENCY_INVALID:
elog(ERROR, "unexpected dependency type");
false, DROP_CASCADE);
break;
case SHARED_DEPENDENCY_OWNER:
+
/*
* If there's a regular (non-shared) dependency on this
* object marked with DEPENDENCY_INTERNAL, skip this
- * object. We will drop the referencer object instead.
+ * object. We will drop the referencer object instead.
*/
if (objectIsInternalDependency(sdepForm->classid, sdepForm->objid))
continue;
void
shdepReassignOwned(List *roleids, Oid newrole)
{
- Relation sdepRel;
- ListCell *cell;
+ Relation sdepRel;
+ ListCell *cell;
sdepRel = heap_open(SharedDependRelationId, AccessShareLock);
ereport(ERROR,
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
- errmsg("cannot drop objects owned by %s because they are "
- "required by the database system",
- getObjectDescription(&obj))));
+ errmsg("cannot drop objects owned by %s because they are "
+ "required by the database system",
+ getObjectDescription(&obj))));
+
/*
* There's no need to tell the whole truth, which is that we
* didn't track these dependencies at all ...
Anum_pg_shdepend_refobjid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(roleid));
-
+
scan = systable_beginscan(sdepRel, SharedDependReferenceIndexId, true,
SnapshotNow, 2, key);
continue;
/*
- * If there's a regular (non-shared) dependency on this
- * object marked with DEPENDENCY_INTERNAL, skip this
- * object. We will alter the referencer object instead.
+ * If there's a regular (non-shared) dependency on this object
+ * marked with DEPENDENCY_INTERNAL, skip this object. We will
+ * alter the referencer object instead.
*/
if (objectIsInternalDependency(sdepForm->classid, sdepForm->objid))
continue;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.30 2005/10/15 02:49:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.31 2005/11/22 18:17:08 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
/*
* look up the aggregate's base type (input datatype) and transtype.
*
- * We have historically allowed the command to look like basetype = 'ANY' so
- * we must do a case-insensitive comparison for the name ANY. Ugh.
+ * We have historically allowed the command to look like basetype = 'ANY'
+ * so we must do a case-insensitive comparison for the name ANY. Ugh.
*
* basetype can be a pseudo-type, but transtype can't, since we need to be
* able to store values of the transtype. However, we can allow
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.89 2005/10/15 02:49:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.90 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* If we didn't find as many tuples as we wanted then we're done. No sort
* is needed, since they're already in order.
*
- * Otherwise we need to sort the collected tuples by position (itempointer).
- * It's not worth worrying about corner cases where the tuples are already
- * sorted.
+ * Otherwise we need to sort the collected tuples by position
+ * (itempointer). It's not worth worrying about corner cases where the
+ * tuples are already sorted.
*/
if (numrows == targrows)
qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows);
* Now scan the values in order, find the most common ones, and also
* accumulate ordering-correlation statistics.
*
- * To determine which are most common, we first have to count the number
- * of duplicates of each value. The duplicates are adjacent in the
- * sorted list, so a brute-force approach is to compare successive
+ * To determine which are most common, we first have to count the
+ * number of duplicates of each value. The duplicates are adjacent in
+ * the sorted list, so a brute-force approach is to compare successive
* datum values until we find two that are not equal. However, that
* requires N-1 invocations of the datum comparison routine, which are
* completely redundant with work that was done during the sort. (The
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.127 2005/11/03 17:11:34 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.128 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* steps. (A very small time window, perhaps, but Murphy's Law says you
* can hit it...) Instead, we first set the enable flag, then test the
* occurred flag. If we see an unserviced interrupt has occurred, we
- * re-clear the enable flag before going off to do the service work.
- * (That prevents re-entrant invocation of ProcessIncomingNotify() if
- * another interrupt occurs.) If an interrupt comes in between the setting
- * and clearing of notifyInterruptEnabled, then it will have done the
- * service work and left notifyInterruptOccurred zero, so we have to check
- * again after clearing enable. The whole thing has to be in a loop in
- * case another interrupt occurs while we're servicing the first. Once we
- * get out of the loop, enable is set and we know there is no unserviced
+ * re-clear the enable flag before going off to do the service work. (That
+ * prevents re-entrant invocation of ProcessIncomingNotify() if another
+ * interrupt occurs.) If an interrupt comes in between the setting and
+ * clearing of notifyInterruptEnabled, then it will have done the service
+ * work and left notifyInterruptOccurred zero, so we have to check again
+ * after clearing enable. The whole thing has to be in a loop in case
+ * another interrupt occurs while we're servicing the first. Once we get
+ * out of the loop, enable is set and we know there is no unserviced
* interrupt.
*
- * NB: an overenthusiastic optimizing compiler could easily break this code.
- * Hopefully, they all understand what "volatile" means these days.
+ * NB: an overenthusiastic optimizing compiler could easily break this
+ * code. Hopefully, they all understand what "volatile" means these days.
*/
for (;;)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.141 2005/10/29 00:31:51 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.142 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Create special memory context for cross-transaction storage.
*
- * Since it is a child of PortalContext, it will go away even in case of
- * error.
+ * Since it is a child of PortalContext, it will go away even in case
+ * of error.
*/
cluster_context = AllocSetContextCreate(PortalContext,
"Cluster",
* Since we may open a new transaction for each relation, we have to check
* that the relation still is what we think it is.
*
- * If this is a single-transaction CLUSTER, we can skip these tests. We *must*
- * skip the one on indisclustered since it would reject an attempt to
- * cluster a not-previously-clustered index.
+ * If this is a single-transaction CLUSTER, we can skip these tests. We
+ * *must* skip the one on indisclustered since it would reject an attempt
+ * to cluster a not-previously-clustered index.
*/
if (recheck)
{
RelationGetRelationName(OldIndex)),
recheck
? errhint("You may be able to work around this by marking column \"%s\" NOT NULL, or use ALTER TABLE ... SET WITHOUT CLUSTER to remove the cluster specification from the table.",
- NameStr(OldHeap->rd_att->attrs[colno - 1]->attname))
+ NameStr(OldHeap->rd_att->attrs[colno - 1]->attname))
: errhint("You may be able to work around this by marking column \"%s\" NOT NULL.",
- NameStr(OldHeap->rd_att->attrs[colno - 1]->attname))));
+ NameStr(OldHeap->rd_att->attrs[colno - 1]->attname))));
}
else if (colno < 0)
{
* We cannot simply pass the tuple to heap_insert(), for several
* reasons:
*
- * 1. heap_insert() will overwrite the commit-status fields of the tuple
- * it's handed. This would trash the source relation, which is bad
- * news if we abort later on. (This was a bug in releases thru 7.0)
+ * 1. heap_insert() will overwrite the commit-status fields of the
+ * tuple it's handed. This would trash the source relation, which is
+ * bad news if we abort later on. (This was a bug in releases thru
+ * 7.0)
*
- * 2. We'd like to squeeze out the values of any dropped columns, both to
- * save space and to ensure we have no corner-case failures. (It's
+ * 2. We'd like to squeeze out the values of any dropped columns, both
+ * to save space and to ensure we have no corner-case failures. (It's
* possible for example that the new table hasn't got a TOAST table
* and so is unable to store any large values of dropped cols.)
*
* happen in CLUSTER if there were dropped columns in the old table, and
* in ALTER TABLE when adding or changing type of columns.
*
- * NOTE: at present, a TOAST table's only dependency is the one on its owning
- * table. If more are ever created, we'd need to use something more
- * selective than deleteDependencyRecordsFor() to get rid of only the link
- * we want.
+ * NOTE: at present, a TOAST table's only dependency is the one on its
+ * owning table. If more are ever created, we'd need to use something
+ * more selective than deleteDependencyRecordsFor() to get rid of only the
+ * link we want.
*/
if (relform1->reltoastrelid || relform2->reltoastrelid)
{
* Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.84 2005/10/15 02:49:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.85 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* comment on a database other than the current one. Someday this might be
* improved, but it would take a redesigned infrastructure.
*
- * When loading a dump, we may see a COMMENT ON DATABASE for the old name of
- * the database. Erroring out would prevent pg_restore from completing
+ * When loading a dump, we may see a COMMENT ON DATABASE for the old name
+ * of the database. Erroring out would prevent pg_restore from completing
* (which is really pg_restore's fault, but for now we will work around
* the problem here). Consensus is that the best fix is to treat wrong
* database name as a WARNING not an ERROR.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.25 2005/11/21 12:49:30 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.26 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/syscache.h"
static void AlterConversionOwner_internal(Relation rel, Oid conversionOid,
- Oid newOwnerId);
+ Oid newOwnerId);
/*
* CREATE CONVERSION
conversionOid = FindConversionByName(name);
if (!OidIsValid(conversionOid))
{
- if (! missing_ok)
+ if (!missing_ok)
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
else
{
ereport(NOTICE,
- (errmsg("conversion \"%s\" does not exist, skipping",
+ (errmsg("conversion \"%s\" does not exist, skipping",
NameListToString(name))));
}
Relation rel;
rel = heap_open(ConversionRelationId, RowExclusiveLock);
-
+
AlterConversionOwner_internal(rel, conversionOid, newOwnerId);
heap_close(rel, NoLock);
AlterConversionOwner_internal(Relation rel, Oid conversionOid, Oid newOwnerId)
{
Form_pg_conversion convForm;
- HeapTuple tup;
+ HeapTuple tup;
Assert(RelationGetRelid(rel) == ConversionRelationId);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.254 2005/11/03 17:11:34 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.255 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* These variables are used to reduce overhead in textual COPY FROM.
*
- * attribute_buf holds the separated, de-escaped text for each field of the
- * current line. The CopyReadAttributes functions return arrays of
+ * attribute_buf holds the separated, de-escaped text for each field of
+ * the current line. The CopyReadAttributes functions return arrays of
* pointers into this buffer. We avoid palloc/pfree overhead by re-using
* the buffer on each cycle.
*/
* examine; any characters from raw_buf_index to raw_buf_ptr have been
* determined to be part of the line, but not yet transferred to line_buf.
*
- * For a little extra speed within the loop, we copy raw_buf and raw_buf_len
- * into local variables.
+ * For a little extra speed within the loop, we copy raw_buf and
+ * raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
/*
* If need more data, go back to loop top to load it.
*
- * Note that if we are at EOF, c will wind up as '\0' because of
- * the guaranteed pad of raw_buf.
+ * Note that if we are at EOF, c will wind up as '\0' because
+ * of the guaranteed pad of raw_buf.
*/
if (raw_buf_ptr >= copy_buf_len && !hit_eof)
{
* Do we need to be careful about trailing bytes of multibyte
* characters? (See note above about client_only_encoding)
*
- * We assume here that pg_encoding_mblen only looks at the first byte of
- * the character!
+ * We assume here that pg_encoding_mblen only looks at the first byte
+ * of the character!
*/
if (cstate->client_only_encoding)
{
* examine; any characters from raw_buf_index to raw_buf_ptr have been
* determined to be part of the line, but not yet transferred to line_buf.
*
- * For a little extra speed within the loop, we copy raw_buf and raw_buf_len
- * into local variables.
+ * For a little extra speed within the loop, we copy raw_buf and
+ * raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
/*
* If need more data, go back to loop top to load it.
*
- * Note that if we are at EOF, c will wind up as '\0' because of
- * the guaranteed pad of raw_buf.
+ * Note that if we are at EOF, c will wind up as '\0' because
+ * of the guaranteed pad of raw_buf.
*/
if (raw_buf_ptr >= copy_buf_len && !hit_eof)
{
* Do we need to be careful about trailing bytes of multibyte
* characters? (See note above about client_only_encoding)
*
- * We assume here that pg_encoding_mblen only looks at the first byte of
- * the character!
+ * We assume here that pg_encoding_mblen only looks at the first byte
+ * of the character!
*/
if (cstate->client_only_encoding)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.174 2005/11/22 15:24:17 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.175 2005/11/22 18:17:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
src_vacuumxid = src_frozenxid = GetCurrentTransactionId();
/*
- * Preassign OID for pg_database tuple, so that we can compute db path.
- * We have to open pg_database to do this, but we don't want to take
+ * Preassign OID for pg_database tuple, so that we can compute db path. We
+ * have to open pg_database to do this, but we don't want to take
* ExclusiveLock yet, so just do it and close again.
*/
pg_database_rel = heap_open(DatabaseRelationId, AccessShareLock);
*
* (Both of these were real bugs in releases 8.0 through 8.0.3.)
*
- * In PITR replay, the first of these isn't an issue, and the second is
- * only a risk if the CREATE DATABASE and subsequent template database
- * change both occur while a base backup is being taken. There doesn't
- * seem to be much we can do about that except document it as a
- * limitation.
+ * In PITR replay, the first of these isn't an issue, and the second
+ * is only a risk if the CREATE DATABASE and subsequent template
+ * database change both occur while a base backup is being taken.
+ * There doesn't seem to be much we can do about that except document
+ * it as a limitation.
*
- * Perhaps if we ever implement CREATE DATABASE in a less cheesy way, we
- * can avoid this.
+ * Perhaps if we ever implement CREATE DATABASE in a less cheesy way,
+ * we can avoid this.
*/
RequestCheckpoint(true, false);
if (!get_db_info(dbname, &db_id, NULL, NULL,
&db_istemplate, NULL, NULL, NULL, NULL, NULL))
{
- if (! missing_ok)
+ if (!missing_ok)
{
ereport(ERROR,
- (errcode(ERRCODE_UNDEFINED_DATABASE),
- errmsg("database \"%s\" does not exist", dbname)));
+ (errcode(ERRCODE_UNDEFINED_DATABASE),
+ errmsg("database \"%s\" does not exist", dbname)));
}
else
{
-
+
/* Close pg_database, release the lock, since we changed nothing */
heap_close(pgdbrel, ExclusiveLock);
- ereport(NOTICE,
- (errmsg("database \"%s\" does not exist, skipping",
+ ereport(NOTICE,
+ (errmsg("database \"%s\" does not exist, skipping",
dbname)));
return;
/*
* Delete any comments associated with the database
*
- * NOTE: this is probably dead code since any such comments should have been
- * in that database, not mine.
+ * NOTE: this is probably dead code since any such comments should have
+ * been in that database, not mine.
*/
DeleteComments(db_id, DatabaseRelationId, 0);
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.139 2005/10/21 16:43:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.140 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Update snapshot command ID to ensure this query sees results of any
* previously executed queries. (It's a bit cheesy to modify
- * ActiveSnapshot without making a copy, but for the limited ways in
- * which EXPLAIN can be invoked, I think it's OK, because the active
- * snapshot shouldn't be shared with anything else anyway.)
+ * ActiveSnapshot without making a copy, but for the limited ways in which
+ * EXPLAIN can be invoked, I think it's OK, because the active snapshot
+ * shouldn't be shared with anything else anyway.)
*/
ActiveSnapshot->curcid = GetCurrentCommandId();
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.135 2005/11/07 17:36:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.136 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* we don't cascade the notnull constraint(s) either; but this is
* pretty debatable.
*
- * XXX: possible future improvement: when being called from ALTER TABLE,
- * it would be more efficient to merge this with the outer ALTER
- * TABLE, so as to avoid two scans. But that seems to complicate
- * DefineIndex's API unduly.
+ * XXX: possible future improvement: when being called from ALTER
+ * TABLE, it would be more efficient to merge this with the outer
+ * ALTER TABLE, so as to avoid two scans. But that seems to
+ * complicate DefineIndex's API unduly.
*/
if (cmds)
AlterTableInternal(relationId, cmds, false);
* Release 7.1 removes lztext_ops, so suppress that too for a while. tgl
* 2000/07/30
*
- * Release 7.2 renames timestamp_ops to timestamptz_ops, so suppress that too
- * for awhile. I'm starting to think we need a better approach. tgl
+ * Release 7.2 renames timestamp_ops to timestamptz_ops, so suppress that
+ * too for awhile. I'm starting to think we need a better approach. tgl
* 2000/10/01
*
* Release 8.0 removes bigbox_ops (which was dead code for a long while
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.39 2005/11/21 12:49:31 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.40 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static void storeOperators(Oid opclassoid, List *operators);
static void storeProcedures(Oid opclassoid, List *procedures);
static void AlterOpClassOwner_internal(Relation rel, HeapTuple tuple,
- Oid newOwnerId);
+ Oid newOwnerId);
/*
tup = SearchSysCacheCopy(CLAOID,
ObjectIdGetDatum(opcOid),
0, 0, 0);
- if (!HeapTupleIsValid(tup)) /* shouldn't happen */
+ if (!HeapTupleIsValid(tup)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for opclass %u", opcOid);
AlterOpClassOwner_internal(rel, tup, newOwnerId);
if (schemaname)
{
- Oid namespaceOid;
+ Oid namespaceOid;
namespaceOid = LookupExplicitNamespace(schemaname);
}
else
{
- Oid opcOid;
+ Oid opcOid;
opcOid = OpclassnameGetOpcid(amOid, opcname);
if (!OidIsValid(opcOid))
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.37 2005/11/21 12:49:31 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.38 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
else
{
ereport(NOTICE,
- (errmsg("schema \"%s\" does not exist, skipping",
+ (errmsg("schema \"%s\" does not exist, skipping",
namespaceName)));
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.125 2005/10/15 02:49:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.126 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Two special hacks here:
*
- * 1. Since VACUUM does not process sequences, we have to force the tuple to
- * have xmin = FrozenTransactionId now. Otherwise it would become
+ * 1. Since VACUUM does not process sequences, we have to force the tuple
+ * to have xmin = FrozenTransactionId now. Otherwise it would become
* invisible to SELECTs after 2G transactions. It is okay to do this
* because if the current transaction aborts, no other xact will ever
* examine the sequence tuple anyway.
* fetch count to grab SEQ_LOG_VALS more values than we actually need to
* cache. (These will then be usable without logging.)
*
- * If this is the first nextval after a checkpoint, we must force a new WAL
- * record to be written anyway, else replay starting from the checkpoint
- * would fail to advance the sequence past the logged values. In this
- * case we may as well fetch extra values.
+ * If this is the first nextval after a checkpoint, we must force a new
+ * WAL record to be written anyway, else replay starting from the
+ * checkpoint would fail to advance the sequence past the logged values.
+ * In this case we may as well fetch extra values.
*/
if (log < fetch)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.175 2005/11/21 12:49:31 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.176 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* If default expr could contain any vars, we'd need to fix
* 'em, but it can't; so default is ready to apply to child.
*
- * If we already had a default from some prior parent, check to
- * see if they are the same. If so, no problem; if not, mark
- * the column as having a bogus default. Below, we will
+ * If we already had a default from some prior parent, check
+ * to see if they are the same. If so, no problem; if not,
+ * mark the column as having a bogus default. Below, we will
* complain if the bogus default isn't overridden by the child
* schema.
*/
* Also enter dependencies on the direct ancestors, and make sure they are
* marked with relhassubclass = true.
*
- * (Once upon a time, both direct and indirect ancestors were found here and
- * then entered into pg_ipl. Since that catalog doesn't exist anymore,
- * there's no need to look for indirect ancestors.)
+ * (Once upon a time, both direct and indirect ancestors were found here
+ * and then entered into pg_ipl. Since that catalog doesn't exist
+ * anymore, there's no need to look for indirect ancestors.)
*/
relation = heap_open(InheritsRelationId, RowExclusiveLock);
desc = RelationGetDescr(relation);
/*
* Fetch a modifiable copy of the tuple, modify it, update pg_class.
*
- * If the tuple already has the right relhassubclass setting, we don't need
- * to update it, but we still need to issue an SI inval message.
+ * If the tuple already has the right relhassubclass setting, we don't
+ * need to update it, but we still need to issue an SI inval message.
*/
relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID,
* attribute in all classes that inherit from 'relname' (as well as in
* 'relname').
*
- * any permissions or problems with duplicate attributes will cause the whole
- * transaction to abort, which is what we want -- all or nothing.
+ * any permissions or problems with duplicate attributes will cause the
+ * whole transaction to abort, which is what we want -- all or nothing.
*/
if (recurse)
{
/*
* It is an RI trigger, so parse the tgargs bytea.
*
- * NB: we assume the field will never be compressed or moved out of line;
- * so does trigger.c ...
+ * NB: we assume the field will never be compressed or moved out of
+ * line; so does trigger.c ...
*/
tgnargs = pg_trigger->tgnargs;
val = (bytea *)
* If we need to rewrite the table, the operation has to be propagated to
* tables that use this table's rowtype as a column type.
*
- * (Eventually this will probably become true for scans as well, but at the
- * moment a composite type does not enforce any constraints, so it's not
- * necessary/appropriate to enforce them just during ALTER.)
+ * (Eventually this will probably become true for scans as well, but at
+ * the moment a composite type does not enforce any constraints, so it's
+ * not necessary/appropriate to enforce them just during ALTER.)
*/
if (newrel)
find_composite_type_dependencies(oldrel->rd_rel->reltype,
/*
* Recurse to add the column to child classes, if requested.
*
- * We must recurse one level at a time, so that multiply-inheriting children
- * are visited the right number of times and end up with the right
- * attinhcount.
+ * We must recurse one level at a time, so that multiply-inheriting
+ * children are visited the right number of times and end up with the
+ * right attinhcount.
*/
if (recurse)
{
/*
* Tell Phase 3 to fill in the default expression, if there is one.
*
- * If there is no default, Phase 3 doesn't have to do anything, because that
- * effectively means that the default is NULL. The heap tuple access
+ * If there is no default, Phase 3 doesn't have to do anything, because
+ * that effectively means that the default is NULL. The heap tuple access
* routines always check for attnum > # of attributes in tuple, and return
* NULL if so, so without any modification of the tuple data we will get
* the effect of NULL values in the new column.
/*
* Validity and permissions checks
*
- * Note: REFERENCES permissions checks are redundant with CREATE TRIGGER, but
- * we may as well error out sooner instead of later.
+ * Note: REFERENCES permissions checks are redundant with CREATE TRIGGER,
+ * but we may as well error out sooner instead of later.
*/
if (pkrel->rd_rel->relkind != RELKIND_RELATION)
ereport(ERROR,
* pktypoid[i] is the primary key table's i'th key's type fktypoid[i]
* is the foreign key table's i'th key's type
*
- * Note that we look for an operator with the PK type on the left; when
- * the types are different this is critical because the PK index will
- * need operators with the indexkey on the left. (Ordinarily both
+ * Note that we look for an operator with the PK type on the left;
+ * when the types are different this is critical because the PK index
+ * will need operators with the indexkey on the left. (Ordinarily both
* commutator operators will exist if either does, but we won't get
* the right answer from the test below on opclass membership unless
* we select the proper operator.)
* the column type, because build_column_default itself will try to
* coerce, and will not issue the error message we want if it fails.)
*
- * We remove any implicit coercion steps at the top level of the old default
- * expression; this has been agreed to satisfy the principle of least
- * surprise. (The conversion to the new column type should act like it
- * started from what the user sees as the stored expression, and the
+ * We remove any implicit coercion steps at the top level of the old
+ * default expression; this has been agreed to satisfy the principle of
+ * least surprise. (The conversion to the new column type should act like
+ * it started from what the user sees as the stored expression, and the
* implicit coercions aren't going to be shown.)
*/
if (attTup->atthasdef)
* the info before executing ALTER TYPE, though, else the deparser will
* get confused.
*
- * There could be multiple entries for the same object, so we must check to
- * ensure we process each one only once. Note: we assume that an index
+ * There could be multiple entries for the same object, so we must check
+ * to ensure we process each one only once. Note: we assume that an index
* that implements a constraint will not show a direct dependency on the
* column.
*/
* to commit the transaction. (For a temp rel we don't care since the rel
* will be uninteresting after a crash anyway.)
*
- * It's obvious that we must do this when not WAL-logging the copy. It's less
- * obvious that we have to do it even if we did WAL-log the copied pages.
- * The reason is that since we're copying outside shared buffers, a
+ * It's obvious that we must do this when not WAL-logging the copy. It's
+ * less obvious that we have to do it even if we did WAL-log the copied
+ * pages. The reason is that since we're copying outside shared buffers, a
* CHECKPOINT occurring during the copy has no way to flush the previously
* written data to disk (indeed it won't know the new rel even exists). A
* crash later on would replay WAL from the checkpoint, therefore it
/*
* Toast table is shared if and only if its parent is.
*
- * We cannot allow toasting a shared relation after initdb (because there's
- * no way to mark it toasted in other databases' pg_class). Unfortunately
- * we can't distinguish initdb from a manually started standalone backend
- * (toasting happens after the bootstrap phase, so checking
- * IsBootstrapProcessingMode() won't work). However, we can at least
- * prevent this mistake under normal multi-user operation.
+ * We cannot allow toasting a shared relation after initdb (because
+ * there's no way to mark it toasted in other databases' pg_class).
+ * Unfortunately we can't distinguish initdb from a manually started
+ * standalone backend (toasting happens after the bootstrap phase, so
+ * checking IsBootstrapProcessingMode() won't work). However, we can at
+ * least prevent this mistake under normal multi-user operation.
*/
shared_relation = rel->rd_rel->relisshared;
if (shared_relation && IsUnderPostmaster)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.196 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.197 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* (and this one too!) are sent SI message to make them rebuild relcache
* entries.
*
- * Note this is OK only because we have AccessExclusiveLock on the rel, so no
- * one else is creating/deleting triggers on this rel at the same time.
+ * Note this is OK only because we have AccessExclusiveLock on the rel, so
+ * no one else is creating/deleting triggers on this rel at the same time.
*/
pgrel = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID,
* we have the same triggers with the same types, the derived index data
* should match.
*
- * As of 7.3 we assume trigger set ordering is significant in the comparison;
- * so we just compare corresponding slots of the two sets.
+ * As of 7.3 we assume trigger set ordering is significant in the
+ * comparison; so we just compare corresponding slots of the two sets.
*/
if (trigdesc1 != NULL)
{
* Process all immediate-mode triggers queued by the query, and move the
* deferred ones to the main list of deferred events.
*
- * Notice that we decide which ones will be fired, and put the deferred ones
- * on the main list, before anything is actually fired. This ensures
+ * Notice that we decide which ones will be fired, and put the deferred
+ * ones on the main list, before anything is actually fired. This ensures
* reasonably sane behavior if a trigger function does SET CONSTRAINTS ...
* IMMEDIATE: all events we have decided to defer will be available for it
* to fire.
*
- * If we find no firable events, we don't have to increment firing_counter.
+ * If we find no firable events, we don't have to increment
+ * firing_counter.
*/
events = &afterTriggers->query_stack[afterTriggers->query_depth];
if (afterTriggerMarkEvents(events, &afterTriggers->events, true))
* list of previously deferred events to fire any that have now become
* immediate.
*
- * Obviously, if this was SET ... DEFERRED then it can't have converted any
- * unfired events to immediate, so we need do nothing in that case.
+ * Obviously, if this was SET ... DEFERRED then it can't have converted
+ * any unfired events to immediate, so we need do nothing in that case.
*/
if (!stmt->deferred)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.84 2005/11/21 12:49:31 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.85 2005/11/22 18:17:09 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
else
{
ereport(NOTICE,
- (errmsg("type \"%s\" does not exist, skipping",
+ (errmsg("type \"%s\" does not exist, skipping",
TypeNameToString(typename))));
}
else
{
ereport(NOTICE,
- (errmsg("type \"%s\" does not exist, skipping",
+ (errmsg("type \"%s\" does not exist, skipping",
TypeNameToString(typename))));
}
* Input functions can take a single argument of type CSTRING, or three
* arguments (string, typioparam OID, typmod).
*
- * For backwards compatibility we allow OPAQUE in place of CSTRING; if we see
- * this, we issue a warning and fix up the pg_proc entry.
+ * For backwards compatibility we allow OPAQUE in place of CSTRING; if we
+ * see this, we issue a warning and fix up the pg_proc entry.
*/
argList[0] = CSTRINGOID;
/*
* Deparse it to produce text for consrc.
*
- * Since VARNOs aren't allowed in domain constraints, relation context isn't
- * required as anything other than a shell.
+ * Since VARNOs aren't allowed in domain constraints, relation context
+ * isn't required as anything other than a shell.
*/
ccsrc = deparse_expression(expr,
deparse_context_for(domainName,
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.165 2005/11/21 12:49:31 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.166 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Drop the objects owned by a given list of roles.
*/
void
-DropOwnedObjects(DropOwnedStmt *stmt)
+DropOwnedObjects(DropOwnedStmt * stmt)
{
- List *role_ids = roleNamesToIds(stmt->roles);
- ListCell *cell;
+ List *role_ids = roleNamesToIds(stmt->roles);
+ ListCell *cell;
/* Check privileges */
- foreach (cell, role_ids)
+ foreach(cell, role_ids)
{
- Oid roleid = lfirst_oid(cell);
+ Oid roleid = lfirst_oid(cell);
if (!has_privs_of_role(GetUserId(), roleid))
ereport(ERROR,
* Give the objects owned by a given list of roles away to another user.
*/
void
-ReassignOwnedObjects(ReassignOwnedStmt *stmt)
+ReassignOwnedObjects(ReassignOwnedStmt * stmt)
{
List *role_ids = roleNamesToIds(stmt->roles);
ListCell *cell;
Oid newrole;
/* Check privileges */
- foreach (cell, role_ids)
+ foreach(cell, role_ids)
{
- Oid roleid = lfirst_oid(cell);
+ Oid roleid = lfirst_oid(cell);
if (!has_privs_of_role(GetUserId(), roleid))
ereport(ERROR,
newrole = get_roleid_checked(stmt->newrole);
if (!has_privs_of_role(GetUserId(), newrole))
- ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied to reassign objects")));
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("permission denied to reassign objects")));
/* Ok, do it */
shdepReassignOwned(role_ids, newrole);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.318 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.319 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* compared to telling people to use two operations. See pgsql-hackers
* discussion of 27-Nov-2004, and comments below for update_hint_bits().
*
- * Note: this is enforced here, and not in the grammar, since (a) we can give
- * a better error message, and (b) we might want to allow it again
+ * Note: this is enforced here, and not in the grammar, since (a) we can
+ * give a better error message, and (b) we might want to allow it again
* someday.
*/
if (vacstmt->vacuum && vacstmt->full && vacstmt->freeze)
/*
* Create special memory context for cross-transaction storage.
*
- * Since it is a child of PortalContext, it will go away eventually even if
- * we suffer an error; there's no need for special abort cleanup logic.
+ * Since it is a child of PortalContext, it will go away eventually even
+ * if we suffer an error; there's no need for special abort cleanup logic.
*/
vac_context = AllocSetContextCreate(PortalContext,
"Vacuum",
/*
* It's a database-wide VACUUM.
*
- * Compute the initially applicable OldestXmin and FreezeLimit XIDs, so
- * that we can record these values at the end of the VACUUM. Note that
- * individual tables may well be processed with newer values, but we
- * can guarantee that no (non-shared) relations are processed with
+ * Compute the initially applicable OldestXmin and FreezeLimit XIDs,
+ * so that we can record these values at the end of the VACUUM. Note
+ * that individual tables may well be processed with newer values, but
+ * we can guarantee that no (non-shared) relations are processed with
* older ones.
*
- * It is okay to record non-shared values in pg_database, even though we
- * may vacuum shared relations with older cutoffs, because only the
+ * It is okay to record non-shared values in pg_database, even though
+ * we may vacuum shared relations with older cutoffs, because only the
* minimum of the values present in pg_database matters. We can be
* sure that shared relations have at some time been vacuumed with
* cutoffs no worse than the global minimum; for, if there is a
/*
* Decide whether we need to start/commit our own transactions.
*
- * For VACUUM (with or without ANALYZE): always do so, so that we can release
- * locks as soon as possible. (We could possibly use the outer
+ * For VACUUM (with or without ANALYZE): always do so, so that we can
+ * release locks as soon as possible. (We could possibly use the outer
* transaction for a one-table VACUUM, but handling TOAST tables would be
* problematic.)
*
/*
* Determine the type of lock we want --- hard exclusive lock for a FULL
- * vacuum, but just ShareUpdateExclusiveLock for concurrent vacuum.
- * Either way, we can be sure that no other backend is vacuuming the same
- * table.
+ * vacuum, but just ShareUpdateExclusiveLock for concurrent vacuum. Either
+ * way, we can be sure that no other backend is vacuuming the same table.
*/
lmode = vacstmt->full ? AccessExclusiveLock : ShareUpdateExclusiveLock;
/*
* Open the class, get an appropriate lock on it, and check permissions.
*
- * We allow the user to vacuum a table if he is superuser, the table owner,
- * or the database owner (but in the latter case, only if it's not a
- * shared relation). pg_class_ownercheck includes the superuser case.
+ * We allow the user to vacuum a table if he is superuser, the table
+ * owner, or the database owner (but in the latter case, only if it's not
+ * a shared relation). pg_class_ownercheck includes the superuser case.
*
- * Note we choose to treat permissions failure as a WARNING and keep trying
- * to vacuum the rest of the DB --- is this appropriate?
+ * Note we choose to treat permissions failure as a WARNING and keep
+ * trying to vacuum the rest of the DB --- is this appropriate?
*/
onerel = relation_open(relid, lmode);
* find a page we cannot completely empty (this last condition is handled
* by "break" statements within the loop).
*
- * NB: this code depends on the vacuum_pages and fraged_pages lists being in
- * order by blkno.
+ * NB: this code depends on the vacuum_pages and fraged_pages lists being
+ * in order by blkno.
*/
nblocks = vacrelstats->rel_pages;
for (blkno = nblocks - vacuum_pages->empty_end_pages - 1;
* since we stop the outer loop at last_move_dest_block, pages removed
* here cannot have had anything moved onto them already.
*
- * Also note that we don't change the stored fraged_pages list, only our
- * local variable num_fraged_pages; so the forgotten pages are still
- * available to be loaded into the free space map later.
+ * Also note that we don't change the stored fraged_pages list, only
+ * our local variable num_fraged_pages; so the forgotten pages are
+ * still available to be loaded into the free space map later.
*/
while (num_fraged_pages > 0 &&
fraged_pages->pagedesc[num_fraged_pages - 1]->blkno >= blkno)
* --- it must be recently obsoleted, else scan_heap would have
* deemed it removable.)
*
- * NOTE: this test is not 100% accurate: it is possible for a tuple
- * to be an updated one with recent xmin, and yet not match any
- * new_tid entry in the vtlinks list. Presumably there was once a
- * parent tuple with xmax matching the xmin, but it's possible
- * that that tuple has been removed --- for example, if it had
- * xmin = xmax and wasn't itself an updated version, then
+ * NOTE: this test is not 100% accurate: it is possible for a
+ * tuple to be an updated one with recent xmin, and yet not match
+ * any new_tid entry in the vtlinks list. Presumably there was
+ * once a parent tuple with xmax matching the xmin, but it's
+ * possible that that tuple has been removed --- for example, if
+ * it had xmin = xmax and wasn't itself an updated version, then
* HeapTupleSatisfiesVacuum would deem it removable as soon as the
* xmin xact completes.
*
- * To be on the safe side, we abandon the repair_frag process if we
- * cannot find the parent tuple in vtlinks. This may be overly
+ * To be on the safe side, we abandon the repair_frag process if
+ * we cannot find the parent tuple in vtlinks. This may be overly
* conservative; AFAICS it would be safe to move the chain.
*/
if (((tuple.t_data->t_infomask & HEAP_UPDATED) &&
/*
* Clean moved-off tuples from last page in Nvacpagelist list.
*
- * We need only do this in this one page, because higher-numbered pages
- * are going to be truncated from the relation entirely. But see
+ * We need only do this in this one page, because higher-numbered
+ * pages are going to be truncated from the relation entirely. But see
* comments for update_hint_bits().
*/
if (vacpage->blkno == (blkno - 1) &&
* Therefore we must do everything that uses old_tup->t_data BEFORE this
* step!!
*
- * This path is different from the other callers of vacuum_page, because we
- * have already incremented the vacpage's offsets_used field to account
+ * This path is different from the other callers of vacuum_page, because
+ * we have already incremented the vacpage's offsets_used field to account
* for the tuple(s) we expect to move onto the page. Therefore
* vacuum_page's check for offsets_used == 0 is wrong. But since that's a
* good debugging check for all other callers, we work around it here
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.62 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.63 2005/11/22 18:17:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* relation but crashes before initializing the page. Reclaim such
* pages for use.
*
- * We have to be careful here because we could be looking at a page
- * that someone has just added to the relation and not yet been
- * able to initialize (see RelationGetBufferForTuple). To
+ * We have to be careful here because we could be looking at a
+ * page that someone has just added to the relation and not yet
+ * been able to initialize (see RelationGetBufferForTuple). To
* interlock against that, release the buffer read lock (which we
* must do anyway) and grab the relation extension lock before
* re-locking in exclusive mode. If the page is still
* uninitialized by then, it must be left over from a crashed
* backend, and we can initialize it.
*
- * We don't really need the relation lock when this is a new or temp
- * relation, but it's probably not worth the code space to check
- * that, since this surely isn't a critical path.
+ * We don't really need the relation lock when this is a new or
+ * temp relation, but it's probably not worth the code space to
+ * check that, since this surely isn't a critical path.
*
- * Note: the comparable code in vacuum.c need not worry because it's
- * got exclusive lock on the whole relation.
+ * Note: the comparable code in vacuum.c need not worry because
+ * it's got exclusive lock on the whole relation.
*/
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
LockRelationForExtension(onerel, ExclusiveLock);
* Tuple is good. Consider whether to replace its xmin
* value with FrozenTransactionId.
*
- * NB: Since we hold only a shared buffer lock here, we are
- * assuming that TransactionId read/write is atomic. This
- * is not the only place that makes such an assumption.
- * It'd be possible to avoid the assumption by momentarily
- * acquiring exclusive lock, but for the moment I see no
- * need to.
+ * NB: Since we hold only a shared buffer lock here, we
+ * are assuming that TransactionId read/write is atomic.
+ * This is not the only place that makes such an
+ * assumption. It'd be possible to avoid the assumption by
+ * momentarily acquiring exclusive lock, but for the
+ * moment I see no need to.
*/
if (TransactionIdIsNormal(HeapTupleHeaderGetXmin(tuple.t_data)) &&
TransactionIdPrecedes(HeapTupleHeaderGetXmin(tuple.t_data),
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.114 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.115 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Easiest way to get the current DEFAULT state is to fetch the
* DEFAULT string from guc.c and recursively parse it.
*
- * We can't simply "return assign_datestyle(...)" because we need to
- * handle constructs like "DEFAULT, ISO".
+ * We can't simply "return assign_datestyle(...)" because we need
+ * to handle constructs like "DEFAULT, ISO".
*/
int saveDateStyle = DateStyle;
int saveDateOrder = DateOrder;
* timezone setting, we will return that name rather than UNKNOWN
* as the canonical spelling.
*
- * During GUC initialization, since the timezone library isn't set up
- * yet, pg_get_timezone_name will return NULL and we will leave
+ * During GUC initialization, since the timezone library isn't set
+ * up yet, pg_get_timezone_name will return NULL and we will leave
* the setting as UNKNOWN. If this isn't overridden from the
* config file then pg_timezone_initialize() will eventually
* select a default value from the environment.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.91 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.92 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Create the view relation
*
- * NOTE: if it already exists and replace is false, the xact will be aborted.
+ * NOTE: if it already exists and replace is false, the xact will be
+ * aborted.
*/
viewOid = DefineVirtualRelation(view, viewParse->targetList, replace);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.85 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.86 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* but just pass up input tuples, we have to recursively examine the input
* plan node.
*
- * Note: Hash and Material are listed here because they sometimes return an
- * original input tuple, not a copy. But Sort and SetOp never return an
- * original tuple, so they can be treated like projecting nodes.
+ * Note: Hash and Material are listed here because they sometimes return
+ * an original input tuple, not a copy. But Sort and SetOp never return
+ * an original tuple, so they can be treated like projecting nodes.
*/
switch (nodeTag(node))
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.16 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.17 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* created new entry
*
- * Zero any caller-requested space in the entry. (This zaps the "key
- * data" dynahash.c copied into the new entry, but we don't care
- * since we're about to overwrite it anyway.)
+ * Zero any caller-requested space in the entry. (This zaps the
+ * "key data" dynahash.c copied into the new entry, but we don't
+ * care since we're about to overwrite it anyway.)
*/
MemSet(entry, 0, hashtable->entrysize);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execJunk.c,v 1.50 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execJunk.c,v 1.51 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Now calculate the mapping between the original tuple's attributes and
* the "clean" tuple's attributes.
*
- * The "map" is an array of "cleanLength" attribute numbers, i.e. one entry
- * for every attribute of the "clean" tuple. The value of this entry is
- * the attribute number of the corresponding attribute of the "original"
- * tuple. (Zero indicates a NULL output attribute, but we do not use that
- * feature in this routine.)
+ * The "map" is an array of "cleanLength" attribute numbers, i.e. one
+ * entry for every attribute of the "clean" tuple. The value of this entry
+ * is the attribute number of the corresponding attribute of the
+ * "original" tuple. (Zero indicates a NULL output attribute, but we do
+ * not use that feature in this routine.)
*/
cleanLength = cleanTupType->natts;
if (cleanLength > 0)
* Calculate the mapping between the original tuple's attributes and the
* "clean" tuple's attributes.
*
- * The "map" is an array of "cleanLength" attribute numbers, i.e. one entry
- * for every attribute of the "clean" tuple. The value of this entry is
- * the attribute number of the corresponding attribute of the "original"
- * tuple. We store zero for any deleted attributes, marking that a NULL
- * is needed in the output tuple.
+ * The "map" is an array of "cleanLength" attribute numbers, i.e. one
+ * entry for every attribute of the "clean" tuple. The value of this entry
+ * is the attribute number of the corresponding attribute of the
+ * "original" tuple. We store zero for any deleted attributes, marking
+ * that a NULL is needed in the output tuple.
*/
cleanLength = cleanTupType->natts;
if (cleanLength > 0)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.260 2005/11/20 18:38:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.261 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* userid to check as: current user unless we have a setuid indication.
*
- * Note: GetUserId() is presently fast enough that there's no harm in calling
- * it separately for each RTE. If that stops being true, we could call it
- * once in ExecCheckRTPerms and pass the userid down from there. But for
- * now, no need for the extra clutter.
+ * Note: GetUserId() is presently fast enough that there's no harm in
+ * calling it separately for each RTE. If that stops being true, we could
+ * call it once in ExecCheckRTPerms and pass the userid down from there.
+ * But for now, no need for the extra clutter.
*/
userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
* initialize the executor "tuple" table. We need slots for all the plan
* nodes, plus possibly output slots for the junkfilter(s). At this point
* we aren't sure if we need junkfilters, so just add slots for them
- * unconditionally. Also, if it's not a SELECT, set up a slot for use
- * for trigger output tuples.
+ * unconditionally. Also, if it's not a SELECT, set up a slot for use for
+ * trigger output tuples.
*/
{
int nSlots = ExecCountSlotsNode(plan);
/*
* We can skip WAL-logging the insertions, unless PITR is in use.
*
- * Note that for a non-temp INTO table, this is safe only because we know
- * that the catalog changes above will have been WAL-logged, and so
- * RecordTransactionCommit will think it needs to WAL-log the eventual
- * transaction commit. Else the commit might be lost, even though all
- * the data is safely fsync'd ...
+ * Note that for a non-temp INTO table, this is safe only because we
+ * know that the catalog changes above will have been WAL-logged, and
+ * so RecordTransactionCommit will think it needs to WAL-log the
+ * eventual transaction commit. Else the commit might be lost, even
+ * though all the data is safely fsync'd ...
*/
estate->es_into_relation_use_wal = XLogArchivingActive();
}
/*
* delete the tuple
*
- * Note: if es_crosscheck_snapshot isn't InvalidSnapshot, we check that the
- * row to be deleted is visible to that snapshot, and throw a can't-
+ * Note: if es_crosscheck_snapshot isn't InvalidSnapshot, we check that
+ * the row to be deleted is visible to that snapshot, and throw a can't-
* serialize error if not. This is a special-case behavior needed for
* referential integrity updates in serializable transactions.
*/
/*
* Check the constraints of the tuple
*
- * If we generate a new candidate tuple after EvalPlanQual testing, we must
- * loop back here and recheck constraints. (We don't need to redo
+ * If we generate a new candidate tuple after EvalPlanQual testing, we
+ * must loop back here and recheck constraints. (We don't need to redo
* triggers, however. If there are any BEFORE triggers then trigger.c
* will have done heap_lock_tuple to lock the correct tuple, so there's no
* need to do them again.)
/*
* replace the heap tuple
*
- * Note: if es_crosscheck_snapshot isn't InvalidSnapshot, we check that the
- * row to be updated is visible to that snapshot, and throw a can't-
+ * Note: if es_crosscheck_snapshot isn't InvalidSnapshot, we check that
+ * the row to be updated is visible to that snapshot, and throw a can't-
* serialize error if not. This is a special-case behavior needed for
* referential integrity updates in serializable transactions.
*/
* Note: instead of having to update the old index tuples associated with
* the heap tuple, all we do is form and insert new index tuples. This is
* because UPDATEs are actually DELETEs and INSERTs, and index tuple
- * deletion is done later by VACUUM (see notes in ExecDelete). All we do
+ * deletion is done later by VACUUM (see notes in ExecDelete). All we do
* here is insert new index tuples. -cim 9/27/89
*/
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.184 2005/11/17 22:14:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.185 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static Datum ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalWholeRowVar(ExprState *exprstate, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalConst(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalParam(ExprState *exprstate, ExprContext *econtext,
if (isAssignment)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("array subscript in assignment must not be NULL")));
+ errmsg("array subscript in assignment must not be NULL")));
*isNull = true;
return (Datum) NULL;
}
* array and the value to be assigned into it must be non-NULL, else
* we punt and return the original array.
*/
- if (astate->refattrlength > 0) /* fixed-length array? */
+ if (astate->refattrlength > 0) /* fixed-length array? */
if (eisnull || *isNull)
return PointerGetDatum(array_source);
/*
* For assignment to varlena arrays, we handle a NULL original array
- * by substituting an empty (zero-dimensional) array; insertion of
- * the new element will result in a singleton array value. It does
- * not matter whether the new element is NULL.
+ * by substituting an empty (zero-dimensional) array; insertion of the
+ * new element will result in a singleton array value. It does not
+ * matter whether the new element is NULL.
*/
if (*isNull)
{
Assert(variable->varattno == InvalidAttrNumber);
/*
- * Whole-row Vars can only appear at the level of a relation scan,
- * never in a join.
+ * Whole-row Vars can only appear at the level of a relation scan, never
+ * in a join.
*/
Assert(variable->varno != INNER);
Assert(variable->varno != OUTER);
tupleDesc = slot->tts_tupleDescriptor;
/*
- * We have to make a copy of the tuple so we can safely insert the
- * Datum overhead fields, which are not set in on-disk tuples.
+ * We have to make a copy of the tuple so we can safely insert the Datum
+ * overhead fields, which are not set in on-disk tuples.
*/
dtuple = (HeapTupleHeader) palloc(tuple->t_len);
memcpy((char *) dtuple, (char *) tuple->t_data, tuple->t_len);
HeapTupleHeaderSetDatumLength(dtuple, tuple->t_len);
/*
- * If the Var identifies a named composite type, label the tuple
- * with that type; otherwise use what is in the tupleDesc.
+ * If the Var identifies a named composite type, label the tuple with that
+ * type; otherwise use what is in the tupleDesc.
*
- * It's likely that the slot's tupleDesc is a record type; if so,
- * make sure it's been "blessed", so that the Datum can be interpreted
- * later.
+ * It's likely that the slot's tupleDesc is a record type; if so, make
+ * sure it's been "blessed", so that the Datum can be interpreted later.
*/
if (variable->vartype != RECORDOID)
{
return BoolGetDatum(!useOr);
/*
- * If the scalar is NULL, and the function is strict, return NULL;
- * no point in iterating the loop.
+ * If the scalar is NULL, and the function is strict, return NULL; no
+ * point in iterating the loop.
*/
if (fcinfo.argnull[0] && sstate->fxprstate.func.fn_strict)
{
}
else
{
- dataoffset = 0; /* marker for no null bitmap */
+ dataoffset = 0; /* marker for no null bitmap */
nbytes += ARR_OVERHEAD_NONULLS(ndims);
}
{
case T_Var:
{
- Var *var = (Var *) node;
+ Var *var = (Var *) node;
state = (ExprState *) makeNode(ExprState);
if (var->varattno != InvalidAttrNumber)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.88 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.89 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* in which this could be optimized but it's probably not worth worrying
* about.)
*
- * We may be called in a context that is shorter-lived than the tuple slot,
- * but we have to ensure that the materialized tuple will survive anyway.
+ * We may be called in a context that is shorter-lived than the tuple
+ * slot, but we have to ensure that the materialized tuple will survive
+ * anyway.
*/
oldContext = MemoryContextSwitchTo(slot->tts_mcxt);
newTuple = ExecCopySlotTuple(slot);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.127 2005/11/14 17:42:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.128 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Open and lock the index relation
*
- * If the index AM supports concurrent updates, obtain RowExclusiveLock
- * to signify that we are updating the index. This locks out only
- * operations that need exclusive access, such as relocating the index
- * to a new tablespace.
+ * If the index AM supports concurrent updates, obtain
+ * RowExclusiveLock to signify that we are updating the index. This
+ * locks out only operations that need exclusive access, such as
+ * relocating the index to a new tablespace.
*
* If the index AM is not safe for concurrent updates, obtain an
* exclusive lock on the index to lock out other updaters as well as
* readers (index_beginscan places AccessShareLock).
*
- * If there are multiple not-concurrent-safe indexes, all backends must
- * lock the indexes in the same order or we will get deadlocks here.
- * This is guaranteed by RelationGetIndexList(), which promises to
- * return the index list in OID order.
+ * If there are multiple not-concurrent-safe indexes, all backends
+ * must lock the indexes in the same order or we will get deadlocks
+ * here. This is guaranteed by RelationGetIndexList(), which promises
+ * to return the index list in OID order.
*
* The locks will be released in ExecCloseIndices.
*/
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.98 2005/10/15 02:49:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.99 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* If the function has any arguments declared as polymorphic types, then
* it wasn't type-checked at definition time; must do so now.
*
- * Also, force a type-check if the declared return type is a rowtype; we need
- * to find out whether we are actually returning the whole tuple result,
- * or just regurgitating a rowtype expression result. In the latter case
- * we clear returnsTuple because we need not act different from the scalar
- * result case.
+ * Also, force a type-check if the declared return type is a rowtype; we
+ * need to find out whether we are actually returning the whole tuple
+ * result, or just regurgitating a rowtype expression result. In the
+ * latter case we clear returnsTuple because we need not act different
+ * from the scalar result case.
*
* In the returnsTuple case, check_sql_fn_retval will also construct a
* JunkFilter we can use to coerce the returned rowtype to the desired
* labeling to make it a valid Datum. There are several reasons why
* we do this:
*
- * 1. To copy the tuple out of the child execution context and into the
- * desired result context.
+ * 1. To copy the tuple out of the child execution context and into
+ * the desired result context.
*
- * 2. To remove any junk attributes present in the raw subselect result.
- * (This is probably not absolutely necessary, but it seems like good
- * policy.)
+ * 2. To remove any junk attributes present in the raw subselect
+ * result. (This is probably not absolutely necessary, but it seems
+ * like good policy.)
*
* 3. To insert dummy null columns if the declared result type has any
* attisdropped columns.
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.135 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.136 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* (Re)set transValue to the initial value.
*
- * Note that when the initial value is pass-by-ref, we must copy it (into
- * the aggcontext) since we will pfree the transValue later.
+ * Note that when the initial value is pass-by-ref, we must copy it
+ * (into the aggcontext) since we will pfree the transValue later.
*/
if (peraggstate->initValueIsNull)
pergroupstate->transValue = peraggstate->initValue;
* already checked that the agg's input type is binary-compatible
* with its transtype, so straight copy here is OK.)
*
- * We must copy the datum into aggcontext if it is pass-by-ref. We do
- * not need to pfree the old transValue, since it's NULL.
+ * We must copy the datum into aggcontext if it is pass-by-ref. We
+ * do not need to pfree the old transValue, since it's NULL.
*/
oldContext = MemoryContextSwitchTo(aggstate->aggcontext);
pergroupstate->transValue = datumCopy(newVal,
* aggregate will have a targetlist reference to ctid. We need to
* return a null for ctid in that situation, not coredump.
*
- * The values returned for the aggregates will be the initial values of
- * the transition functions.
+ * The values returned for the aggregates will be the initial values
+ * of the transition functions.
*/
if (TupIsNull(firstSlot))
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.10 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.11 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Miscellaneous initialization
*
- * We do not need a standard exprcontext for this node, though we may decide
- * below to create a runtime-key exprcontext
+ * We do not need a standard exprcontext for this node, though we may
+ * decide below to create a runtime-key exprcontext
*/
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.97 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.98 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Initialize the hash table control block.
*
- * The hashtable control block is just palloc'd from the executor's per-query
- * memory context.
+ * The hashtable control block is just palloc'd from the executor's
+ * per-query memory context.
*/
hashtable = (HashJoinTable) palloc(sizeof(HashJoinTableData));
hashtable->nbuckets = nbuckets;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.76 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.77 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* 1. In a LEFT JOIN, we have to process outer batches even if the inner
* batch is empty.
*
- * 2. If we have increased nbatch since the initial estimate, we have to scan
- * inner batches since they might contain tuples that need to be
+ * 2. If we have increased nbatch since the initial estimate, we have to
+ * scan inner batches since they might contain tuples that need to be
* reassigned to later inner batches.
*
- * 3. Similarly, if we have increased nbatch since starting the outer scan,
- * we have to rescan outer batches in case they contain tuples that need
- * to be reassigned.
+ * 3. Similarly, if we have increased nbatch since starting the outer
+ * scan, we have to rescan outer batches in case they contain tuples that
+ * need to be reassigned.
*/
curbatch++;
while (curbatch < nbatch &&
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.104 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.105 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* listed in the var node and use the value of the const as comparison
* data.
*
- * If we don't have a const node, it means our scan key is a function of
- * information obtained during the execution of the plan, in which
+ * If we don't have a const node, it means our scan key is a function
+ * of information obtained during the execution of the plan, in which
* case we need to recalculate the index scan key at run time. Hence,
* we set have_runtime_keys to true and place the appropriate
* subexpression in run_keys. The corresponding scan key values are
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.75 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.76 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* much like SelectSortFunction except we insist on matching all the
* operators provided, and it can be a cross-type opclass.
*
- * XXX for now, insist on forward sort so that NULLs can be counted on to
- * be high.
+ * XXX for now, insist on forward sort so that NULLs can be counted on
+ * to be high.
*/
catlist = SearchSysCacheList(AMOPOPID, 1,
ObjectIdGetDatum(qual->opno),
* scan position to the first mark, and go join that tuple
* (and any following ones) to the new outer.
*
- * NOTE: we do not need to worry about the MatchedInner state
- * for the rescanned inner tuples. We know all of them
- * will match this new outer tuple and therefore won't be
- * emitted as fill tuples. This works *only* because we
- * require the extra joinquals to be nil when doing a
- * right or full join --- otherwise some of the rescanned
- * tuples might fail the extra joinquals.
+ * NOTE: we do not need to worry about the MatchedInner
+ * state for the rescanned inner tuples. We know all of
+ * them will match this new outer tuple and therefore
+ * won't be emitted as fill tuples. This works *only*
+ * because we require the extra joinquals to be nil when
+ * doing a right or full join --- otherwise some of the
+ * rescanned tuples might fail the extra joinquals.
*/
ExecRestrPos(innerPlan);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.39 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.40 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* test the inner and outer tuples to see if they satisfy the node's
* qualification.
*
- * Only the joinquals determine MatchedOuter status, but all quals must
- * pass to actually return the tuple.
+ * Only the joinquals determine MatchedOuter status, but all quals
+ * must pass to actually return the tuple.
*/
ENL1_printf("testing qualification");
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.70 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.71 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* unequal to the LHS; if so, the result is UNKNOWN. (We skip that part
* if we don't care about UNKNOWN.) Otherwise, the result is FALSE.
*
- * Note: the reason we can avoid a full scan of the main hash table is that
- * the combining operators are assumed never to yield NULL when both
+ * Note: the reason we can avoid a full scan of the main hash table is
+ * that the combining operators are assumed never to yield NULL when both
* inputs are non-null. If they were to do so, we might need to produce
* UNKNOWN instead of FALSE because of an UNKNOWN result in comparing the
* LHS to some main-table entry --- which is a comparison we will not even
* FALSE for ANY_SUBLINK, TRUE for ALL_SUBLINK, NULL for
* MULTIEXPR_SUBLINK.
*
- * For EXPR_SUBLINK we require the subplan to produce no more than one tuple,
- * else an error is raised. For ARRAY_SUBLINK we allow the subplan to
- * produce more than one tuple. In either case, if zero tuples are
+ * For EXPR_SUBLINK we require the subplan to produce no more than one
+ * tuple, else an error is raised. For ARRAY_SUBLINK we allow the subplan
+ * to produce more than one tuple. In either case, if zero tuples are
* produced, we return NULL. Assuming we get a tuple, we just use its
* first column (there can be only one non-junk column in this case).
*/
* If we need to distinguish accurately between FALSE and UNKNOWN (i.e.,
* NULL) results of the IN operation, then we have to store subplan output
* rows that are partly or wholly NULL. We store such rows in a separate
- * hash table that we expect will be much smaller than the main table.
- * (We can use hashing to eliminate partly-null rows that are not
- * distinct. We keep them separate to minimize the cost of the inevitable
- * full-table searches; see findPartialMatch.)
+ * hash table that we expect will be much smaller than the main table. (We
+ * can use hashing to eliminate partly-null rows that are not distinct.
+ * We keep them separate to minimize the cost of the inevitable full-table
+ * searches; see findPartialMatch.)
*
- * If it's not necessary to distinguish FALSE and UNKNOWN, then we don't need
- * to store subplan output rows that contain NULL.
+ * If it's not necessary to distinguish FALSE and UNKNOWN, then we don't
+ * need to store subplan output rows that contain NULL.
*/
MemoryContextReset(node->tablecxt);
node->hashtable = NULL;
* righthand sides. We need both the ExprState list (for ExecProject)
* and the underlying parse Exprs (for ExecTypeFromTL).
*
- * We also extract the combining operators themselves to initialize the
- * equality and hashing functions for the hash tables.
+ * We also extract the combining operators themselves to initialize
+ * the equality and hashing functions for the hash tables.
*/
lefttlist = righttlist = NIL;
leftptlist = rightptlist = NIL;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.48 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.49 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* now loop, returning only non-duplicate tuples. We assume that the
* tuples arrive in sorted order so we can detect duplicates easily.
*
- * We return the first tuple from each group of duplicates (or the last tuple
- * of each group, when moving backwards). At either end of the subplan,
- * clear the result slot so that we correctly return the first/last tuple
- * when reversing direction.
+ * We return the first tuple from each group of duplicates (or the last
+ * tuple of each group, when moving backwards). At either end of the
+ * subplan, clear the result slot so that we correctly return the
+ * first/last tuple when reversing direction.
*/
for (;;)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.144 2005/11/03 17:11:36 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.145 2005/11/22 18:17:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Create memory contexts for this procedure
*
- * XXX it would be better to use PortalContext as the parent context, but we
- * may not be inside a portal (consider deferred-trigger execution).
+ * XXX it would be better to use PortalContext as the parent context, but
+ * we may not be inside a portal (consider deferred-trigger execution).
* Perhaps CurTransactionContext would do? For now it doesn't matter
* because we clean up explicitly in AtEOSubXact_SPI().
*/
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.132 2005/10/17 16:24:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.133 2005/11/22 18:17:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
ereport(LOG,
(errmsg("Kerberos sname_to_principal(\"%s\", \"%s\") returned error %d",
- khostname ? khostname : "server hostname", pg_krb_srvnam, retval)));
+ khostname ? khostname : "server hostname", pg_krb_srvnam, retval)));
com_err("postgres", retval,
"while getting server principal for server \"%s\" for service \"%s\"",
khostname ? khostname : "server hostname", pg_krb_srvnam);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/be-fsstubs.c,v 1.79 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-fsstubs.c,v 1.80 2005/11/22 18:17:11 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
/*
* open the file to be written to
*
- * Note: we reduce backend's normal 077 umask to the slightly friendlier 022.
- * This code used to drop it all the way to 0, but creating world-writable
- * export files doesn't seem wise.
+ * Note: we reduce backend's normal 077 umask to the slightly friendlier
+ * 022. This code used to drop it all the way to 0, but creating
+ * world-writable export files doesn't seem wise.
*/
nbytes = VARSIZE(filename) - VARHDRSZ;
if (nbytes >= MAXPGPATH)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.59 2005/10/15 02:49:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.60 2005/11/22 18:17:11 momjian Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
/*
* Require no public access to key file.
*
- * XXX temporarily suppress check when on Windows, because there may not
- * be proper support for Unix-y file permissions. Need to think of a
- * reasonable check to apply on Windows. (See also the data directory
- * permission check in postmaster.c)
+ * XXX temporarily suppress check when on Windows, because there may
+ * not be proper support for Unix-y file permissions. Need to think
+ * of a reasonable check to apply on Windows. (See also the data
+ * directory permission check in postmaster.c)
*/
#if !defined(WIN32) && !defined(__CYGWIN__)
if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.32 2005/10/17 16:24:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.33 2005/11/22 18:17:11 momjian Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
#include "libpq/ip.h"
-static int range_sockaddr_AF_INET(const struct sockaddr_in *addr,
- const struct sockaddr_in *netaddr,
- const struct sockaddr_in *netmask);
+static int range_sockaddr_AF_INET(const struct sockaddr_in * addr,
+ const struct sockaddr_in * netaddr,
+ const struct sockaddr_in * netmask);
#ifdef HAVE_IPV6
-static int range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
- const struct sockaddr_in6 *netaddr,
- const struct sockaddr_in6 *netmask);
+static int range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr,
+ const struct sockaddr_in6 * netaddr,
+ const struct sockaddr_in6 * netmask);
#endif
#ifdef HAVE_UNIX_SOCKETS
static int getaddrinfo_unix(const char *path,
- const struct addrinfo *hintsp,
- struct addrinfo **result);
+ const struct addrinfo * hintsp,
+ struct addrinfo ** result);
-static int getnameinfo_unix(const struct sockaddr_un *sa, int salen,
+static int getnameinfo_unix(const struct sockaddr_un * sa, int salen,
char *node, int nodelen,
char *service, int servicelen,
int flags);
*/
int
pg_getaddrinfo_all(const char *hostname, const char *servname,
- const struct addrinfo *hintp, struct addrinfo **result)
+ const struct addrinfo * hintp, struct addrinfo ** result)
{
/* not all versions of getaddrinfo() zero *result on failure */
*result = NULL;
* not safe to look at ai_family in the addrinfo itself.
*/
void
-pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai)
+pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai)
{
#ifdef HAVE_UNIX_SOCKETS
if (hint_ai_family == AF_UNIX)
* guaranteed to be filled with something even on failure return.
*/
int
-pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen,
+pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen,
char *node, int nodelen,
char *service, int servicelen,
int flags)
* -------
*/
static int
-getaddrinfo_unix(const char *path, const struct addrinfo *hintsp,
- struct addrinfo **result)
+getaddrinfo_unix(const char *path, const struct addrinfo * hintsp,
+ struct addrinfo ** result)
{
struct addrinfo hints;
struct addrinfo *aip;
* Convert an address to a hostname.
*/
static int
-getnameinfo_unix(const struct sockaddr_un *sa, int salen,
+getnameinfo_unix(const struct sockaddr_un * sa, int salen,
char *node, int nodelen,
char *service, int servicelen,
int flags)
return 0;
}
-
#endif /* HAVE_UNIX_SOCKETS */
* in the same address family; and AF_UNIX addresses are not supported.
*/
int
-pg_range_sockaddr(const struct sockaddr_storage *addr,
- const struct sockaddr_storage *netaddr,
- const struct sockaddr_storage *netmask)
+pg_range_sockaddr(const struct sockaddr_storage * addr,
+ const struct sockaddr_storage * netaddr,
+ const struct sockaddr_storage * netmask)
{
if (addr->ss_family == AF_INET)
return range_sockaddr_AF_INET((struct sockaddr_in *) addr,
}
static int
-range_sockaddr_AF_INET(const struct sockaddr_in *addr,
- const struct sockaddr_in *netaddr,
- const struct sockaddr_in *netmask)
+range_sockaddr_AF_INET(const struct sockaddr_in * addr,
+ const struct sockaddr_in * netaddr,
+ const struct sockaddr_in * netmask)
{
if (((addr->sin_addr.s_addr ^ netaddr->sin_addr.s_addr) &
netmask->sin_addr.s_addr) == 0)
#ifdef HAVE_IPV6
static int
-range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
- const struct sockaddr_in6 *netaddr,
- const struct sockaddr_in6 *netmask)
+range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr,
+ const struct sockaddr_in6 * netaddr,
+ const struct sockaddr_in6 * netmask)
{
int i;
return 1;
}
-
-#endif /* HAVE_IPV6 */
+#endif /* HAVE_IPV6 */
/*
* pg_sockaddr_cidr_mask - make a network mask of the appropriate family
* Return value is 0 if okay, -1 if not.
*/
int
-pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family)
+pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, char *numbits, int family)
{
long bits;
char *endptr;
* that pg_range_sockaddr will look at.
*/
void
-pg_promote_v4_to_v6_addr(struct sockaddr_storage *addr)
+pg_promote_v4_to_v6_addr(struct sockaddr_storage * addr)
{
struct sockaddr_in addr4;
struct sockaddr_in6 addr6;
* that pg_range_sockaddr will look at.
*/
void
-pg_promote_v4_to_v6_mask(struct sockaddr_storage *addr)
+pg_promote_v4_to_v6_mask(struct sockaddr_storage * addr)
{
struct sockaddr_in addr4;
struct sockaddr_in6 addr6;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.96 2005/10/15 02:49:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.97 2005/11/22 18:17:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* code will NOT be executed when a backend or sub-bootstrap run is forked
* by the postmaster.
*
- * XXX The need for code here is proof that the platform in question is too
- * brain-dead to provide a standard C execution environment without help.
- * Avoid adding more here, if you can.
+ * XXX The need for code here is proof that the platform in question is
+ * too brain-dead to provide a standard C execution environment without
+ * help. Avoid adding more here, if you can.
*/
#if defined(__alpha) /* no __alpha__ ? */
* be overwritten in order to set the process title for ps. In such cases
* save_ps_display_args makes and returns a new copy of the argv[] array.
*
- * save_ps_display_args may also move the environment strings to make extra
- * room. Therefore this should be done as early as possible during
+ * save_ps_display_args may also move the environment strings to make
+ * extra room. Therefore this should be done as early as possible during
* startup, to avoid entanglements with code that might save a getenv()
* result pointer.
*/
/*
* Start our win32 signal implementation
*
- * SubPostmasterMain() will do this for itself, but the remaining modes need
- * it here
+ * SubPostmasterMain() will do this for itself, but the remaining modes
+ * need it here
*/
pgwin32_signal_initialize();
#endif
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.320 2005/11/22 15:24:17 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.321 2005/11/22 18:17:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
static DropOwnedStmt *
-_copyDropOwnedStmt(DropOwnedStmt *from)
+_copyDropOwnedStmt(DropOwnedStmt * from)
{
DropOwnedStmt *newnode = makeNode(DropOwnedStmt);
COPY_NODE_FIELD(roles);
COPY_SCALAR_FIELD(behavior);
-
+
return newnode;
}
static ReassignOwnedStmt *
-_copyReassignOwnedStmt(ReassignOwnedStmt *from)
+_copyReassignOwnedStmt(ReassignOwnedStmt * from)
{
ReassignOwnedStmt *newnode = makeNode(ReassignOwnedStmt);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.257 2005/11/22 15:24:17 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.258 2005/11/22 18:17:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
static bool
-_equalDropOwnedStmt(DropOwnedStmt *a, DropOwnedStmt *b)
+_equalDropOwnedStmt(DropOwnedStmt * a, DropOwnedStmt * b)
{
COMPARE_NODE_FIELD(roles);
COMPARE_SCALAR_FIELD(behavior);
}
static bool
-_equalReassignOwnedStmt(ReassignOwnedStmt *a, ReassignOwnedStmt *b)
+_equalReassignOwnedStmt(ReassignOwnedStmt * a, ReassignOwnedStmt * b)
{
COMPARE_NODE_FIELD(roles);
COMPARE_NODE_FIELD(newrole);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.77 2005/10/15 02:49:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.78 2005/11/22 18:17:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* truncating the list to its original length. NOTE this assumes that any
* added entries are appended at the end!
*
- * We also must take care not to mess up the outer join_rel_hash, if there is
- * one. We can do this by just temporarily setting the link to NULL. (If
- * we are dealing with enough join rels, which we very likely are, a new
- * hash table will get built and used locally.)
+ * We also must take care not to mess up the outer join_rel_hash, if there
+ * is one. We can do this by just temporarily setting the link to NULL.
+ * (If we are dealing with enough join rels, which we very likely are, a
+ * new hash table will get built and used locally.)
*/
savelength = list_length(evaldata->root->join_rel_list);
savehash = evaldata->root->join_rel_hash;
* tour other than the one given. To the extent that the heuristics are
* helpful, however, this will be a better plan than the raw tour.
*
- * Also, when a join attempt fails (because of IN-clause constraints), we may
- * be able to recover and produce a workable plan, where the old code just
- * had to give up. This case acts the same as a false result from
+ * Also, when a join attempt fails (because of IN-clause constraints), we
+ * may be able to recover and produce a workable plan, where the old code
+ * just had to give up. This case acts the same as a false result from
* desirable_join().
*/
for (rel_count = 0; rel_count < num_gene; rel_count++)
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_pool.c,v 1.27 2005/10/15 02:49:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_pool.c,v 1.28 2005/11/22 18:17:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* We immediately discard any invalid individuals (those that geqo_eval
* returns DBL_MAX for), thereby not wasting pool space on them.
*
- * If we fail to make any valid individuals after 10000 tries, give up; this
- * probably means something is broken, and we shouldn't just let ourselves
- * get stuck in an infinite loop.
+ * If we fail to make any valid individuals after 10000 tries, give up;
+ * this probably means something is broken, and we shouldn't just let
+ * ourselves get stuck in an infinite loop.
*/
i = 0;
while (i < pool->size)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.137 2005/10/15 02:49:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.138 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Restrictions on individual clauses are checked by
* qual_is_pushdown_safe().
*
- * Non-pushed-down clauses will get evaluated as qpquals of the SubqueryScan
- * node.
+ * Non-pushed-down clauses will get evaluated as qpquals of the
+ * SubqueryScan node.
*
* XXX Are there any cases where we want to make a policy decision not to
* push down a pushable qual, because it'd result in a worse plan?
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.149 2005/10/15 02:49:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.150 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* disk costs
*
- * The cost of reading a page sequentially is 1.0, by definition. Note that
- * the Unix kernel will typically do some amount of read-ahead
+ * The cost of reading a page sequentially is 1.0, by definition. Note
+ * that the Unix kernel will typically do some amount of read-ahead
* optimization, so that this cost is less than the true cost of reading a
* page from disk. We ignore that issue here, but must take it into
* account when estimating the cost of non-sequential accesses!
/*
* Estimate CPU costs per tuple.
*
- * Often the indexquals don't need to be rechecked at each tuple ... but not
- * always, especially not if there are enough tuples involved that the
+ * Often the indexquals don't need to be rechecked at each tuple ... but
+ * not always, especially not if there are enough tuples involved that the
* bitmaps become lossy. For the moment, just assume they will be
* rechecked always.
*/
* We will produce a single output tuple if not grouping, and a tuple per
* group otherwise. We charge cpu_tuple_cost for each output tuple.
*
- * Note: in this cost model, AGG_SORTED and AGG_HASHED have exactly the same
- * total CPU cost, but AGG_SORTED has lower startup cost. If the input
- * path is already sorted appropriately, AGG_SORTED should be preferred
- * (since it has no risk of memory overflow). This will happen as long as
- * the computed total costs are indeed exactly equal --- but if there's
- * roundoff error we might do the wrong thing. So be sure that the
- * computations below form the same intermediate values in the same order.
+ * Note: in this cost model, AGG_SORTED and AGG_HASHED have exactly the
+ * same total CPU cost, but AGG_SORTED has lower startup cost. If the
+ * input path is already sorted appropriately, AGG_SORTED should be
+ * preferred (since it has no risk of memory overflow). This will happen
+ * as long as the computed total costs are indeed exactly equal --- but if
+ * there's roundoff error we might do the wrong thing. So be sure that
+ * the computations below form the same intermediate values in the same
+ * order.
*/
if (aggstrategy == AGG_PLAIN)
{
* restriction clauses) separately. We use approx_selectivity here for
* speed --- in most cases, any errors won't affect the result much.
*
- * Note: it's probably bogus to use the normal selectivity calculation here
- * when either the outer or inner path is a UniquePath.
+ * Note: it's probably bogus to use the normal selectivity calculation
+ * here when either the outer or inner path is a UniquePath.
*/
merge_selec = approx_selectivity(root, mergeclauses,
path->jpath.jointype);
* but on the other hand we ignore the bookkeeping costs of mark/restore.
* Not clear if it's worth developing a more refined model.
*
- * The number of re-fetches can be estimated approximately as size of merge
- * join output minus size of inner relation. Assume that the distinct key
- * values are 1, 2, ..., and denote the number of values of each key in
- * the outer relation as m1, m2, ...; in the inner relation, n1, n2, ...
- * Then we have
+ * The number of re-fetches can be estimated approximately as size of
+ * merge join output minus size of inner relation. Assume that the
+ * distinct key values are 1, 2, ..., and denote the number of values of
+ * each key in the outer relation as m1, m2, ...; in the inner relation,
+ * n1, n2, ... Then we have
*
* size of join = m1 * n1 + m2 * n2 + ...
*
- * number of rescanned tuples = (m1 - 1) * n1 + (m2 - 1) * n2 + ... = m1 * n1
- * + m2 * n2 + ... - (n1 + n2 + ...) = size of join - size of inner
+ * number of rescanned tuples = (m1 - 1) * n1 + (m2 - 1) * n2 + ... = m1 *
+ * n1 + m2 * n2 + ... - (n1 + n2 + ...) = size of join - size of inner
* relation
*
- * This equation works correctly for outer tuples having no inner match (nk =
- * 0), but not for inner tuples having no outer match (mk = 0); we are
- * effectively subtracting those from the number of rescanned tuples, when
- * we should not. Can we do better without expensive selectivity
+ * This equation works correctly for outer tuples having no inner match
+ * (nk = 0), but not for inner tuples having no outer match (mk = 0); we
+ * are effectively subtracting those from the number of rescanned tuples,
+ * when we should not. Can we do better without expensive selectivity
* computations?
*/
if (IsA(outer_path, UniquePath))
* inputs that will actually need to be scanned. We use only the first
* (most significant) merge clause for this purpose.
*
- * Since this calculation is somewhat expensive, and will be the same for all
- * mergejoin paths associated with the merge clause, we cache the results
- * in the RestrictInfo node.
+ * Since this calculation is somewhat expensive, and will be the same for
+ * all mergejoin paths associated with the merge clause, we cache the
+ * results in the RestrictInfo node.
*/
if (mergeclauses && path->jpath.jointype != JOIN_FULL)
{
* restriction clauses) separately. We use approx_selectivity here for
* speed --- in most cases, any errors won't affect the result much.
*
- * Note: it's probably bogus to use the normal selectivity calculation here
- * when either the outer or inner path is a UniquePath.
+ * Note: it's probably bogus to use the normal selectivity calculation
+ * here when either the outer or inner path is a UniquePath.
*/
hash_selec = approx_selectivity(root, hashclauses,
path->jpath.jointype);
* bucketsize estimated for any individual hashclause; this is undoubtedly
* conservative.
*
- * BUT: if inner relation has been unique-ified, we can assume it's good for
- * hashing. This is important both because it's the right answer, and
+ * BUT: if inner relation has been unique-ified, we can assume it's good
+ * for hashing. This is important both because it's the right answer, and
* because we avoid contaminating the cache with a value that's wrong for
* non-unique-ified paths.
*/
* and so are boolean operators (AND, OR, NOT). Simplistic, but a lot
* better than no model at all.
*
- * Should we try to account for the possibility of short-circuit evaluation
- * of AND/OR?
+ * Should we try to account for the possibility of short-circuit
+ * evaluation of AND/OR?
*/
if (IsA(node, FuncExpr) ||
IsA(node, OpExpr) ||
* (Sub-selects that can be executed as InitPlans have already been
* removed from the expression.)
*
- * An exception occurs when we have decided we can implement the subplan
- * by hashing.
+ * An exception occurs when we have decided we can implement the
+ * subplan by hashing.
*
*/
SubPlan *subplan = (SubPlan *) node;
/*
* Basically, we multiply size of Cartesian product by selectivity.
*
- * If we are doing an outer join, take that into account: the output must be
- * at least as large as the non-nullable input. (Is there any chance of
- * being even smarter?)
+ * If we are doing an outer join, take that into account: the output must
+ * be at least as large as the non-nullable input. (Is there any chance
+ * of being even smarter?)
*
- * For JOIN_IN and variants, the Cartesian product is figured with respect to
- * a unique-ified input, and then we can clamp to the size of the other
+ * For JOIN_IN and variants, the Cartesian product is figured with respect
+ * to a unique-ified input, and then we can clamp to the size of the other
* input.
*/
switch (jointype)
/*
* Estimate number of rows the function itself will return.
*
- * XXX no idea how to do this yet; but we can at least check whether function
- * returns set or not...
+ * XXX no idea how to do this yet; but we can at least check whether
+ * function returns set or not...
*/
if (expression_returns_set(rte->funcexpr))
rel->tuples = 1000;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.192 2005/11/14 23:54:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.193 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* to imply the predicate. If so, we could use the index in the
* current context.
*
- * We set useful_predicate to true iff the predicate was proven using the
- * current set of clauses. This is needed to prevent matching a
+ * We set useful_predicate to true iff the predicate was proven using
+ * the current set of clauses. This is needed to prevent matching a
* predOK index to an arm of an OR, which would be a legal but
* pointlessly inefficient plan. (A better plan will be generated by
* just scanning the predOK index alone, no OR.)
* always take the first, and sequentially add on paths that result in a
* lower estimated cost.
*
- * We also make some effort to detect directly redundant input paths, as can
- * happen if there are multiple possibly usable indexes. For this we look
- * only at plain IndexPath inputs, not at sub-OR clauses. And we consider
- * an index redundant if all its index conditions were already used by
- * earlier indexes. (We could use predicate_implied_by to have a more
- * intelligent, but much more expensive, check --- but in most cases
+ * We also make some effort to detect directly redundant input paths, as
+ * can happen if there are multiple possibly usable indexes. For this we
+ * look only at plain IndexPath inputs, not at sub-OR clauses. And we
+ * consider an index redundant if all its index conditions were already
+ * used by earlier indexes. (We could use predicate_implied_by to have a
+ * more intelligent, but much more expensive, check --- but in most cases
* simple pointer equality should suffice, since after all the index
* conditions are all coming from the same RestrictInfo lists.)
*
- * XXX is there any risk of throwing away a useful partial index here because
- * we don't explicitly look at indpred? At least in simple cases, the
- * partial index will sort before competing non-partial indexes and so it
- * makes the right choice, but perhaps we need to work harder.
+ * XXX is there any risk of throwing away a useful partial index here
+ * because we don't explicitly look at indpred? At least in simple cases,
+ * the partial index will sort before competing non-partial indexes and so
+ * it makes the right choice, but perhaps we need to work harder.
*
* Note: outputting the selected sub-paths in selectivity order is a good
* thing even if we weren't using that as part of the selection method,
* index. For now, the test only uses restriction clauses (those in
* baserestrictinfo). --Nels, Dec '92
*
- * XXX as of 7.1, equivalence class info *is* available. Consider improving
- * this code as foreseen by Nels.
+ * XXX as of 7.1, equivalence class info *is* available. Consider
+ * improving this code as foreseen by Nels.
*/
foreach(ilist, rel->indexlist)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.97 2005/10/25 20:30:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.98 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* cheapest-startup-cost input paths later, and only if they don't need a
* sort.
*
- * If unique-ification is requested, do it and then handle as a plain inner
- * join.
+ * If unique-ification is requested, do it and then handle as a plain
+ * inner join.
*/
outer_path = outerrel->cheapest_total_path;
inner_path = innerrel->cheapest_total_path;
/*
* Generate a mergejoin on the basis of sorting the cheapest inner.
- * Since a sort will be needed, only cheapest total cost matters.
- * (But create_mergejoin_path will do the right thing if
+ * Since a sort will be needed, only cheapest total cost matters. (But
+ * create_mergejoin_path will do the right thing if
* inner_cheapest_total is already correctly sorted.)
*/
add_path(joinrel, (Path *)
/*
* If processing an outer join, only use its own join clauses in the
- * merge. For inner joins we can use pushed-down clauses too.
- * (Note: we don't set have_nonmergeable_joinclause here because
- * pushed-down clauses will become otherquals not joinquals.)
+ * merge. For inner joins we can use pushed-down clauses too. (Note:
+ * we don't set have_nonmergeable_joinclause here because pushed-down
+ * clauses will become otherquals not joinquals.)
*/
if (isouterjoin && restrictinfo->is_pushed_down)
continue;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.76 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.77 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* innerrel is exactly RHS; conversely JOIN_REVERSE_IN handles
* RHS/LHS.
*
- * JOIN_UNIQUE_OUTER will work if outerrel is exactly RHS; conversely
- * JOIN_UNIQUE_INNER will work if innerrel is exactly RHS.
+ * JOIN_UNIQUE_OUTER will work if outerrel is exactly RHS;
+ * conversely JOIN_UNIQUE_INNER will work if innerrel is exactly
+ * RHS.
*
* But none of these will work if we already found another IN that
* needs to trigger here.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.76 2005/11/14 23:54:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.77 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Find potentially interesting OR joinclauses. Note we must ignore any
- * joinclauses that are marked outerjoin_delayed, because they cannot
- * be pushed down to the per-relation level due to outer-join rules.
- * (XXX in some cases it might be possible to allow this, but it would
- * require substantially more bookkeeping about where the clause came
- * from.)
+ * joinclauses that are marked outerjoin_delayed, because they cannot be
+ * pushed down to the per-relation level due to outer-join rules. (XXX in
+ * some cases it might be possible to allow this, but it would require
+ * substantially more bookkeeping about where the clause came from.)
*/
foreach(i, rel->joininfo)
{
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.73 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.74 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* structure. If we find both of them in the same equivalence set to
* start with, we can quit immediately.
*
- * This is a standard UNION-FIND problem, for which there exist better data
- * structures than simple lists. If this code ever proves to be a
+ * This is a standard UNION-FIND problem, for which there exist better
+ * data structures than simple lists. If this code ever proves to be a
* bottleneck then it could be sped up --- but for now, simple is
* beautiful.
*/
* Match each item in the set with all that appear after it (it's
* sufficient to generate A=B, need not process B=A too).
*
- * A set containing only two items cannot imply any equalities beyond the
- * one that created the set, so we can skip this processing in that
- * case.
+ * A set containing only two items cannot imply any equalities beyond
+ * the one that created the set, so we can skip this processing in
+ * that case.
*/
if (nitems >= 3)
{
* the join clause, since both were automatically generated in the
* cases we care about.
*
- * XXX currently this may fail to match in cross-type cases because
- * the COALESCE will contain typecast operations while the join
- * clause may not (if there is a cross-type mergejoin operator
- * available for the two column types). Is it OK to strip implicit
- * coercions from the COALESCE arguments? What of the sortops in
- * such cases?
+ * XXX currently this may fail to match in cross-type cases
+ * because the COALESCE will contain typecast operations while the
+ * join clause may not (if there is a cross-type mergejoin
+ * operator available for the two column types). Is it OK to strip
+ * implicit coercions from the COALESCE arguments? What of the
+ * sortops in such cases?
*/
if (equal(leftop, cfirst) &&
equal(rightop, csecond) &&
* here! The inner-rel vars we used to need to add are *already* part of
* the outer pathkey!
*
- * We do, however, need to truncate the pathkeys list, since it may contain
- * pathkeys that were useful for forming this joinrel but are
+ * We do, however, need to truncate the pathkeys list, since it may
+ * contain pathkeys that were useful for forming this joinrel but are
* uninteresting to higher levels.
*/
return truncate_useless_pathkeys(root, joinrel, outer_pathkeys);
* any redundant mergeclauses from the input list. However, in
* outer-join scenarios there might be multiple matches. An example is
*
- * select * from a full join b on a.v1 = b.v1 and a.v2 = b.v2 and a.v1 =
- * b.v2;
+ * select * from a full join b on a.v1 = b.v1 and a.v2 = b.v2 and a.v1
+ * = b.v2;
*
* Given the pathkeys ((a.v1), (a.v2)) it is okay to return all three
* clauses (in the order a.v1=b.v1, a.v1=b.v2, a.v2=b.v2) and indeed
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.202 2005/10/19 17:31:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.203 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Can't do it if any system columns or whole-row Vars are requested,
- * either. (This could possibly be fixed but would take some fragile
+ * either. (This could possibly be fixed but would take some fragile
* assumptions in setrefs.c, I think.)
*/
for (i = rel->min_attr; i <= 0; i++)
* caught this case because the join clauses would never have been put
* in the same joininfo list.
*
- * We can skip this if the index path is an ordinary indexpath and not a
- * special innerjoin path.
+ * We can skip this if the index path is an ordinary indexpath and not
+ * a special innerjoin path.
*/
IndexPath *innerpath = (IndexPath *) best_path->innerjoinpath;
/*
* Same deal for bitmapped index scans.
*
- * Note: both here and above, we ignore any implicit index restrictions
- * associated with the use of partial indexes. This is OK because
- * we're only trying to prove we can dispense with some join quals;
- * failing to prove that doesn't result in an incorrect plan. It is
- * the right way to proceed because adding more quals to the stuff we
- * got from the original query would just make it harder to detect
- * duplication.
+ * Note: both here and above, we ignore any implicit index
+ * restrictions associated with the use of partial indexes. This is
+ * OK because we're only trying to prove we can dispense with some
+ * join quals; failing to prove that doesn't result in an incorrect
+ * plan. It is the right way to proceed because adding more quals to
+ * the stuff we got from the original query would just make it harder
+ * to detect duplication.
*/
BitmapHeapPath *innerpath = (BitmapHeapPath *) best_path->innerjoinpath;
/*
* Make a copy that will become the fixed clause.
*
- * We used to try to do a shallow copy here, but that fails if there is a
- * subplan in the arguments of the opclause. So just do a full copy.
+ * We used to try to do a shallow copy here, but that fails if there
+ * is a subplan in the arguments of the opclause. So just do a full
+ * copy.
*/
newclause = (OpExpr *) copyObject((Node *) clause);
* available Var in the tlist. If there isn't any, use the first one
* that is an expression in the input's vars.
*
- * XXX if we have a choice, is there any way of figuring out which might
- * be cheapest to execute? (For example, int4lt is likely much
+ * XXX if we have a choice, is there any way of figuring out which
+ * might be cheapest to execute? (For example, int4lt is likely much
* cheaper to execute than numericlt, but both might appear in the
* same pathkey sublist...) Not clear that we ever will have a choice
* in practice, so it may not matter.
* We also need to account for the cost of evaluation of the qual (ie, the
* HAVING clause) and the tlist.
*
- * XXX this double-counts the cost of evaluation of any expressions used for
- * grouping, since in reality those will have been evaluated at a lower
- * plan level and will only be copied by the Group node. Worth fixing?
+ * XXX this double-counts the cost of evaluation of any expressions used
+ * for grouping, since in reality those will have been evaluated at a
+ * lower plan level and will only be copied by the Group node. Worth
+ * fixing?
*
- * See notes in grouping_planner about why this routine and make_agg are the
- * only ones in this file that worry about tlist eval cost.
+ * See notes in grouping_planner about why this routine and make_agg are
+ * the only ones in this file that worry about tlist eval cost.
*/
if (qual)
{
* building a subquery then it's important to report correct info to the
* outer planner.
*
- * When the offset or count couldn't be estimated, use 10% of the estimated
- * number of rows emitted from the subplan.
+ * When the offset or count couldn't be estimated, use 10% of the
+ * estimated number of rows emitted from the subplan.
*/
if (offset_est != 0)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.111 2005/11/14 23:54:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.112 2005/11/22 18:17:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* we'd produce no output rows, rather than the intended single
* null-extended row, for any nonnullable-side rows failing the qual.
*
- * Note: an outer-join qual that mentions only nullable-side rels can be
- * pushed down into the nullable side without changing the join
+ * Note: an outer-join qual that mentions only nullable-side rels can
+ * be pushed down into the nullable side without changing the join
* result, so we treat it the same as an ordinary inner-join qual,
* except for not setting maybe_equijoin (see below).
*/
/*
* Push the new clause into all the appropriate restrictinfo lists.
*
- * Note: we mark the qual "pushed down" to ensure that it can never be taken
- * for an original JOIN/ON clause.
+ * Note: we mark the qual "pushed down" to ensure that it can never be
+ * taken for an original JOIN/ON clause.
*/
distribute_qual_to_rels(root, (Node *) clause,
true, true, false, NULL, relids);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.10 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.11 2005/11/22 18:17:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Reject unoptimizable cases.
*
- * We don't handle GROUP BY, because our current implementations of grouping
- * require looking at all the rows anyway, and so there's not much point
- * in optimizing MIN/MAX.
+ * We don't handle GROUP BY, because our current implementations of
+ * grouping require looking at all the rows anyway, and so there's not
+ * much point in optimizing MIN/MAX.
*/
if (parse->groupClause)
return NULL;
/*
* Make the cost comparison.
*
- * Note that we don't include evaluation cost of the tlist here; this is OK
- * since it isn't included in best_path's cost either, and should be the
- * same in either case.
+ * Note that we don't include evaluation cost of the tlist here; this is
+ * OK since it isn't included in best_path's cost either, and should be
+ * the same in either case.
*/
cost_agg(&agg_p, root, AGG_PLAIN, list_length(aggs_list),
0, 0,
* node above it. We might need a gating Result, too, to handle any
* non-variable qual clauses.
*
- * Also we must add a "WHERE foo IS NOT NULL" restriction to the indexscan,
- * to be sure we don't return a NULL, which'd be contrary to the standard
- * behavior of MIN/MAX. XXX ideally this should be done earlier, so that
- * the selectivity of the restriction could be included in our cost
- * estimates. But that looks painful, and in most cases the fraction of
- * NULLs isn't high enough to change the decision.
+ * Also we must add a "WHERE foo IS NOT NULL" restriction to the
+ * indexscan, to be sure we don't return a NULL, which'd be contrary to
+ * the standard behavior of MIN/MAX. XXX ideally this should be done
+ * earlier, so that the selectivity of the restriction could be included
+ * in our cost estimates. But that looks painful, and in most cases the
+ * fraction of NULLs isn't high enough to change the decision.
*/
plan = create_plan(&subroot, (Path *) info->path);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.89 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.90 2005/11/22 18:17:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* added to appropriate lists belonging to the mentioned relations. We
* also build lists of equijoined keys for pathkey construction.
*
- * Note: all subplan nodes will have "flat" (var-only) tlists. This implies
- * that all expression evaluations are done at the root of the plan tree.
- * Once upon a time there was code to try to push expensive function calls
- * down to lower plan nodes, but that's dead code and has been for a long
- * time...
+ * Note: all subplan nodes will have "flat" (var-only) tlists. This
+ * implies that all expression evaluations are done at the root of the
+ * plan tree. Once upon a time there was code to try to push expensive
+ * function calls down to lower plan nodes, but that's dead code and has
+ * been for a long time...
*/
build_base_rel_tlists(root, tlist);
* "cheapest presorted" path will be the cheapest overall for the tuple
* fraction.)
*
- * The cheapest-total path is also the one to use if grouping_planner decides
- * to use hashed aggregation, so we return it separately even if this
- * routine thinks the presorted path is the winner.
+ * The cheapest-total path is also the one to use if grouping_planner
+ * decides to use hashed aggregation, so we return it separately even if
+ * this routine thinks the presorted path is the winner.
*/
cheapestpath = final_rel->cheapest_total_path;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.194 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.195 2005/11/22 18:17:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* multiple sub-queries. Also, boundParams is explicitly info from outside
* the query, and so is likewise better handled as a global variable.
*
- * Note we do NOT save and restore PlannerPlanId: it exists to assign unique
- * IDs to SubPlan nodes, and we want those IDs to be unique for the life
- * of a backend. Also, PlannerInitPlan is saved/restored in
+ * Note we do NOT save and restore PlannerPlanId: it exists to assign
+ * unique IDs to SubPlan nodes, and we want those IDs to be unique for the
+ * life of a backend. Also, PlannerInitPlan is saved/restored in
* subquery_planner, not here.
*/
save_PlannerQueryLevel = PlannerQueryLevel;
* HAVING clause into WHERE, in hopes of eliminating tuples before
* aggregation instead of after.
*
- * If the query has explicit grouping then we can simply move such a clause
- * into WHERE; any group that fails the clause will not be in the output
- * because none of its tuples will reach the grouping or aggregation
- * stage. Otherwise we must have a degenerate (variable-free) HAVING
- * clause, which we put in WHERE so that query_planner() can use it in a
- * gating Result node, but also keep in HAVING to ensure that we don't
- * emit a bogus aggregated row. (This could be done better, but it seems
- * not worth optimizing.)
+ * If the query has explicit grouping then we can simply move such a
+ * clause into WHERE; any group that fails the clause will not be in the
+ * output because none of its tuples will reach the grouping or
+ * aggregation stage. Otherwise we must have a degenerate (variable-free)
+ * HAVING clause, which we put in WHERE so that query_planner() can use it
+ * in a gating Result node, but also keep in HAVING to ensure that we
+ * don't emit a bogus aggregated row. (This could be done better, but it
+ * seems not worth optimizing.)
*
* Note that both havingQual and parse->jointree->quals are in
* implicitly-ANDed-list form at this point, even though they are declared
* careful to maintain AND/OR flatness --- that is, do not generate a tree
* with AND directly under AND, nor OR directly under OR.
*
- * Because this is a relatively expensive process, we skip it when the query
- * is trivial, such as "SELECT 2+2;" or "INSERT ... VALUES()". The
+ * Because this is a relatively expensive process, we skip it when the
+ * query is trivial, such as "SELECT 2+2;" or "INSERT ... VALUES()". The
* expression will only be evaluated once anyway, so no point in
* pre-simplifying; we can't execute it any faster than the executor can,
* and we will waste cycles copying the tree. Notice however that we
* XXX my goodness this next bit is ugly. Really need to think about
* ways to rein in planner's habit of scribbling on its input.
*
- * Planning of the subquery might have modified the rangetable, either by
- * addition of RTEs due to expansion of inherited source tables, or by
- * changes of the Query structures inside subquery RTEs. We have to
- * ensure that this gets propagated back to the master copy. However,
- * if we aren't done planning yet, we also need to ensure that
- * subsequent calls to grouping_planner have virgin sub-Queries to
- * work from. So, if we are at the last list entry, just copy the
+ * Planning of the subquery might have modified the rangetable, either
+ * by addition of RTEs due to expansion of inherited source tables, or
+ * by changes of the Query structures inside subquery RTEs. We have
+ * to ensure that this gets propagated back to the master copy.
+ * However, if we aren't done planning yet, we also need to ensure
+ * that subsequent calls to grouping_planner have virgin sub-Queries
+ * to work from. So, if we are at the last list entry, just copy the
* subquery rangetable back to the master copy; if we are not, then
* extend the master copy by adding whatever the subquery added. (We
* assume these added entries will go untouched by the future
* Note: we do not attempt to detect duplicate aggregates here; a
* somewhat-overestimated count is okay for our present purposes.
*
- * Note: think not that we can turn off hasAggs if we find no aggs. It is
- * possible for constant-expression simplification to remove all
+ * Note: think not that we can turn off hasAggs if we find no aggs. It
+ * is possible for constant-expression simplification to remove all
* explicit references to aggs, but we still have to follow the
* aggregate semantics (eg, producing only one output row).
*/
* GROUP BY without aggregation, so insert a group node (plus
* the appropriate sort node, if necessary).
*
- * Add an explicit sort if we couldn't make the path come out the
- * way the GROUP node needs it.
+ * Add an explicit sort if we couldn't make the path come out
+ * the way the GROUP node needs it.
*/
if (!pathkeys_contained_in(group_pathkeys, current_pathkeys))
{
* output won't be sorted may be a loss; so we need to do an actual cost
* comparison.
*
- * We need to consider cheapest_path + hashagg [+ final sort] versus either
- * cheapest_path [+ sort] + group or agg [+ final sort] or presorted_path
- * + group or agg [+ final sort] where brackets indicate a step that may
- * not be needed. We assume query_planner() will have returned a presorted
- * path only if it's a winner compared to cheapest_path for this purpose.
+ * We need to consider cheapest_path + hashagg [+ final sort] versus
+ * either cheapest_path [+ sort] + group or agg [+ final sort] or
+ * presorted_path + group or agg [+ final sort] where brackets indicate a
+ * step that may not be needed. We assume query_planner() will have
+ * returned a presorted path only if it's a winner compared to
+ * cheapest_path for this purpose.
*
- * These path variables are dummies that just hold cost fields; we don't make
- * actual Paths for these steps.
+ * These path variables are dummies that just hold cost fields; we don't
+ * make actual Paths for these steps.
*/
cost_agg(&hashed_p, root, AGG_HASHED, agg_counts->numAggs,
numGroupCols, dNumGroups,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.117 2005/11/03 17:45:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.118 2005/11/22 18:17:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Now recurse into child plans.
*
- * We don't need to (and in fact mustn't) recurse into subqueries, so no need
- * to examine initPlan list.
+ * We don't need to (and in fact mustn't) recurse into subqueries, so no
+ * need to examine initPlan list.
*/
adjust_plan_varnos(plan->lefttree, rtoffset);
adjust_plan_varnos(plan->righttree, rtoffset);
* The inner side is a bitmap scan plan. Fix the top node, and
* recurse to get the lower nodes.
*
- * Note: create_bitmap_scan_plan removes clauses from bitmapqualorig if
- * they are duplicated in qpqual, so must test these independently.
+ * Note: create_bitmap_scan_plan removes clauses from bitmapqualorig
+ * if they are duplicated in qpqual, so must test these independently.
*/
BitmapHeapScan *innerscan = (BitmapHeapScan *) inner_plan;
Index innerrel = innerscan->scan.scanrelid;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.100 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.101 2005/11/22 18:17:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* this sort of aliasing will cause no trouble. The correct field should
* get stored into the Param slot at execution in each part of the tree.
*
- * We also need to demand a match on vartypmod. This does not matter for the
- * Param itself, since those are not typmod-dependent, but it does matter
- * when make_subplan() instantiates a modified copy of the Var for a
- * subplan's args list.
+ * We also need to demand a match on vartypmod. This does not matter for
+ * the Param itself, since those are not typmod-dependent, but it does
+ * matter when make_subplan() instantiates a modified copy of the Var for
+ * a subplan's args list.
*/
i = 0;
foreach(ppl, PlannerParamList)
* 50% retrieval. For EXPR and MULTIEXPR subplans, use default behavior
* (we're only expecting one row out, anyway).
*
- * NOTE: if you change these numbers, also change cost_qual_eval_walker() in
- * path/costsize.c.
+ * NOTE: if you change these numbers, also change cost_qual_eval_walker()
+ * in path/costsize.c.
*
* XXX If an ALL/ANY subplan is uncorrelated, we may decide to hash or
* materialize its result below. In that case it would've been better to
/*
* Okay, pull up the sub-select into top range table and jointree.
*
- * We rely here on the assumption that the outer query has no references to
- * the inner (necessarily true, other than the Vars that we build below).
- * Therefore this is a lot easier than what pull_up_subqueries has to go
- * through.
+ * We rely here on the assumption that the outer query has no references
+ * to the inner (necessarily true, other than the Vars that we build
+ * below). Therefore this is a lot easier than what pull_up_subqueries has
+ * to go through.
*/
rte = addRangeTableEntryForSubquery(NULL,
subselect,
* Finally, attach any initPlans to the topmost plan node, and add their
* extParams to the topmost node's, too.
*
- * We also add the total_cost of each initPlan to the startup cost of the top
- * node. This is a conservative overestimate, since in fact each initPlan
- * might be executed later than plan startup, or even not at all.
+ * We also add the total_cost of each initPlan to the startup cost of the
+ * top node. This is a conservative overestimate, since in fact each
+ * initPlan might be executed later than plan startup, or even not at all.
*/
plan->initPlan = PlannerInitPlan;
PlannerInitPlan = NIL; /* make sure they're not attached twice */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.31 2005/10/15 02:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.32 2005/11/22 18:17:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* routine's processing is complete for its jointree and
* rangetable.
*
- * Note: 'false' is correct here even if we are within an outer join
- * in the upper query; the lower query starts with a clean slate
- * for outer-join semantics.
+ * Note: 'false' is correct here even if we are within an outer
+ * join in the upper query; the lower query starts with a clean
+ * slate for outer-join semantics.
*/
subquery->jointree = (FromExpr *)
pull_up_subqueries(subroot, (Node *) subquery->jointree,
* Now we must recheck whether the subquery is still simple enough
* to pull up. If not, abandon processing it.
*
- * We don't really need to recheck all the conditions involved, but
- * it's easier just to keep this "if" looking the same as the one
- * above.
+ * We don't really need to recheck all the conditions involved,
+ * but it's easier just to keep this "if" looking the same as the
+ * one above.
*/
if (is_simple_subquery(subquery) &&
(!below_outer_join || has_nullable_targetlist(subquery)))
* already adjusted the marker values, so just list_concat the
* list.)
*
- * Executor can't handle multiple FOR UPDATE/SHARE/NOWAIT flags, so
- * complain if they are valid but different
+ * Executor can't handle multiple FOR UPDATE/SHARE/NOWAIT flags,
+ * so complain if they are valid but different
*/
if (parse->rowMarks && subquery->rowMarks)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.51 2005/10/15 02:49:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.52 2005/11/22 18:17:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Generate new OR list consisting of the remaining sub-clauses.
*
- * If any clause degenerates to empty, then we have a situation like (A AND
- * B) OR (A), which can be reduced to just A --- that is, the additional
- * conditions in other arms of the OR are irrelevant.
+ * If any clause degenerates to empty, then we have a situation like (A
+ * AND B) OR (A), which can be reduced to just A --- that is, the
+ * additional conditions in other arms of the OR are irrelevant.
*
* Note that because we use list_difference, any multiple occurrences of a
* winning clause in an AND sub-clause will be removed automatically.
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.78 2005/10/15 02:49:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.79 2005/11/22 18:17:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* for heap_formtuple to work, the targetlist must match the exact order
- * of the attributes. We also need to fill in any missing attributes.
- * -ay 10/94
+ * of the attributes. We also need to fill in any missing attributes. -ay
+ * 10/94
*/
if (command_type == CMD_INSERT || command_type == CMD_UPDATE)
tlist = expand_targetlist(tlist, command_type,
* The rewriter should have already ensured that the TLEs are in correct
* order; but we have to insert TLEs for any missing attributes.
*
- * Scan the tuple description in the relation's relcache entry to make sure
- * we have all the user attributes in the right order. We assume that the
- * rewriter already acquired at least AccessShareLock on the relation, so
- * we need no lock here.
+ * Scan the tuple description in the relation's relcache entry to make
+ * sure we have all the user attributes in the right order. We assume
+ * that the rewriter already acquired at least AccessShareLock on the
+ * relation, so we need no lock here.
*/
rel = heap_open(getrelid(result_relation, range_table), NoLock);
* column isn't dropped, apply any domain constraints that might
* exist --- this is to catch domain NOT NULL.
*
- * For UPDATE, generate a Var reference to the existing value of the
- * attribute, so that it gets copied to the new tuple. But
+ * For UPDATE, generate a Var reference to the existing value of
+ * the attribute, so that it gets copied to the new tuple. But
* generate a NULL for dropped columns (we want to drop any old
* values).
*
- * When generating a NULL constant for a dropped column, we label it
- * INT4 (any other guaranteed-to-exist datatype would do as well).
- * We can't label it with the dropped column's datatype since that
- * might not exist anymore. It does not really matter what we
- * claim the type is, since NULL is NULL --- its representation is
- * datatype-independent. This could perhaps confuse code
- * comparing the finished plan to the target relation, however.
+ * When generating a NULL constant for a dropped column, we label
+ * it INT4 (any other guaranteed-to-exist datatype would do as
+ * well). We can't label it with the dropped column's datatype
+ * since that might not exist anymore. It does not really matter
+ * what we claim the type is, since NULL is NULL --- its
+ * representation is datatype-independent. This could perhaps
+ * confuse code comparing the finished plan to the target
+ * relation, however.
*/
Oid atttype = att_tup->atttypid;
int32 atttypmod = att_tup->atttypmod;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.127 2005/10/15 02:49:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.128 2005/11/22 18:17:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Not same, so plan this child separately.
*
- * Note we disallow any resjunk columns in child results. This is necessary
- * since the Append node that implements the union won't do any
+ * Note we disallow any resjunk columns in child results. This is
+ * necessary since the Append node that implements the union won't do any
* projection, and upper levels will get confused if some of our output
* tuples have junk and some don't. This case only arises when we have an
* EXCEPT or INTERSECT as child, else there won't be resjunk anyway.
* data types and column names. Insert datatype coercions where
* necessary.
*
- * HACK: constants in the input's targetlist are copied up as-is rather
- * than being referenced as subquery outputs. This is mainly to
- * ensure that when we try to coerce them to the output column's
+ * HACK: constants in the input's targetlist are copied up as-is
+ * rather than being referenced as subquery outputs. This is mainly
+ * to ensure that when we try to coerce them to the output column's
* datatype, the right things happen for UNKNOWN constants. But do
* this only at the first level of subquery-scan plans; we don't want
* phony constants appearing in the output tlists of upper-level
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.202 2005/11/17 22:14:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.203 2005/11/22 18:17:14 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
* simplifying functions.) Also, we can optimize field selection from
* a RowExpr construct.
*
- * We must however check that the declared type of the field is still the
- * same as when the FieldSelect was created --- this can change if
+ * We must however check that the declared type of the field is still
+ * the same as when the FieldSelect was created --- this can change if
* someone did ALTER COLUMN TYPE on the rowtype.
*/
FieldSelect *fselect = (FieldSelect *) node;
/*
* And evaluate it.
*
- * It is OK to use a default econtext because none of the ExecEvalExpr() code
- * used in this situation will use econtext. That might seem fortuitous,
- * but it's not so unreasonable --- a constant expression does not depend
- * on context, by definition, n'est ce pas?
+ * It is OK to use a default econtext because none of the ExecEvalExpr()
+ * code used in this situation will use econtext. That might seem
+ * fortuitous, but it's not so unreasonable --- a constant expression does
+ * not depend on context, by definition, n'est ce pas?
*/
const_val = ExecEvalExprSwitchContext(exprstate,
GetPerTupleExprContext(estate),
* The walker has already visited the current node, and so we need only
* recurse into any sub-nodes it has.
*
- * We assume that the walker is not interested in List nodes per se, so when
- * we expect a List we just recurse directly to self without bothering to
- * call the walker.
+ * We assume that the walker is not interested in List nodes per se, so
+ * when we expect a List we just recurse directly to self without
+ * bothering to call the walker.
*/
if (node == NULL)
return false;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.114 2005/10/15 02:49:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.115 2005/11/22 18:17:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Extract info from the relation descriptor for the index.
*
- * Note that we take no lock on the index; we assume our lock on the
- * parent table will protect the index's schema information. When
- * and if the executor actually uses the index, it will take a
- * lock as needed to protect the access to the index contents.
+ * Note that we take no lock on the index; we assume our lock on
+ * the parent table will protect the index's schema information.
+ * When and if the executor actually uses the index, it will take
+ * a lock as needed to protect the access to the index contents.
*/
indexRelation = index_open(indexoid);
index = indexRelation->rd_index;
* infrastructure for redoing cached plans at all, so we have to
* kluge things here instead.
*
- * We approximate "never vacuumed" by "has relpages = 0", which means
- * this will also fire on genuinely empty relations. Not great,
- * but fortunately that's a seldom-seen case in the real world,
- * and it shouldn't degrade the quality of the plan too much
- * anyway to err in this direction.
+ * We approximate "never vacuumed" by "has relpages = 0", which
+ * means this will also fire on genuinely empty relations. Not
+ * great, but fortunately that's a seldom-seen case in the real
+ * world, and it shouldn't degrade the quality of the plan too
+ * much anyway to err in this direction.
*/
if (curpages < 10 && rel->rd_rel->relpages == 0)
curpages = 10;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.72 2005/10/15 02:49:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.73 2005/11/22 18:17:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Use either hashtable lookup or linear search, as appropriate.
*
- * Note: the seemingly redundant hashkey variable is used to avoid taking the
- * address of relids; unless the compiler is exceedingly smart, doing so
- * would force relids out of a register and thus probably slow down the
+ * Note: the seemingly redundant hashkey variable is used to avoid taking
+ * the address of relids; unless the compiler is exceedingly smart, doing
+ * so would force relids out of a register and thus probably slow down the
* list-search case.
*/
if (root->join_rel_hash)
/*
* Eliminate duplicate and redundant clauses.
*
- * We must eliminate duplicates, since we will see many of the same clauses
- * arriving from both input relations. Also, if a clause is a
+ * We must eliminate duplicates, since we will see many of the same
+ * clauses arriving from both input relations. Also, if a clause is a
* mergejoinable clause, it's possible that it is redundant with previous
* clauses (see optimizer/README for discussion). We detect that case and
* omit the redundant clause from the result list.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.43 2005/11/16 17:08:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.44 2005/11/22 18:17:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Build a RestrictInfo node containing the given subexpression.
*
* The is_pushed_down and outerjoin_delayed flags must be supplied by the
- * caller. required_relids can be NULL, in which case it defaults to the
+ * caller. required_relids can be NULL, in which case it defaults to the
* actual clause contents (i.e., clause_relids).
*
* We initialize fields that depend only on the given subexpression, leaving
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.326 2005/10/15 02:49:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.327 2005/11/22 18:17:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Create a new inherited column.
*
- * For constraints, ONLY the NOT NULL constraint is inherited by the new
- * column definition per SQL99.
+ * For constraints, ONLY the NOT NULL constraint is inherited by the
+ * new column definition per SQL99.
*/
def = makeNode(ColumnDef);
def->colname = pstrdup(attributeName);
* strict reading of SQL92 would suggest raising an error instead, but
* that strikes me as too anal-retentive. - tgl 2001-02-14
*
- * XXX in ALTER TABLE case, it'd be nice to look for duplicate pre-existing
- * indexes, too.
+ * XXX in ALTER TABLE case, it'd be nice to look for duplicate
+ * pre-existing indexes, too.
*/
cxt->alist = NIL;
if (cxt->pkey != NULL)
* For efficiency's sake, add OLD to the rule action's jointree
* only if it was actually referenced in the statement or qual.
*
- * For INSERT, NEW is not really a relation (only a reference to the
- * to-be-inserted tuple) and should never be added to the
+ * For INSERT, NEW is not really a relation (only a reference to
+ * the to-be-inserted tuple) and should never be added to the
* jointree.
*
* For UPDATE, we treat NEW as being another kind of reference to
* make lists of the dummy vars and their names for use in parsing ORDER
* BY.
*
- * Note: we use leftmostRTI as the varno of the dummy variables. It shouldn't
- * matter too much which RT index they have, as long as they have one that
- * corresponds to a real RT entry; else funny things may happen when the
- * tree is mashed by rule rewriting.
+ * Note: we use leftmostRTI as the varno of the dummy variables. It
+ * shouldn't matter too much which RT index they have, as long as they
+ * have one that corresponds to a real RT entry; else funny things may
+ * happen when the tree is mashed by rule rewriting.
*/
qry->targetList = NIL;
targetvars = NIL;
/*
* Handle SELECT INTO/CREATE TABLE AS.
*
- * Any column names from CREATE TABLE AS need to be attached to both the top
- * level and the leftmost subquery. We do not do this earlier because we
- * do *not* want the targetnames list to be affected.
+ * Any column names from CREATE TABLE AS need to be attached to both the
+ * top level and the leftmost subquery. We do not do this earlier because
+ * we do *not* want the targetnames list to be affected.
*/
qry->into = into;
if (intoColNames)
* output columns visible. A Join RTE node is handy for this, since we
* can easily control the Vars generated upon matches.
*
- * Note: we don't yet do anything useful with such cases, but at least "ORDER
- * BY upper(foo)" will draw the right error message rather than "foo not
- * found".
+ * Note: we don't yet do anything useful with such cases, but at least
+ * "ORDER BY upper(foo)" will draw the right error message rather than
+ * "foo not found".
*/
jrte = addRangeTableEntryForJoin(NULL,
targetnames,
/*
* Transform SelectStmt into a Query.
*
- * Note: previously transformed sub-queries don't affect the parsing of
- * this sub-query, because they are not in the toplevel pstate's
+ * Note: previously transformed sub-queries don't affect the parsing
+ * of this sub-query, because they are not in the toplevel pstate's
* namespace list.
*/
selectList = parse_sub_analyze((Node *) stmt, pstate);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.168 2005/11/21 12:49:32 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.169 2005/11/22 18:17:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{"header", HEADER},
{"hold", HOLD},
{"hour", HOUR_P},
- {"if",IF_P},
+ {"if", IF_P},
{"ilike", ILIKE},
{"immediate", IMMEDIATE},
{"immutable", IMMUTABLE},
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.143 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.144 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* instead mark target table as requiring exactly the specified
* permissions.
*
- * If we find an explicit reference to the rel later during parse analysis,
- * scanRTEForColumn will add the ACL_SELECT bit back again. That can't
- * happen for INSERT but it is possible for UPDATE and DELETE.
+ * If we find an explicit reference to the rel later during parse
+ * analysis, scanRTEForColumn will add the ACL_SELECT bit back again. That
+ * can't happen for INSERT but it is possible for UPDATE and DELETE.
*/
rte->requiredPerms = requiredPerms;
* XXX this will need further work to support SQL99's LATERAL() feature,
* wherein such references would indeed be legal.
*
- * We can skip groveling through the subquery if there's not anything visible
- * in the current query. Also note that outer references are OK.
+ * We can skip groveling through the subquery if there's not anything
+ * visible in the current query. Also note that outer references are OK.
*/
if (pstate->p_relnamespace || pstate->p_varnamespace)
{
* than one column name exposed by FROM, colNameToVar will
* ereport(ERROR). That's just what we want here.
*
- * Small tweak for 7.4.3: ignore matches in upper query levels. This
- * effectively changes the search order for bare names to (1)
+ * Small tweak for 7.4.3: ignore matches in upper query levels.
+ * This effectively changes the search order for bare names to (1)
* local FROM variables, (2) local targetlist aliases, (3) outer
* FROM variables, whereas before it was (1) (3) (2). SQL92 and
* SQL99 do not allow GROUPing BY an outer reference, so this
* DISTINCT values to the sort list, much as we did above for ordinary
* DISTINCT fields.
*
- * Actually, it'd be OK for the common prefixes of the two lists to match
- * in any order, but implementing that check seems like more trouble
- * than it's worth.
+ * Actually, it'd be OK for the common prefixes of the two lists to
+ * match in any order, but implementing that check seems like more
+ * trouble than it's worth.
*/
ListCell *nextsortlist = list_head(*sortClause);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.132 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.133 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* length checks, which is not always what we want here. Any
* length constraint will be applied later by our caller.
*
- * Note that we call stringTypeDatum using the domain's pg_type row,
- * if it's a domain. This works because the domain row has the
- * same typinput and typelem as the base type --- ugly...
+ * Note that we call stringTypeDatum using the domain's pg_type
+ * row, if it's a domain. This works because the domain row has
+ * the same typinput and typelem as the base type --- ugly...
*/
newcon->constvalue = stringTypeDatum(targetType, val, -1);
}
* array types. If so, and if the element types have a suitable cast,
* use array_type_coerce() or array_type_length_coerce().
*
- * Hack: disallow coercions to oidvector and int2vector, which otherwise
- * tend to capture coercions that should go to "real" array types. We
- * want those types to be considered "real" arrays for many purposes,
- * but not this one. (Also, array_type_coerce isn't guaranteed to
- * produce an output that meets the restrictions of these datatypes,
- * such as being 1-dimensional.)
+ * Hack: disallow coercions to oidvector and int2vector, which
+ * otherwise tend to capture coercions that should go to "real" array
+ * types. We want those types to be considered "real" arrays for many
+ * purposes, but not this one. (Also, array_type_coerce isn't
+ * guaranteed to produce an output that meets the restrictions of
+ * these datatypes, such as being 1-dimensional.)
*/
Oid targetElemType;
Oid sourceElemType;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.186 2005/11/18 23:08:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.187 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Not known as a column of any range-table entry.
*
- * Consider the possibility that it's VALUE in a domain check
- * expression. (We handle VALUE as a name, not a keyword,
- * to avoid breaking a lot of applications that have used
- * VALUE as a column name in the past.)
+ * Consider the possibility that it's VALUE in a domain
+ * check expression. (We handle VALUE as a name, not a
+ * keyword, to avoid breaking a lot of applications that
+ * have used VALUE as a column name in the past.)
*/
if (pstate->p_value_substitute != NULL &&
strcmp(name, "value") == 0)
* Transform the list of arguments. We use a shallow list copy and then
* transform-in-place to avoid O(N^2) behavior from repeated lappend's.
*
- * XXX: repeated lappend() would no longer result in O(n^2) behavior; worth
- * reconsidering this design?
+ * XXX: repeated lappend() would no longer result in O(n^2) behavior;
+ * worth reconsidering this design?
*/
targs = list_copy(fn->args);
foreach(args, targs)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.182 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.183 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Extract arg type info in preparation for function lookup.
*
- * If any arguments are Param markers of type VOID, we discard them from the
- * parameter list. This is a hack to allow the JDBC driver to not have to
- * distinguish "input" and "output" parameter symbols while parsing
- * function-call constructs. We can't use foreach() because we may modify
- * the list ...
+ * If any arguments are Param markers of type VOID, we discard them from
+ * the parameter list. This is a hack to allow the JDBC driver to not
+ * have to distinguish "input" and "output" parameter symbols while
+ * parsing function-call constructs. We can't use foreach() because we
+ * may modify the list ...
*/
nargs = 0;
for (l = list_head(fargs); l != NULL; l = nextl)
/*
* Still too many candidates? Try assigning types for the unknown columns.
*
- * NOTE: for a binary operator with one unknown and one non-unknown input, we
- * already tried the heuristic of looking for a candidate with the known
- * input type on both sides (see binary_oper_exact()). That's essentially
- * a special case of the general algorithm we try next.
+ * NOTE: for a binary operator with one unknown and one non-unknown input,
+ * we already tried the heuristic of looking for a candidate with the
+ * known input type on both sides (see binary_oper_exact()). That's
+ * essentially a special case of the general algorithm we try next.
*
* We do this by examining each unknown argument position to see if we can
* determine a "type category" for it. If any candidate has an input
* If we are able to determine a type category, also notice whether any of
* the candidates takes a preferred datatype within the category.
*
- * Having completed this examination, remove candidates that accept the wrong
- * category at any unknown position. Also, if at least one candidate
- * accepted a preferred type at a position, remove candidates that accept
- * non-preferred types.
+ * Having completed this examination, remove candidates that accept the
+ * wrong category at any unknown position. Also, if at least one
+ * candidate accepted a preferred type at a position, remove candidates
+ * that accept non-preferred types.
*
* If we are down to one candidate at the end, we win.
*/
* as "text(name(varchar))" which the code below this point is
* entirely capable of selecting.
*
- * "Trivial" coercions are ones that involve binary-compatible types and
- * ones that are coercing a previously-unknown-type literal constant
- * to a specific type.
+ * "Trivial" coercions are ones that involve binary-compatible types
+ * and ones that are coercing a previously-unknown-type literal
+ * constant to a specific type.
*
* The reason we can restrict our check to binary-compatible coercions
* here is that we expect non-binary-compatible coercions to have an
* implementation function named after the target type. That function
* will be found by normal lookup if appropriate.
*
- * NB: it's important that this code stays in sync with what coerce_type
- * can do, because the caller will try to apply coerce_type if we
- * return FUNCDETAIL_COERCION. If we return that result for something
- * coerce_type can't handle, we'll cause infinite recursion between
- * this module and coerce_type!
+ * NB: it's important that this code stays in sync with what
+ * coerce_type can do, because the caller will try to apply
+ * coerce_type if we return FUNCDETAIL_COERCION. If we return that
+ * result for something coerce_type can't handle, we'll cause infinite
+ * recursion between this module and coerce_type!
*/
if (nargs == 1 && fargs != NIL)
{
/*
* Else do it the hard way with get_expr_result_type().
*
- * If it's a Var of type RECORD, we have to work even harder: we have to find
- * what the Var refers to, and pass that to get_expr_result_type. That
- * task is handled by expandRecordVariable().
+ * If it's a Var of type RECORD, we have to work even harder: we have to
+ * find what the Var refers to, and pass that to get_expr_result_type.
+ * That task is handled by expandRecordVariable().
*/
if (IsA(first_arg, Var) &&
((Var *) first_arg)->vartype == RECORDOID)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.82 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.83 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* First, quickly check to see if there is an exactly matching
* operator (there can be only one such entry in the list).
*
- * The returned list has args in the form (0, oprright). Move the useful
- * data into args[0] to keep oper_select_candidate simple. XXX we are
- * assuming here that we may scribble on the list!
+ * The returned list has args in the form (0, oprright). Move the
+ * useful data into args[0] to keep oper_select_candidate simple. XXX
+ * we are assuming here that we may scribble on the list!
*/
FuncCandidateList clisti;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.116 2005/10/26 19:21:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.117 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* will be empty strings that cannot match any legal SQL identifier, so we
* don't bother to test for that case here.
*
- * Should this somehow go wrong and we try to access a dropped column, we'll
- * still catch it by virtue of the checks in get_rte_attribute_type(),
- * which is called by make_var(). That routine has to do a cache lookup
- * anyway, so the check there is cheap.
+ * Should this somehow go wrong and we try to access a dropped column,
+ * we'll still catch it by virtue of the checks in
+ * get_rte_attribute_type(), which is called by make_var(). That routine
+ * has to do a cache lookup anyway, so the check there is cheap.
*/
foreach(c, rte->eref->colnames)
{
/*
* Note that we set inFromCl true, so that the RTE will be listed
- * explicitly if the parsetree is ever decompiled by ruleutils.c.
- * This provides a migration path for views/rules that were originally
- * written with implicit-RTE syntax.
+ * explicitly if the parsetree is ever decompiled by ruleutils.c. This
+ * provides a migration path for views/rules that were originally written
+ * with implicit-RTE syntax.
*/
rte = addRangeTableEntry(pstate, relation, NULL, false, true);
/* Add to joinlist and relnamespace, but not varnamespace */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.138 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.139 2005/11/22 18:17:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* lookup_rowtype_tupdesc(), which will almost certainly fail as well, but
* it will give an appropriate error message.
*
- * If it's a Var of type RECORD, we have to work even harder: we have to find
- * what the Var refers to, and pass that to get_expr_result_type. That
- * task is handled by expandRecordVariable().
+ * If it's a Var of type RECORD, we have to work even harder: we have to
+ * find what the Var refers to, and pass that to get_expr_result_type.
+ * That task is handled by expandRecordVariable().
*/
if (IsA(expr, Var) &&
((Var *) expr)->vartype == RECORDOID)
/* Main server loop */
for (;;)
{
- int32 opcode = 0;
+ int32 opcode = 0;
char datas[4000];
/*
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/posix_sema.c,v 1.14 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/posix_sema.c,v 1.15 2005/11/22 18:17:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* from the operation prematurely because we were sent a signal. So we
* try and lock the semaphore again.
*
- * Each time around the loop, we check for a cancel/die interrupt. We assume
- * that if such an interrupt comes in while we are waiting, it will cause
- * the sem_wait() call to exit with errno == EINTR, so that we will be
- * able to service the interrupt (if not in a critical section already).
+ * Each time around the loop, we check for a cancel/die interrupt. We
+ * assume that if such an interrupt comes in while we are waiting, it will
+ * cause the sem_wait() call to exit with errno == EINTR, so that we will
+ * be able to service the interrupt (if not in a critical section
+ * already).
*
* Once we acquire the lock, we do NOT check for an interrupt before
* returning. The caller needs to be able to record ownership of the lock
* before any interrupt can be accepted.
*
- * There is a window of a few instructions between CHECK_FOR_INTERRUPTS and
- * entering the sem_wait() call. If a cancel/die interrupt occurs in that
- * window, we would fail to notice it until after we acquire the lock (or
- * get another interrupt to escape the sem_wait()). We can avoid this
+ * There is a window of a few instructions between CHECK_FOR_INTERRUPTS
+ * and entering the sem_wait() call. If a cancel/die interrupt occurs in
+ * that window, we would fail to notice it until after we acquire the lock
+ * (or get another interrupt to escape the sem_wait()). We can avoid this
* problem by temporarily setting ImmediateInterruptOK to true before we
* do CHECK_FOR_INTERRUPTS; then, a die() interrupt in this interval will
* execute directly. However, there is a huge pitfall: there is another
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/sysv_sema.c,v 1.17 2005/10/15 02:49:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/sysv_sema.c,v 1.18 2005/11/22 18:17:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* from the operation prematurely because we were sent a signal. So we
* try and lock the semaphore again.
*
- * Each time around the loop, we check for a cancel/die interrupt. We assume
- * that if such an interrupt comes in while we are waiting, it will cause
- * the semop() call to exit with errno == EINTR, so that we will be able
- * to service the interrupt (if not in a critical section already).
+ * Each time around the loop, we check for a cancel/die interrupt. We
+ * assume that if such an interrupt comes in while we are waiting, it will
+ * cause the semop() call to exit with errno == EINTR, so that we will be
+ * able to service the interrupt (if not in a critical section already).
*
* Once we acquire the lock, we do NOT check for an interrupt before
* returning. The caller needs to be able to record ownership of the lock
* before any interrupt can be accepted.
*
- * There is a window of a few instructions between CHECK_FOR_INTERRUPTS and
- * entering the semop() call. If a cancel/die interrupt occurs in that
- * window, we would fail to notice it until after we acquire the lock (or
- * get another interrupt to escape the semop()). We can avoid this
+ * There is a window of a few instructions between CHECK_FOR_INTERRUPTS
+ * and entering the semop() call. If a cancel/die interrupt occurs in
+ * that window, we would fail to notice it until after we acquire the lock
+ * (or get another interrupt to escape the semop()). We can avoid this
* problem by temporarily setting ImmediateInterruptOK to true before we
* do CHECK_FOR_INTERRUPTS; then, a die() interrupt in this interval will
* execute directly. However, there is a huge pitfall: there is another
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.14 2005/10/25 15:15:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.15 2005/11/22 18:17:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* pg_signal_mask is only changed by main thread so shouldn't need it.
*/
volatile int pg_signal_queue;
-int pg_signal_mask;
+int pg_signal_mask;
-HANDLE pgwin32_signal_event;
-HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
+HANDLE pgwin32_signal_event;
+HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
/*
* pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only
* timer.c
* Microsoft Windows Win32 Timer Implementation
*
- * Limitations of this implementation:
+ * Limitations of this implementation:
*
- * - Does not support interval timer (value->it_interval)
- * - Only supports ITIMER_REAL
+ * - Does not support interval timer (value->it_interval)
+ * - Only supports ITIMER_REAL
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.6 2005/10/25 15:15:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.7 2005/11/22 18:17:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Communication area for inter-thread communication */
-typedef struct timerCA {
+typedef struct timerCA
+{
struct itimerval value;
- HANDLE event;
+ HANDLE event;
CRITICAL_SECTION crit_sec;
-} timerCA;
+} timerCA;
static timerCA timerCommArea;
static HANDLE timerThreadHandle = INVALID_HANDLE_VALUE;
static DWORD WINAPI
pg_timer_thread(LPVOID param)
{
- DWORD waittime;
+ DWORD waittime;
Assert(param == NULL);
for (;;)
{
- int r;
+ int r;
r = WaitForSingleObjectEx(timerCommArea.event, waittime, FALSE);
if (r == WAIT_OBJECT_0)
EnterCriticalSection(&timerCommArea.crit_sec);
if (timerCommArea.value.it_value.tv_sec == 0 &&
timerCommArea.value.it_value.tv_usec == 0)
- waittime = INFINITE; /* Cancel the interrupt */
+ waittime = INFINITE; /* Cancel the interrupt */
else
waittime = timerCommArea.value.it_value.tv_usec / 10 + timerCommArea.value.it_value.tv_sec * 1000;
ResetEvent(timerCommArea.event);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.5 2005/10/15 02:49:23 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.6 2005/11/22 18:17:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* backend, so we use the same signal handling. See equivalent code in
* tcop/postgres.c.
*
- * Currently, we don't pay attention to postgresql.conf changes that happen
- * during a single daemon iteration, so we can ignore SIGHUP.
+ * Currently, we don't pay attention to postgresql.conf changes that
+ * happen during a single daemon iteration, so we can ignore SIGHUP.
*/
pqsignal(SIGHUP, SIG_IGN);
* recently auto-vacuumed, or one that needs database-wide vacuum (to
* prevent Xid wraparound-related data loss).
*
- * Note that a database with no stats entry is not considered, except for Xid
- * wraparound purposes. The theory is that if no one has ever connected
- * to it since the stats were last initialized, it doesn't need vacuuming.
+ * Note that a database with no stats entry is not considered, except for
+ * Xid wraparound purposes. The theory is that if no one has ever
+ * connected to it since the stats were last initialized, it doesn't need
+ * vacuuming.
*
* XXX This could be improved if we had more info about whether it needs
* vacuuming before connecting to it. Perhaps look through the pgstats
* decide to start giving warnings. If any such db is found, we
* ignore all other dbs.
*
- * Unlike vacuum.c, we also look at vacuumxid. This is so that pg_clog
- * can be kept trimmed to a reasonable size.
+ * Unlike vacuum.c, we also look at vacuumxid. This is so that
+ * pg_clog can be kept trimmed to a reasonable size.
*/
freeze_age = (int32) (nextXid - tmp->frozenxid);
vacuum_age = (int32) (nextXid - tmp->vacuumxid);
/*
* Scan pg_class and determine which tables to vacuum.
*
- * The stats subsystem collects stats for toast tables independently of the
- * stats for their parent tables. We need to check those stats since in
- * cases with short, wide tables there might be proportionally much more
- * activity in the toast table than in its parent.
+ * The stats subsystem collects stats for toast tables independently of
+ * the stats for their parent tables. We need to check those stats since
+ * in cases with short, wide tables there might be proportionally much
+ * more activity in the toast table than in its parent.
*
* Since we can only issue VACUUM against the parent table, we need to
* transpose a decision to vacuum a toast table into a decision to vacuum
*
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.111 2005/10/17 16:24:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.112 2005/11/22 18:17:17 momjian Exp $
* ----------
*/
#include "postgres.h"
* On some platforms, pg_getaddrinfo_all() may return multiple addresses
* only one of which will actually work (eg, both IPv6 and IPv4 addresses
* when kernel will reject IPv6). Worse, the failure may occur at the
- * bind() or perhaps even connect() stage. So we must loop through the
+ * bind() or perhaps even connect() stage. So we must loop through the
* results till we find a working combination. We will generate LOG
* messages, but no error, for bogus combinations.
*/
* Start a buffering process to read from the socket, so we have a little
* more time to process incoming messages.
*
- * NOTE: the process structure is: postmaster is parent of buffer process is
- * parent of collector process. This way, the buffer can detect collector
- * failure via SIGCHLD, whereas otherwise it wouldn't notice collector
- * failure until it tried to write on the pipe. That would mean that
- * after the postmaster started a new collector, we'd have two buffer
+ * NOTE: the process structure is: postmaster is parent of buffer process
+ * is parent of collector process. This way, the buffer can detect
+ * collector failure via SIGCHLD, whereas otherwise it wouldn't notice
+ * collector failure until it tried to write on the pipe. That would mean
+ * that after the postmaster started a new collector, we'd have two buffer
* processes competing to read from the UDP socket --- not good.
*/
if (pgpipe(pgStatPipe) < 0)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.475 2005/11/05 03:04:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.476 2005/11/22 18:17:18 momjian Exp $
*
* NOTES
*
/*
* Fork away from controlling terminal, if -S specified.
*
- * Must do this before we grab any interlock files, else the interlocks will
- * show the wrong PID.
+ * Must do this before we grab any interlock files, else the interlocks
+ * will show the wrong PID.
*/
if (SilentMode)
pmdaemonize();
CreateDataDirLockFile(true);
/*
- * If timezone is not set, determine what the OS uses. (In theory this
+ * If timezone is not set, determine what the OS uses. (In theory this
* should be done during GUC initialization, but because it can take as
* much as several seconds, we delay it until after we've created the
* postmaster.pid file. This prevents problems with boot scripts that
SysLoggerPID = SysLogger_Start();
/*
- * Reset whereToSendOutput from DestDebug (its starting state) to DestNone.
- * This stops ereport from sending log messages to stderr unless
+ * Reset whereToSendOutput from DestDebug (its starting state) to
+ * DestNone. This stops ereport from sending log messages to stderr unless
* Log_destination permits. We don't do this until the postmaster is
* fully launched, since startup failures may as well be reported to
* stderr.
/*
* Check if the directory has group or world access. If so, reject.
*
- * It would be possible to allow weaker constraints (for example, allow group
- * access) but we cannot make a general assumption that that is okay; for
- * example there are platforms where nearly all users customarily belong
- * to the same group. Perhaps this test should be configurable.
+ * It would be possible to allow weaker constraints (for example, allow
+ * group access) but we cannot make a general assumption that that is
+ * okay; for example there are platforms where nearly all users
+ * customarily belong to the same group. Perhaps this test should be
+ * configurable.
*
- * XXX temporarily suppress check when on Windows, because there may not be
- * proper support for Unix-y file permissions. Need to think of a
+ * XXX temporarily suppress check when on Windows, because there may not
+ * be proper support for Unix-y file permissions. Need to think of a
* reasonable check to apply on Windows.
*/
#if !defined(WIN32) && !defined(__CYGWIN__)
/*
* Wait for something to happen.
*
- * We wait at most one minute, or the minimum autovacuum delay, to ensure
- * that the other background tasks handled below get done even when no
- * requests are arriving.
+ * We wait at most one minute, or the minimum autovacuum delay, to
+ * ensure that the other background tasks handled below get done even
+ * when no requests are arriving.
*/
memcpy((char *) &rmask, (char *) &readmask, sizeof(fd_set));
/*
* Fast Shutdown:
*
- * Abort all children with SIGTERM (rollback active transactions and
- * exit) and shut down when they are gone.
+ * Abort all children with SIGTERM (rollback active transactions
+ * and exit) and shut down when they are gone.
*/
if (Shutdown >= FastShutdown)
break;
/*
* No children left. Begin shutdown of data base system.
*
- * Note: if we previously got SIGTERM then we may send SIGUSR2 to the
- * bgwriter a second time here. This should be harmless.
+ * Note: if we previously got SIGTERM then we may send SIGUSR2 to
+ * the bgwriter a second time here. This should be harmless.
*/
if (StartupPID != 0 || FatalError)
break; /* let reaper() handle this */
* that it wrote a shutdown checkpoint. (If for some reason
* it didn't, recovery will occur on next postmaster start.)
*
- * Note: we do not wait around for exit of the archiver or stats
- * processes. They've been sent SIGQUIT by this point, and in
- * any case contain logic to commit hara-kiri if they notice
- * the postmaster is gone.
+ * Note: we do not wait around for exit of the archiver or
+ * stats processes. They've been sent SIGQUIT by this point,
+ * and in any case contain logic to commit hara-kiri if they
+ * notice the postmaster is gone.
*/
ExitPostmaster(0);
}
* This backend is still alive. Unless we did so already, tell it
* to commit hara-kiri.
*
- * SIGQUIT is the special signal that says exit without proc_exit and
- * let the user know what's going on. But if SendStop is set (-s
- * on command line), then we send SIGSTOP instead, so that we can
- * get core dumps from all backends by hand.
+ * SIGQUIT is the special signal that says exit without proc_exit
+ * and let the user know what's going on. But if SendStop is set
+ * (-s on command line), then we send SIGSTOP instead, so that we
+ * can get core dumps from all backends by hand.
*/
if (!FatalError)
{
* Must do this now because authentication uses libpq to send messages.
*/
pq_init(); /* initialize libpq to talk to client */
- whereToSendOutput = DestRemote; /* now safe to ereport to client */
+ whereToSendOutput = DestRemote; /* now safe to ereport to client */
/*
* We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT during
if (pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen,
remote_host, sizeof(remote_host),
remote_port, sizeof(remote_port),
- (log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV))
+ (log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV))
{
int ret = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen,
remote_host, sizeof(remote_host),
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.20 2005/10/15 02:49:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.21 2005/11/22 18:17:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* If first time through, create the pipe which will receive stderr
* output.
*
- * If the syslogger crashes and needs to be restarted, we continue to use the
- * same pipe (indeed must do so, since extant backends will be writing
+ * If the syslogger crashes and needs to be restarted, we continue to use
+ * the same pipe (indeed must do so, since extant backends will be writing
* into that pipe).
*
- * This means the postmaster must continue to hold the read end of the pipe
- * open, so we can pass it down to the reincarnated syslogger. This is a
- * bit klugy but we have little choice.
+ * This means the postmaster must continue to hold the read end of the
+ * pipe open, so we can pass it down to the reincarnated syslogger. This
+ * is a bit klugy but we have little choice.
*/
#ifndef WIN32
if (syslogPipe[0] < 0)
* permission to use and distribute the software in accordance with the
* terms specified in this license.
*
- * $PostgreSQL: pgsql/src/backend/regex/regc_locale.c,v 1.7 2005/10/15 02:49:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_locale.c,v 1.8 2005/11/22 18:17:19 momjian Exp $
*/
/* ASCII character-name table */
/*
* Now compute the character class contents.
*
- * For the moment, assume that only char codes < 256 can be in these classes.
+ * For the moment, assume that only char codes < 256 can be in these
+ * classes.
*/
switch ((enum classes) index)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.107 2005/10/18 01:06:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.108 2005/11/22 18:17:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* appropriate, also modify the 'relkind' field to show that the
* relation is now a view.
*
- * Important side effect: an SI notice is broadcast to force all backends
- * (including me!) to update relcache entries with the new rule.
+ * Important side effect: an SI notice is broadcast to force all
+ * backends (including me!) to update relcache entries with the new
+ * rule.
*/
SetRelationRuleStatus(ev_relid, true, RelisBecomingView);
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.158 2005/10/15 02:49:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.159 2005/11/22 18:17:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* release it until end of transaction. This protects the
* rewriter and planner against schema changes mid-query.
*
- * If the relation is the query's result relation, then we need
- * RowExclusiveLock. Otherwise, check to see if the relation
- * is accessed FOR UPDATE/SHARE or not. We can't just grab
- * AccessShareLock because then the executor would be trying
- * to upgrade the lock, leading to possible deadlocks.
+ * If the relation is the query's result relation, then we
+ * need RowExclusiveLock. Otherwise, check to see if the
+ * relation is accessed FOR UPDATE/SHARE or not. We can't
+ * just grab AccessShareLock because then the executor would
+ * be trying to upgrade the lock, leading to possible
+ * deadlocks.
*/
if (rt_index == parsetree->resultRelation)
lockmode = RowExclusiveLock;
* Adjust rule action and qual to offset its varnos, so that we can merge
* its rtable with the main parsetree's rtable.
*
- * If the rule action is an INSERT...SELECT, the OLD/NEW rtable entries will
- * be in the SELECT part, and we have to modify that rather than the
+ * If the rule action is an INSERT...SELECT, the OLD/NEW rtable entries
+ * will be in the SELECT part, and we have to modify that rather than the
* top-level INSERT (kluge!).
*/
sub_action = getInsertSelectQuery(rule_action, &sub_action_ptr);
* action. Some of the entries may be unused after we finish rewriting,
* but we leave them all in place for two reasons:
*
- * We'd have a much harder job to adjust the query's varnos if we selectively
- * removed RT entries.
+ * We'd have a much harder job to adjust the query's varnos if we
+ * selectively removed RT entries.
*
- * If the rule is INSTEAD, then the original query won't be executed at all,
- * and so its rtable must be preserved so that the executor will do the
- * correct permissions checks on it.
+ * If the rule is INSTEAD, then the original query won't be executed at
+ * all, and so its rtable must be preserved so that the executor will do
+ * the correct permissions checks on it.
*
* RT entries that are not referenced in the completed jointree will be
* ignored by the planner, so they do not affect query semantics. But any
* caller has, say, insert-permission on a view, when the view is not
* semantically referenced at all in the resulting query.
*
- * When a rule is not INSTEAD, the permissions checks done on its copied RT
- * entries will be redundant with those done during execution of the
+ * When a rule is not INSTEAD, the permissions checks done on its copied
+ * RT entries will be redundant with those done during execution of the
* original query, but we don't bother to treat that case differently.
*
- * NOTE: because planner will destructively alter rtable, we must ensure that
- * rule action's rtable is separate and shares no substructure with the
- * main rtable. Hence do a deep copy here.
+ * NOTE: because planner will destructively alter rtable, we must ensure
+ * that rule action's rtable is separate and shares no substructure with
+ * the main rtable. Hence do a deep copy here.
*/
sub_action->rtable = list_concat((List *) copyObject(parsetree->rtable),
sub_action->rtable);
* don't want the original rtindex to be joined twice, however, so avoid
* keeping it if the rule action mentions it.
*
- * As above, the action's jointree must not share substructure with the main
- * parsetree's.
+ * As above, the action's jointree must not share substructure with the
+ * main parsetree's.
*/
if (sub_action->commandType != CMD_UTILITY)
{
* Rewrite new.attribute w/ right hand side of target-list entry for
* appropriate field name in insert/update.
*
- * KLUGE ALERT: since ResolveNew returns a mutated copy, we can't just apply
- * it to sub_action; we have to remember to update the sublink inside
- * rule_action, too.
+ * KLUGE ALERT: since ResolveNew returns a mutated copy, we can't just
+ * apply it to sub_action; we have to remember to update the sublink
+ * inside rule_action, too.
*/
if ((event == CMD_INSERT || event == CMD_UPDATE) &&
sub_action->commandType != CMD_UTILITY)
* Copy all resjunk tlist entries to junk_tlist, and assign them
* resnos above the last real resno.
*
- * Typical junk entries include ORDER BY or GROUP BY expressions (are
- * these actually possible in an INSERT or UPDATE?), system
+ * Typical junk entries include ORDER BY or GROUP BY expressions
+ * (are these actually possible in an INSERT or UPDATE?), system
* attribute references, etc.
*/
/*
* Step 3
*
- * Determine which, if any, of the resulting queries is supposed to set the
- * command-result tag; and update the canSetTag fields accordingly.
+ * Determine which, if any, of the resulting queries is supposed to set
+ * the command-result tag; and update the canSetTag fields accordingly.
*
* If the original query is still in the list, it sets the command tag.
* Otherwise, the last INSTEAD query of the same kind as the original is
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.92 2005/10/15 02:49:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.93 2005/11/22 18:17:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* There's noplace to put the qual on a utility statement.
*
- * If it's a NOTIFY, silently ignore the qual; this means that the NOTIFY
- * will execute, whether or not there are any qualifying rows. While
- * clearly wrong, this is much more useful than refusing to execute
- * the rule at all, and extra NOTIFY events are harmless for typical
- * uses of NOTIFY.
+ * If it's a NOTIFY, silently ignore the qual; this means that the
+ * NOTIFY will execute, whether or not there are any qualifying rows.
+ * While clearly wrong, this is much more useful than refusing to
+ * execute the rule at all, and extra NOTIFY events are harmless for
+ * typical uses of NOTIFY.
*
* If it isn't a NOTIFY, error out, since unconditional execution of
* other utility stmts is unlikely to be wanted. (This case is not
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.199 2005/11/17 17:42:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.200 2005/11/22 18:17:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static bool PinBuffer(volatile BufferDesc *buf);
static void PinBuffer_Locked(volatile BufferDesc *buf);
static void UnpinBuffer(volatile BufferDesc *buf,
- bool fixOwner, bool normalAccess);
+ bool fixOwner, bool normalAccess);
static bool SyncOneBuffer(int buf_id, bool skip_pinned);
static void WaitIO(volatile BufferDesc *buf);
static bool StartBufferIO(volatile BufferDesc *buf, bool forInput);
* page but its contents are not yet valid. IO_IN_PROGRESS is set for it,
* if it's a shared buffer.
*
- * Note: if smgrextend fails, we will end up with a buffer that is allocated
- * but not marked BM_VALID. P_NEW will still select the same block number
- * (because the relation didn't get any longer on disk) and so future
- * attempts to extend the relation will find the same buffer (if it's not
- * been recycled) but come right back here to try smgrextend again.
+ * Note: if smgrextend fails, we will end up with a buffer that is
+ * allocated but not marked BM_VALID. P_NEW will still select the same
+ * block number (because the relation didn't get any longer on disk) and
+ * so future attempts to extend the relation will find the same buffer (if
+ * it's not been recycled) but come right back here to try smgrextend
+ * again.
*/
Assert(!(bufHdr->flags & BM_VALID)); /* spinlock not needed */
/*
* Check whether buffer needs writing.
*
- * We can make this check without taking the buffer content lock so long as
- * we mark pages dirty in access methods *before* logging changes with
+ * We can make this check without taking the buffer content lock so long
+ * as we mark pages dirty in access methods *before* logging changes with
* XLogInsert(): if someone marks the buffer dirty just after our check we
* don't worry because our checkpoint.redo points before log record for
* upcoming changes and so we are not required to write such dirty buffer.
/*
* Changed to wait until there's no IO - Inoue 01/13/2000
*
- * Note this is *necessary* because an error abort in the process doing I/O
- * could release the io_in_progress_lock prematurely. See AbortBufferIO.
+ * Note this is *necessary* because an error abort in the process doing
+ * I/O could release the io_in_progress_lock prematurely. See
+ * AbortBufferIO.
*/
for (;;)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.71 2005/11/17 17:42:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.72 2005/11/22 18:17:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
hresult = (LocalBufferLookupEnt *)
hash_search(LocalBufHash, (void *) &bufHdr->tag,
HASH_REMOVE, NULL);
- if (!hresult) /* shouldn't happen */
+ if (!hresult) /* shouldn't happen */
elog(ERROR, "local buffer hash table corrupted");
/* Mark buffer invalid */
CLEAR_BUFFERTAG(bufHdr->tag);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.121 2005/10/15 02:49:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.122 2005/11/22 18:17:20 momjian Exp $
*
* NOTES:
*
* We might need to create the pg_tempfiles subdirectory, if no one
* has yet done so.
*
- * Don't check for error from mkdir; it could fail if someone else just
- * did the same thing. If it doesn't work then we'll bomb out on the
- * second create attempt, instead.
+ * Don't check for error from mkdir; it could fail if someone else
+ * just did the same thing. If it doesn't work then we'll bomb out on
+ * the second create attempt, instead.
*/
dirpath = make_database_relative(PG_TEMP_FILES_DIR);
mkdir(dirpath, S_IRWXU);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.91 2005/10/15 02:49:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.92 2005/11/22 18:17:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* call all the callbacks registered before calling exit().
*
- * Note that since we decrement on_proc_exit_index each time, if a callback
- * calls ereport(ERROR) or ereport(FATAL) then it won't be invoked again
- * when control comes back here (nor will the previously-completed
- * callbacks). So, an infinite loop should not be possible.
+ * Note that since we decrement on_proc_exit_index each time, if a
+ * callback calls ereport(ERROR) or ereport(FATAL) then it won't be
+ * invoked again when control comes back here (nor will the
+ * previously-completed callbacks). So, an infinite loop should not be
+ * possible.
*/
while (--on_proc_exit_index >= 0)
(*on_proc_exit_list[on_proc_exit_index].function) (code,
/*
* call all the registered callbacks.
*
- * As with proc_exit(), we remove each callback from the list before calling
- * it, to avoid infinite loop in case of error.
+ * As with proc_exit(), we remove each callback from the list before
+ * calling it, to avoid infinite loop in case of error.
*/
while (--on_shmem_exit_index >= 0)
(*on_shmem_exit_list[on_shmem_exit_index].function) (code,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.7 2005/10/15 02:49:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.8 2005/11/22 18:17:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Step 3: have to check pg_subtrans.
*
- * At this point, we know it's either a subtransaction of one of the Xids in
- * xids[], or it's not running. If it's an already-failed subtransaction,
- * we want to say "not running" even though its parent may still be
- * running. So first, check pg_clog to see if it's been aborted.
+ * At this point, we know it's either a subtransaction of one of the Xids
+ * in xids[], or it's not running. If it's an already-failed
+ * subtransaction, we want to say "not running" even though its parent may
+ * still be running. So first, check pg_clog to see if it's been aborted.
*/
xc_slow_answer_inc();
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.87 2005/10/15 02:49:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.88 2005/11/22 18:17:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* If the shmem index doesn't exist, we are bootstrapping: we must
* be trying to init the shmem index itself.
*
- * Notice that the ShmemIndexLock is held until the shmem index has
- * been completely initialized.
+ * Notice that the ShmemIndexLock is held until the shmem index
+ * has been completely initialized.
*/
*foundPtr = FALSE;
ShmemIndexAlloc = ShmemAlloc(size);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.78 2005/10/15 02:49:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.79 2005/11/22 18:17:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* steps. (A very small time window, perhaps, but Murphy's Law says you
* can hit it...) Instead, we first set the enable flag, then test the
* occurred flag. If we see an unserviced interrupt has occurred, we
- * re-clear the enable flag before going off to do the service work.
- * (That prevents re-entrant invocation of ProcessCatchupEvent() if
- * another interrupt occurs.) If an interrupt comes in between the setting
- * and clearing of catchupInterruptEnabled, then it will have done the
- * service work and left catchupInterruptOccurred zero, so we have to
- * check again after clearing enable. The whole thing has to be in a loop
- * in case another interrupt occurs while we're servicing the first. Once
- * we get out of the loop, enable is set and we know there is no
- * unserviced interrupt.
+ * re-clear the enable flag before going off to do the service work. (That
+ * prevents re-entrant invocation of ProcessCatchupEvent() if another
+ * interrupt occurs.) If an interrupt comes in between the setting and
+ * clearing of catchupInterruptEnabled, then it will have done the service
+ * work and left catchupInterruptOccurred zero, so we have to check again
+ * after clearing enable. The whole thing has to be in a loop in case
+ * another interrupt occurs while we're servicing the first. Once we get
+ * out of the loop, enable is set and we know there is no unserviced
+ * interrupt.
*
- * NB: an overenthusiastic optimizing compiler could easily break this code.
- * Hopefully, they all understand what "volatile" means these days.
+ * NB: an overenthusiastic optimizing compiler could easily break this
+ * code. Hopefully, they all understand what "volatile" means these days.
*/
for (;;)
{
* start and immediately end a transaction; the call to
* AcceptInvalidationMessages() happens down inside transaction start.
*
- * It is awfully tempting to just call AcceptInvalidationMessages() without
- * the rest of the xact start/stop overhead, and I think that would
- * actually work in the normal case; but I am not sure that things would
- * clean up nicely if we got an error partway through.
+ * It is awfully tempting to just call AcceptInvalidationMessages()
+ * without the rest of the xact start/stop overhead, and I think that
+ * would actually work in the normal case; but I am not sure that things
+ * would clean up nicely if we got an error partway through.
*/
if (IsTransactionOrTransactionBlock())
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.159 2005/11/05 03:04:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.160 2005/11/22 18:17:21 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
* allocate a non-shared hash table for LOCALLOCK structs. This is used
* to store lock counts and resource owner information.
*
- * The non-shared table could already exist in this process (this occurs when
- * the postmaster is recreating shared memory after a backend crash). If
- * so, delete and recreate it. (We could simply leave it, since it ought
- * to be empty in the postmaster, but for safety let's zap it.)
+ * The non-shared table could already exist in this process (this occurs
+ * when the postmaster is recreating shared memory after a backend crash).
+ * If so, delete and recreate it. (We could simply leave it, since it
+ * ought to be empty in the postmaster, but for safety let's zap it.)
*/
if (LockMethodLocalHash[lockmethodid])
hash_destroy(LockMethodLocalHash[lockmethodid]);
/*
* Find or create a lock with this tag.
*
- * Note: if the locallock object already existed, it might have a pointer to
- * the lock already ... but we probably should not assume that that
+ * Note: if the locallock object already existed, it might have a pointer
+ * to the lock already ... but we probably should not assume that that
* pointer is valid, since a lock object with no locks can go away
* anytime.
*/
* first check for global conflicts: If no locks conflict with my request,
* then I get the lock.
*
- * Checking for conflict: lock->grantMask represents the types of currently
- * held locks. conflictTable[lockmode] has a bit set for each type of
- * lock that conflicts with request. Bitwise compare tells if there is a
- * conflict.
+ * Checking for conflict: lock->grantMask represents the types of
+ * currently held locks. conflictTable[lockmode] has a bit set for each
+ * type of lock that conflicts with request. Bitwise compare tells if
+ * there is a conflict.
*/
if (!(lockMethodTable->conflictTab[lockmode] & lock->grantMask))
{
* Note we count only one pair of hash tables, since the userlocks table
* actually overlays the main one.
*
- * Since the lockHash entry count above is only an estimate, add 10% safety
- * margin.
+ * Since the lockHash entry count above is only an estimate, add 10%
+ * safety margin.
*/
size = add_size(size, size / 10);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.167 2005/10/15 02:49:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.168 2005/11/22 18:17:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Determine where to add myself in the wait queue.
*
- * Normally I should go at the end of the queue. However, if I already hold
- * locks that conflict with the request of any previous waiter, put myself
- * in the queue just in front of the first such waiter. This is not a
- * necessary step, since deadlock detection would move me to before that
+ * Normally I should go at the end of the queue. However, if I already
+ * hold locks that conflict with the request of any previous waiter, put
+ * myself in the queue just in front of the first such waiter. This is not
+ * a necessary step, since deadlock detection would move me to before that
* waiter anyway; but it's relatively cheap to detect such a conflict
* immediately, and avoid delaying till deadlock timeout.
*
- * Special case: if I find I should go in front of some waiter, check to see
- * if I conflict with already-held locks or the requests before that
+ * Special case: if I find I should go in front of some waiter, check to
+ * see if I conflict with already-held locks or the requests before that
* waiter. If not, then just grant myself the requested lock immediately.
* This is the same as the test for immediate grant in LockAcquire, except
* we are only considering the part of the wait queue before my insertion
* sets MyProc->waitStatus = STATUS_ERROR, allowing us to know that we
* must report failure rather than success.
*
- * By delaying the check until we've waited for a bit, we can avoid running
- * the rather expensive deadlock-check code in most cases.
+ * By delaying the check until we've waited for a bit, we can avoid
+ * running the rather expensive deadlock-check code in most cases.
*/
if (!enable_sig_alarm(DeadlockTimeout, false))
elog(FATAL, "could not set timer for process wakeup");
* not detect a deadlock, PGSemaphoreLock() will continue to wait. There
* used to be a loop here, but it was useless code...
*
- * We pass interruptOK = true, which eliminates a window in which cancel/die
- * interrupts would be held off undesirably. This is a promise that we
- * don't mind losing control to a cancel/die interrupt here. We don't,
- * because we have no shared-state-change work to do after being granted
- * the lock (the grantor did it all). We do have to worry about updating
- * the locallock table, but if we lose control to an error, LockWaitCancel
- * will fix that up.
+ * We pass interruptOK = true, which eliminates a window in which
+ * cancel/die interrupts would be held off undesirably. This is a promise
+ * that we don't mind losing control to a cancel/die interrupt here. We
+ * don't, because we have no shared-state-change work to do after being
+ * granted the lock (the grantor did it all). We do have to worry about
+ * updating the locallock table, but if we lose control to an error,
+ * LockWaitCancel will fix that up.
*/
PGSemaphoreLock(&MyProc->sem, true);
/*
* Check to see if we've been awoken by anyone in the interim.
*
- * If we have we can return and resume our transaction -- happy day. Before
- * we are awoken the process releasing the lock grants it to us so we know
- * that we don't have to wait anymore.
+ * If we have we can return and resume our transaction -- happy day.
+ * Before we are awoken the process releasing the lock grants it to us so
+ * we know that we don't have to wait anymore.
*
* We check by looking to see if we've been unlinked from the wait queue.
* This is quicker than checking our semaphore's state, since no kernel
/*
* Begin deadlock timeout with statement-level timeout active
*
- * Here, we want to interrupt at the closer of the two timeout times. If
- * fin_time >= statement_fin_time then we need not touch the existing
- * timer setting; else set up to interrupt at the deadlock timeout
- * time.
+ * Here, we want to interrupt at the closer of the two timeout times.
+ * If fin_time >= statement_fin_time then we need not touch the
+ * existing timer setting; else set up to interrupt at the deadlock
+ * timeout time.
*
* NOTE: in this case it is possible that this routine will be
* interrupted by the previously-set timer alarm. This is okay
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.40 2005/10/15 02:49:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.41 2005/11/22 18:17:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* longer than to call the kernel, so we try to adapt the spin loop count
* depending on whether we seem to be in a uniprocessor or multiprocessor.
*
- * Note: you might think MIN_SPINS_PER_DELAY should be just 1, but you'd be
- * wrong; there are platforms where that can result in a "stuck spinlock"
- * failure. This has been seen particularly on Alphas; it seems that the
- * first TAS after returning from kernel space will always fail on that
- * hardware.
+ * Note: you might think MIN_SPINS_PER_DELAY should be just 1, but you'd
+ * be wrong; there are platforms where that can result in a "stuck
+ * spinlock" failure. This has been seen particularly on Alphas; it seems
+ * that the first TAS after returning from kernel space will always fail
+ * on that hardware.
*
- * Once we do decide to block, we use randomly increasing pg_usleep() delays.
- * The first delay is 1 msec, then the delay randomly increases to about
- * one second, after which we reset to 1 msec and start again. The idea
- * here is that in the presence of heavy contention we need to increase
- * the delay, else the spinlock holder may never get to run and release
- * the lock. (Consider situation where spinlock holder has been nice'd
- * down in priority by the scheduler --- it will not get scheduled until
- * all would-be acquirers are sleeping, so if we always use a 1-msec
+ * Once we do decide to block, we use randomly increasing pg_usleep()
+ * delays. The first delay is 1 msec, then the delay randomly increases to
+ * about one second, after which we reset to 1 msec and start again. The
+ * idea here is that in the presence of heavy contention we need to
+ * increase the delay, else the spinlock holder may never get to run and
+ * release the lock. (Consider situation where spinlock holder has been
+ * nice'd down in priority by the scheduler --- it will not get scheduled
+ * until all would-be acquirers are sleeping, so if we always use a 1-msec
* sleep, there is a real possibility of starvation.) But we can't just
* clamp the delay to an upper bound, else it would take a long time to
* make a reasonable number of tries.
*
- * We time out and declare error after NUM_DELAYS delays (thus, exactly that
- * many tries). With the given settings, this will usually take 2 or so
- * minutes. It seems better to fix the total number of tries (and thus
+ * We time out and declare error after NUM_DELAYS delays (thus, exactly
+ * that many tries). With the given settings, this will usually take 2 or
+ * so minutes. It seems better to fix the total number of tries (and thus
* the probability of unintended failure) than to fix the total time
* spent.
*
);
}
#endif /* __m68k__ && !__linux__ */
-
#else /* not __GNUC__ */
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/spin.c,v 1.17 2005/10/15 02:49:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/spin.c,v 1.18 2005/11/22 18:17:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* It would be cleaner to distribute this logic into the affected modules,
* similar to the way shmem space estimation is handled.
*
- * For now, though, we just need a few spinlocks (10 should be plenty) plus
- * one for each LWLock.
+ * For now, though, we just need a few spinlocks (10 should be plenty)
+ * plus one for each LWLock.
*/
return NumLWLocks() + 10;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.67 2005/10/15 02:49:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.68 2005/11/22 18:17:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Compute new lower and upper pointers for page, see if it'll fit.
*
- * Note: do arithmetic as signed ints, to avoid mistakes if, say, alignedSize
- * > pd_upper.
+ * Note: do arithmetic as signed ints, to avoid mistakes if, say,
+ * alignedSize > pd_upper.
*/
if (offsetNumber == limit || needshuffle)
lower = phdr->pd_lower + sizeof(ItemIdData);
/*
* Finally, we need to adjust the linp entries that remain.
*
- * Anything that used to be before the deleted tuple's data was moved forward
- * by the size of the deleted tuple.
+ * Anything that used to be before the deleted tuple's data was moved
+ * forward by the size of the deleted tuple.
*/
if (!PageIsEmpty(page))
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.93 2005/10/15 02:49:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.94 2005/11/22 18:17:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* We may be using the target table space for the first time in this
* database, so create a per-database subdirectory if needed.
*
- * XXX this is a fairly ugly violation of module layering, but this seems to
- * be the best place to put the check. Maybe TablespaceCreateDbspace
+ * XXX this is a fairly ugly violation of module layering, but this seems
+ * to be the best place to put the check. Maybe TablespaceCreateDbspace
* should be here and not in commands/tablespace.c? But that would imply
* importing a lot of stuff that smgr.c oughtn't know, either.
*/
/*
* And delete the physical files.
*
- * Note: we treat deletion failure as a WARNING, not an error, because we've
- * already decided to commit or abort the current xact.
+ * Note: we treat deletion failure as a WARNING, not an error, because
+ * we've already decided to commit or abort the current xact.
*/
if (!(*(smgrsw[which].smgr_unlink)) (rnode, isRedo))
ereport(WARNING,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.83 2005/10/15 02:49:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.84 2005/11/22 18:17:21 momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
* Copy supplied arguments into arg vector. In protocol 2.0 these are
* always assumed to be supplied in binary format.
*
- * Note: although the original protocol 2.0 code did not have any way for the
- * frontend to specify a NULL argument, we now choose to interpret length
- * == -1 as meaning a NULL.
+ * Note: although the original protocol 2.0 code did not have any way for
+ * the frontend to specify a NULL argument, we now choose to interpret
+ * length == -1 as meaning a NULL.
*/
for (i = 0; i < nargs; ++i)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.469 2005/11/10 00:31:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.470 2005/11/22 18:17:21 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
* sync, better to say "command unknown" than to run out of memory because
* we used garbage as a length word.
*
- * This also gives us a place to set the doing_extended_query_message flag as
- * soon as possible.
+ * This also gives us a place to set the doing_extended_query_message flag
+ * as soon as possible.
*/
switch (qtype)
{
/*
* If we are in aborted transaction state, the only portals we can
- * actually run are those containing COMMIT or ROLLBACK commands.
- * We disallow binding anything else to avoid problems with infrastructure
- * that expects to run inside a valid transaction. We also disallow
- * binding any parameters, since we can't risk calling user-defined
- * I/O functions.
+ * actually run are those containing COMMIT or ROLLBACK commands. We
+ * disallow binding anything else to avoid problems with infrastructure
+ * that expects to run inside a valid transaction. We also disallow
+ * binding any parameters, since we can't risk calling user-defined I/O
+ * functions.
*/
if (IsAbortedTransactionBlockState() &&
(!IsTransactionExitStmtList(pstmt->query_list) ||
/*
* Rather than copying data around, we just set up a phony
- * StringInfo pointing to the correct portion of the
- * message buffer. We assume we can scribble on the
- * message buffer so as to maintain the convention that
- * StringInfos have a trailing null. This is grotty but
- * is a big win when dealing with very large parameter
- * strings.
+ * StringInfo pointing to the correct portion of the message
+ * buffer. We assume we can scribble on the message buffer so
+ * as to maintain the convention that StringInfos have a
+ * trailing null. This is grotty but is a big win when
+ * dealing with very large parameter strings.
*/
pbuf.data = (char *) pvalue;
pbuf.maxlen = plength + 1;
getTypeInputInfo(ptype, &typinput, &typioparam);
/*
- * We have to do encoding conversion before calling
- * the typinput routine.
+ * We have to do encoding conversion before calling the
+ * typinput routine.
*/
pstring = pg_client_to_server(pbuf.data, plength);
params[i].value =
/* Trouble if it didn't eat the whole buffer */
if (pbuf.cursor != pbuf.len)
ereport(ERROR,
- (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
- errmsg("incorrect binary data format in bind parameter %d",
- i + 1)));
+ (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
+ errmsg("incorrect binary data format in bind parameter %d",
+ i + 1)));
}
else
{
/*
* Trouble?
*
- * The test on stack_base_ptr prevents us from erroring out if called during
- * process setup or in a non-backend process. Logically it should be done
- * first, but putting it here avoids wasting cycles during normal cases.
+ * The test on stack_base_ptr prevents us from erroring out if called
+ * during process setup or in a non-backend process. Logically it should
+ * be done first, but putting it here avoids wasting cycles during normal
+ * cases.
*/
if (stack_depth > max_stack_depth_bytes &&
stack_base_ptr != NULL)
/*
* ignore system indexes
*
- * As of PG 7.4 this is safe to allow from the client, since it
- * only disables reading the system indexes, not writing them.
- * Worst case consequence is slowness.
+ * As of PG 7.4 this is safe to allow from the client, since
+ * it only disables reading the system indexes, not writing
+ * them. Worst case consequence is slowness.
*/
IgnoreSystemIndexes(true);
break;
/*
* s - report usage statistics (timings) after each query
*
- * Since log options are SUSET, we need to postpone unless still
- * in secure context
+ * Since log options are SUSET, we need to postpone unless
+ * still in secure context
*/
if (ctx == PGC_BACKEND)
PendingConfigOption("log_statement_stats", "true");
/*
* Set up signal handlers and masks.
*
- * Note that postmaster blocked all signals before forking child process, so
- * there is no race condition whereby we might receive a signal before we
- * have set up the handler.
+ * Note that postmaster blocked all signals before forking child process,
+ * so there is no race condition whereby we might receive a signal before
+ * we have set up the handler.
*
* Also note: it's best not to use any signals that are SIG_IGNored in the
* postmaster. If such a signal arrives before we are able to change the
/*
* General initialization.
*
- * NOTE: if you are tempted to add code in this vicinity, consider putting it
- * inside InitPostgres() instead. In particular, anything that involves
- * database access should be there, not here.
+ * NOTE: if you are tempted to add code in this vicinity, consider putting
+ * it inside InitPostgres() instead. In particular, anything that
+ * involves database access should be there, not here.
*/
ereport(DEBUG3,
(errmsg_internal("InitPostgres")));
* If an exception is encountered, processing resumes here so we abort the
* current transaction and start a new one.
*
- * You might wonder why this isn't coded as an infinite loop around a PG_TRY
- * construct. The reason is that this is the bottom of the exception
- * stack, and so with PG_TRY there would be no exception handler in force
- * at all during the CATCH part. By leaving the outermost setjmp always
- * active, we have at least some chance of recovering from an error during
- * error recovery. (If we get into an infinite loop thereby, it will soon
- * be stopped by overflow of elog.c's internal state stack.)
+ * You might wonder why this isn't coded as an infinite loop around a
+ * PG_TRY construct. The reason is that this is the bottom of the
+ * exception stack, and so with PG_TRY there would be no exception handler
+ * in force at all during the CATCH part. By leaving the outermost setjmp
+ * always active, we have at least some chance of recovering from an error
+ * during error recovery. (If we get into an infinite loop thereby, it
+ * will soon be stopped by overflow of elog.c's internal state stack.)
*/
if (sigsetjmp(local_sigjmp_buf, 1) != 0)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.97 2005/11/03 21:35:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.98 2005/11/22 18:17:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Force the queryDesc destination to the right thing. This supports
- * MOVE, for example, which will pass in dest = DestNone. This is okay
- * to change as long as we do it on every fetch. (The Executor must not
+ * MOVE, for example, which will pass in dest = DestNone. This is okay to
+ * change as long as we do it on every fetch. (The Executor must not
* assume that dest never changes.)
*/
if (queryDesc)
* say, it has to update an index with expressions that invoke
* user-defined functions, then it had better have a snapshot.
*
- * Note we assume that caller will take care of restoring ActiveSnapshot on
- * exit/error.
+ * Note we assume that caller will take care of restoring ActiveSnapshot
+ * on exit/error.
*/
if (!(IsA(utilityStmt, TransactionStmt) ||
IsA(utilityStmt, LockStmt) ||
ListCell *planlist_item;
/*
- * If the destination is DestRemoteExecute, change to DestNone. The reason
- * is that the client won't be expecting any tuples, and indeed has no way
- * to know what they are, since there is no provision for Describe to send
- * a RowDescription message when this portal execution strategy is in
- * effect. This presently will only affect SELECT commands added to
+ * If the destination is DestRemoteExecute, change to DestNone. The
+ * reason is that the client won't be expecting any tuples, and indeed has
+ * no way to know what they are, since there is no provision for Describe
+ * to send a RowDescription message when this portal execution strategy is
+ * in effect. This presently will only affect SELECT commands added to
* non-SELECT queries by rewrite rules: such commands will be executed,
* but the results will be discarded unless you use "simple Query"
* protocol.
* If a command completion tag was supplied, use it. Otherwise use the
* portal's commandTag as the default completion tag.
*
- * Exception: clients will expect INSERT/UPDATE/DELETE tags to have counts,
- * so fake something up if necessary. (This could happen if the original
- * query was replaced by a DO INSTEAD rule.)
+ * Exception: clients will expect INSERT/UPDATE/DELETE tags to have
+ * counts, so fake something up if necessary. (This could happen if the
+ * original query was replaced by a DO INSTEAD rule.)
*/
if (completionTag && completionTag[0] == '\0')
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.248 2005/11/22 15:24:18 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.249 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
if (rentry->kind == rightkind)
{
- if (! missing_ok)
+ if (!missing_ok)
{
ereport(ERROR,
(errcode(rentry->nonexistent_code),
}
}
- Assert(rentry->kind != '\0'); /* Should be impossible */
+ Assert(rentry->kind != '\0'); /* Should be impossible */
}
/*
case OBJECT_TYPE:
/* RemoveType does its own permissions checks */
- RemoveType(names, stmt->behavior,
+ RemoveType(names, stmt->behavior,
stmt->missing_ok);
break;
/*
* RemoveDomain does its own permissions checks
*/
- RemoveDomain(names, stmt->behavior,
+ RemoveDomain(names, stmt->behavior,
stmt->missing_ok);
break;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.125 2005/11/19 19:44:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.126 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* GUC parameter
*/
-bool Array_nulls = true;
+bool Array_nulls = true;
/*
* Local definitions
Datum *values, bool *nulls,
bool *hasnulls, int32 *nbytes);
static void CopyArrayEls(ArrayType *array,
- Datum *values, bool *nulls, int nitems,
- int typlen, bool typbyval, char typalign,
- bool freedata);
+ Datum *values, bool *nulls, int nitems,
+ int typlen, bool typbyval, char typalign,
+ bool freedata);
static bool array_get_isnull(const bits8 *nullbitmap, int offset);
static void array_set_isnull(bits8 *nullbitmap, int offset, bool isNull);
static Datum ArrayCast(char *value, bool byval, int len);
int typlen, bool typbyval, char typalign,
char *dest);
static char *array_seek(char *ptr, int offset, bits8 *nullbitmap, int nitems,
- int typlen, bool typbyval, char typalign);
-static int array_nelems_size(char *ptr, int offset, bits8 *nullbitmap,
- int nitems, int typlen, bool typbyval, char typalign);
-static int array_copy(char *destptr, int nitems,
- char *srcptr, int offset, bits8 *nullbitmap,
- int typlen, bool typbyval, char typalign);
+ int typlen, bool typbyval, char typalign);
+static int array_nelems_size(char *ptr, int offset, bits8 *nullbitmap,
+ int nitems, int typlen, bool typbyval, char typalign);
+static int array_copy(char *destptr, int nitems,
+ char *srcptr, int offset, bits8 *nullbitmap,
+ int typlen, bool typbyval, char typalign);
static int array_slice_size(char *arraydataptr, bits8 *arraynullsptr,
- int ndim, int *dim, int *lb,
- int *st, int *endp,
- int typlen, bool typbyval, char typalign);
+ int ndim, int *dim, int *lb,
+ int *st, int *endp,
+ int typlen, bool typbyval, char typalign);
static void array_extract_slice(ArrayType *newarray,
- int ndim, int *dim, int *lb,
- char *arraydataptr, bits8 *arraynullsptr,
- int *st, int *endp,
- int typlen, bool typbyval, char typalign);
+ int ndim, int *dim, int *lb,
+ char *arraydataptr, bits8 *arraynullsptr,
+ int *st, int *endp,
+ int typlen, bool typbyval, char typalign);
static void array_insert_slice(ArrayType *destArray, ArrayType *origArray,
- ArrayType *srcArray,
- int ndim, int *dim, int *lb,
- int *st, int *endp,
- int typlen, bool typbyval, char typalign);
+ ArrayType *srcArray,
+ int ndim, int *dim, int *lb,
+ int *st, int *endp,
+ int typlen, bool typbyval, char typalign);
static int array_cmp(FunctionCallInfo fcinfo);
static Datum array_type_length_coerce_internal(ArrayType *src,
int32 desttypmod,
* Otherwise, we require the input to be in curly-brace style, and we
* prescan the input to determine dimensions.
*
- * Dimension info takes the form of one or more [n] or [m:n] items.
- * The outer loop iterates once per dimension item.
+ * Dimension info takes the form of one or more [n] or [m:n] items. The
+ * outer loop iterates once per dimension item.
*/
p = string_save;
ndim = 0;
* in-place within arrayStr to do this. srcptr is the current scan point,
* and dstptr is where we are copying to.
*
- * We also want to suppress leading and trailing unquoted whitespace.
- * We use the leadingspace flag to suppress leading space. Trailing space
- * is tracked by using dstendptr to point to the last significant output
+ * We also want to suppress leading and trailing unquoted whitespace. We
+ * use the leadingspace flag to suppress leading space. Trailing space is
+ * tracked by using dstendptr to point to the last significant output
* character.
*
* The error checking in this routine is mostly pro-forma, since we expect
/* Treat the escaped character as non-whitespace */
leadingspace = false;
dstendptr = dstptr;
- hasquoting = true; /* can't be a NULL marker */
+ hasquoting = true; /* can't be a NULL marker */
break;
case '\"':
in_quotes = !in_quotes;
*/
dstendptr = dstptr;
}
- hasquoting = true; /* can't be a NULL marker */
+ hasquoting = true; /* can't be a NULL marker */
srcptr++;
break;
case '{':
errmsg("malformed array literal: \"%s\"",
origStr)));
- if (Array_nulls && !hasquoting &&
+ if (Array_nulls && !hasquoting &&
pg_strcasecmp(itemstart, "NULL") == 0)
{
/* it's a NULL item */
{
if (nulls && nulls[i])
{
- if (!bitmap) /* shouldn't happen */
+ if (!bitmap) /* shouldn't happen */
elog(ERROR, "null array element where not supported");
/* bitmap bit stays 0 */
}
*retval,
**values,
dims_str[(MAXDIM * 33) + 2];
+
/*
* 33 per dim since we assume 15 digits per number + ':' +'[]'
*
/* count data plus backslashes; detect chars needing quotes */
if (values[i][0] == '\0')
- needquote = true; /* force quotes for empty string */
+ needquote = true; /* force quotes for empty string */
else if (pg_strcasecmp(values[i], "NULL") == 0)
- needquote = true; /* force quotes for literal NULL */
+ needquote = true; /* force quotes for literal NULL */
else
needquote = false;
/*
* Fill in nulls bitmap if needed
*
- * Note: it's possible we just replaced the last NULL with a non-NULL,
- * and could get rid of the bitmap. Seems not worth testing for though.
+ * Note: it's possible we just replaced the last NULL with a non-NULL, and
+ * could get rid of the bitmap. Seems not worth testing for though.
*/
if (newhasnulls)
{
- bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
+ bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
array_set_isnull(newnullbitmap, offset, isNull);
if (extendbefore)
oldnullbitmap, 0,
offset);
if (!extendafter)
- array_bitmap_copy(newnullbitmap, offset+1,
- oldnullbitmap, offset+1,
+ array_bitmap_copy(newnullbitmap, offset + 1,
+ oldnullbitmap, offset + 1,
oldnitems - offset - 1);
}
}
/* fill in nulls bitmap if needed */
if (newhasnulls)
{
- bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
- bits8 *oldnullbitmap = ARR_NULLBITMAP(array);
+ bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
+ bits8 *oldnullbitmap = ARR_NULLBITMAP(array);
array_bitmap_copy(newnullbitmap, 0,
oldnullbitmap, 0,
array_bitmap_copy(newnullbitmap, itemsbefore,
ARR_NULLBITMAP(srcArray), 0,
nsrcitems);
- array_bitmap_copy(newnullbitmap, itemsbefore+nsrcitems,
- oldnullbitmap, itemsbefore+nolditems,
+ array_bitmap_copy(newnullbitmap, itemsbefore + nsrcitems,
+ oldnullbitmap, itemsbefore + nolditems,
itemsafter);
}
}
*/
if (fcinfo->flinfo->fn_strict)
{
- int j;
+ int j;
for (j = 0; j < fcinfo->nargs; j++)
{
else
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("NULL array element not allowed in this context")));
+ errmsg("NULL array element not allowed in this context")));
}
else
{
}
/*
- * If arrays contain same data (up to end of shorter one), apply additional
- * rules to sort by dimensionality. The relative significance of the
- * different bits of information is historical; mainly we just care that
- * we don't say "equal" for arrays of different dimensionality.
+ * If arrays contain same data (up to end of shorter one), apply
+ * additional rules to sort by dimensionality. The relative significance
+ * of the different bits of information is historical; mainly we just care
+ * that we don't say "equal" for arrays of different dimensionality.
*/
if (result == 0)
{
*
* Note: this could certainly be optimized using standard bitblt methods.
* However, it's not clear that the typical Postgres array has enough elements
- * to make it worth worrying too much. For the moment, KISS.
+ * to make it worth worrying too much. For the moment, KISS.
*/
void
array_bitmap_copy(bits8 *destbitmap, int destoffset,
src_offset = ArrayGetOffset(ndim, dim, lb, st);
srcdataptr = array_seek(arraydataptr, 0, arraynullsptr, src_offset,
- typlen, typbyval, typalign);
+ typlen, typbyval, typalign);
mda_get_prod(ndim, dim, prod);
mda_get_range(ndim, span, st, endp);
mda_get_offset_values(ndim, dist, prod, span);
* Insert a slice into an array.
*
* ndim/dim[]/lb[] are dimensions of the original array. A new array with
- * those same dimensions is to be constructed. destArray must already
+ * those same dimensions is to be constructed. destArray must already
* have been allocated and its header initialized.
*
* st[]/endp[] identify the slice to be replaced. Elements within the slice
/*
* Use array_map to apply the function to each array element.
*
- * We pass on the desttypmod and isExplicit flags whether or not the function
- * wants them.
+ * We pass on the desttypmod and isExplicit flags whether or not the
+ * function wants them.
*/
InitFunctionCallInfoData(locfcinfo, &my_extra->coerce_finfo, 3,
NULL, NULL);
(astate->nelems + ARRAY_ELEMS_CHUNKSIZE) * sizeof(Datum));
astate->dnulls = (bool *)
repalloc(astate->dnulls,
- (astate->nelems + ARRAY_ELEMS_CHUNKSIZE) * sizeof(bool));
+ (astate->nelems + ARRAY_ELEMS_CHUNKSIZE) * sizeof(bool));
}
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/arrayutils.c,v 1.19 2005/11/17 22:14:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/arrayutils.c,v 1.20 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ret = 1;
for (i = 0; i < ndim; i++)
{
- int64 prod;
+ int64 prod;
/* A negative dimension implies that UB-LB overflowed ... */
if (dims[i] < 0)
errmsg("array size exceeds the maximum allowed (%d)",
(int) MaxArraySize)));
- prod = (int64) ret * (int64) dims[i];
+ prod = (int64) ret *(int64) dims[i];
+
ret = (int32) prod;
if ((int64) ret != prod)
ereport(ERROR,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.160 2005/10/15 02:49:28 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.161 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
/* -----------------------------------------------------------------------
* formatting.c
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.101 2005/10/20 15:59:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.102 2005/11/22 18:17:22 momjian Exp $
*
*
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
* The input string is shorter than format picture, so it's good
* time to break this loop...
*
- * Note: this isn't relevant for TO_CHAR mode, beacuse it use 'inout'
- * allocated by format picture length.
+ * Note: this isn't relevant for TO_CHAR mode, beacuse it use
+ * 'inout' allocated by format picture length.
*/
break;
* We need sign detection because determine exact position of post-sign is
* difficult:
*
- * FM9999.9999999S -> 123.001- 9.9S -> .5- FM9.999999MI
- * -> 5.01-
+ * FM9999.9999999S -> 123.001- 9.9S -> .5- FM9.999999MI ->
+ * 5.01-
*/
if (*Np->number == ' ' && Np->read_pre + Np->read_post > 0)
{
*
* FM9.999999MI -> 5.01-
*
- * if (.... && IS_LSIGN(Np->Num)==FALSE) prevents read wrong formats like
- * to_number('1 -', '9S') where sign is not anchored to last number.
+ * if (.... && IS_LSIGN(Np->Num)==FALSE) prevents read wrong formats
+ * like to_number('1 -', '9S') where sign is not anchored to last
+ * number.
*/
else if (isread == FALSE && IS_LSIGN(Np->Num) == FALSE &&
(IS_PLUS(Np->Num) || IS_MINUS(Np->Num)))
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.25 2005/11/07 17:36:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.26 2005/11/22 18:17:23 momjian Exp $
*
* XXX These are totally bogus. Perhaps someone will make them do
* something reasonable, someday.
/*
- * Selectivity functions for geometric operators. These are bogus -- unless
+ * Selectivity functions for geometric operators. These are bogus -- unless
* we know the actual key distribution in the index, we can't make a good
* prediction of the selectivity of these operators.
*
* Copyright (c) 1998-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.87 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.88 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Get the number in the variable format.
*
- * Even if we didn't need to change format, we'd still need to copy the value
- * to have a modifiable copy for rounding. set_var_from_num() also
+ * Even if we didn't need to change format, we'd still need to copy the
+ * value to have a modifiable copy for rounding. set_var_from_num() also
* guarantees there is extra digit space in case we produce a carry out
* from rounding.
*/
* scale of the attribute have to be applied on the value.
*/
Datum
-numeric(PG_FUNCTION_ARGS)
+numeric (PG_FUNCTION_ARGS)
{
Numeric num = PG_GETARG_NUMERIC(0);
int32 typmod = PG_GETARG_INT32(1);
/*
* Allocate space for the result.
*
- * i is set to to # of decimal digits before decimal point. dscale is the #
- * of decimal digits we will print after decimal point. We may generate as
- * many as DEC_DIGITS-1 excess digits at the end, and in addition we need
- * room for sign, decimal point, null terminator.
+ * i is set to to # of decimal digits before decimal point. dscale is the
+ * # of decimal digits we will print after decimal point. We may generate
+ * as many as DEC_DIGITS-1 excess digits at the end, and in addition we
+ * need room for sign, decimal point, null terminator.
*/
i = (var->weight + 1) * DEC_DIGITS;
if (i <= 0)
* INT_MAX is noticeably larger than NBASE*NBASE, this gives us headroom
* to avoid normalizing carries immediately.
*
- * We start with div[] containing one zero digit followed by the dividend's
- * digits (plus appended zeroes to reach the desired precision including
- * guard digits). Each step of the main loop computes an (approximate)
- * quotient digit and stores it into div[], removing one position of
- * dividend space. A final pass of carry propagation takes care of any
- * mistaken quotient digits.
+ * We start with div[] containing one zero digit followed by the
+ * dividend's digits (plus appended zeroes to reach the desired precision
+ * including guard digits). Each step of the main loop computes an
+ * (approximate) quotient digit and stores it into div[], removing one
+ * position of dividend space. A final pass of carry propagation takes
+ * care of any mistaken quotient digits.
*/
div = (int *) palloc0((div_ndigits + 1) * sizeof(int));
for (i = 0; i < var1ndigits; i++)
*
* exp(x) = 1 + x + x^2/2! + x^3/3! + ...
*
- * Given the limited range of x, this should converge reasonably quickly. We
- * run the series until the terms fall below the local_rscale limit.
+ * Given the limited range of x, this should converge reasonably quickly.
+ * We run the series until the terms fall below the local_rscale limit.
*/
add_var(&const_one, &x, result);
set_var_from_var(&x, &xpow);
*
* z + z^3/3 + z^5/5 + ...
*
- * where z = (x-1)/(x+1) is in the range (approximately) -0.053 .. 0.048 due
- * to the above range-reduction of x.
+ * where z = (x-1)/(x+1) is in the range (approximately) -0.053 .. 0.048
+ * due to the above range-reduction of x.
*
- * The convergence of this is not as fast as one would like, but is tolerable
- * given that z is small.
+ * The convergence of this is not as fast as one would like, but is
+ * tolerable given that z is small.
*/
sub_var(&x, &const_one, result);
add_var(&x, &const_one, &elem);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.65 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.66 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* case strtoul will not raise an error for some values that are out of
* the range of Oid.
*
- * For backwards compatibility, we want to accept inputs that are given with
- * a minus sign, so allow the input value if it matches after either
+ * For backwards compatibility, we want to accept inputs that are given
+ * with a minus sign, so allow the input value if it matches after either
* signed or unsigned extension to long.
*
- * To ensure consistent results on 32-bit and 64-bit platforms, make sure the
- * error message is the same as if strtoul() had returned ERANGE.
+ * To ensure consistent results on 32-bit and 64-bit platforms, make sure
+ * the error message is the same as if strtoul() had returned ERANGE.
*/
#if OID_MAX != ULONG_MAX
if (cvt != (unsigned long) result &&
/* ----------
* pg_lzcompress.c -
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.20 2005/10/15 02:49:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.21 2005/11/22 18:17:23 momjian Exp $
*
* This is an implementation of LZ compression for PostgreSQL.
* It uses a simple history table and generates 2-3 byte tags
* function and a difference occurs early). Otherwise, all the checks,
* needed here, cause too much overhead.
*
- * Thus we decompress the entire rest at once into the temporary buffer
- * and change the decomp state to return the prepared data from the
- * buffer by the more simple calls to
+ * Thus we decompress the entire rest at once into the temporary
+ * buffer and change the decomp state to return the prepared data from
+ * the buffer by the more simple calls to
* pglz_get_next_decomp_char_from_plain().
*/
if (dstate->cp_out - dstate->temp_buf >= 256)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.60 2005/10/18 20:38:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.61 2005/11/22 18:17:23 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
pg_wchar *data;
size_t data_len;
int regexec_result;
- regex_t *re;
+ regex_t *re;
char errMsg[100];
/* Convert data string to wide characters */
text *s = PG_GETARG_TEXT_P(0);
text *p = PG_GETARG_TEXT_P(1);
text *r = PG_GETARG_TEXT_P(2);
- regex_t *re;
+ regex_t *re;
re = RE_compile_and_cache(p, regex_flavor);
int i;
bool glob = false;
bool ignorecase = false;
- regex_t *re;
+ regex_t *re;
/* parse options */
for (i = 0; i < opt_len; i++)
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.82 2005/10/29 18:39:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.83 2005/11/22 18:17:23 momjian Exp $
*
* ----------
*/
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * DELETE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual DELETE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
* Get the relation descriptors of the FK and PK tables and the new and
* old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
* back to source text
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.208 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.209 2005/11/22 18:17:23 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
* 'NaN'). Note that strtod() and friends might accept NaN,
* so we can't use that to test.
*
- * In reality we only need to defend against infinity and NaN, so
- * we need not get too crazy about pattern matching here.
+ * In reality we only need to defend against infinity and NaN,
+ * so we need not get too crazy about pattern matching here.
*/
if (strspn(extval, "0123456789+-eE.") == strlen(extval))
{
* parser doesn't provide any easy way to test for whether an
* identifier is safe or not... so be safe not sorry.
*
- * Note: ScanKeywordLookup() does case-insensitive comparison, but that's
- * fine, since we already know we have all-lower-case.
+ * Note: ScanKeywordLookup() does case-insensitive comparison, but
+ * that's fine, since we already know we have all-lower-case.
*/
if (ScanKeywordLookup(ident) != NULL)
safe = false;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.192 2005/11/07 17:36:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.193 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* the righthand relation are unique (ie, act as if it's been
* DISTINCT'd).
*
- * NOTE: it might seem that we should unique-ify the lefthand input when
- * considering JOIN_REVERSE_IN. But this is not so, because the join
- * clause we've been handed has not been commuted from the way the
- * parser originally wrote it. We know that the unique side of the IN
- * clause is *always* on the right.
+ * NOTE: it might seem that we should unique-ify the lefthand input
+ * when considering JOIN_REVERSE_IN. But this is not so, because the
+ * join clause we've been handed has not been commuted from the way
+ * the parser originally wrote it. We know that the unique side of
+ * the IN clause is *always* on the right.
*
* NOTE: it would be dangerous to try to be smart about JOIN_LEFT or
* JOIN_RIGHT here, because we do not have enough information to
* assuming that the data distribution is affected uniformly by the
* restriction clauses!
*
- * XXX Possibly better way, but much more expensive: multiply by selectivity
- * of rel's restriction clauses that mention the target Var.
+ * XXX Possibly better way, but much more expensive: multiply by
+ * selectivity of rel's restriction clauses that mention the target Var.
*/
if (vardata.rel)
ndistinct *= vardata.rel->rows / vardata.rel->tuples;
* declared input type(s) of the operator we are invoked for, so we just
* error out if either is not recognized.
*
- * XXX The histogram we are interpolating between points of could belong to a
- * column that's only binary-compatible with the declared type. In essence
- * we are assuming that the semantics of binary-compatible types are
- * enough alike that we can use a histogram generated with one type's
+ * XXX The histogram we are interpolating between points of could belong
+ * to a column that's only binary-compatible with the declared type. In
+ * essence we are assuming that the semantics of binary-compatible types
+ * are enough alike that we can use a histogram generated with one type's
* operators to estimate selectivity for the other's. This is outright
* wrong in some cases --- in particular signed versus unsigned
* interpretation could trip us up. But it's useful enough in the
* that can write past the specified buffer length in that scenario.
* So, do it the dumb way for portability.
*
- * Yet other systems (e.g., glibc) sometimes return a smaller value from
- * the second call than the first; thus the Assert must be <= not ==
- * as you'd expect. Can't any of these people program their way out
- * of a paper bag?
+ * Yet other systems (e.g., glibc) sometimes return a smaller value
+ * from the second call than the first; thus the Assert must be <= not
+ * == as you'd expect. Can't any of these people program their way
+ * out of a paper bag?
*/
xfrmlen = strxfrm(NULL, val, 0);
xfrmstr = (char *) palloc(xfrmlen + 1);
/*
* Special-case boolean columns: presumably, two distinct values.
*
- * Are there any other datatypes we should wire in special estimates for?
+ * Are there any other datatypes we should wire in special estimates
+ * for?
*/
stadistinct = 2.0;
}
/*
* If there is a histogram, grab the last or first value as appropriate.
*
- * If there is a histogram that is sorted with some other operator than the
- * one we want, fail --- this suggests that there is data we can't use.
+ * If there is a histogram that is sorted with some other operator than
+ * the one we want, fail --- this suggests that there is data we can't
+ * use.
*/
if (get_attstatsslot(vardata->statsTuple,
vardata->atttype, vardata->atttypmod,
* system in favor of using partial indexes where possible, which is not
* necessarily a bad thing. But it'd be nice to do better someday.
*
- * Note that index->indpred and indexQuals are both in implicit-AND form, so
- * ANDing them together just takes merging the lists. However,
+ * Note that index->indpred and indexQuals are both in implicit-AND form,
+ * so ANDing them together just takes merging the lists. However,
* eliminating duplicates is a bit trickier because indexQuals contains
* RestrictInfo nodes and the indpred does not. It is okay to pass a
* mixed list to clauselist_selectivity, but we have to work a bit to
/*
* Estimate the number of index pages that will be retrieved.
*
- * For all currently-supported index types, the first page of the index is a
- * metadata page, and we should figure on fetching that plus a pro-rated
+ * For all currently-supported index types, the first page of the index is
+ * a metadata page, and we should figure on fetching that plus a pro-rated
* fraction of the remaining pages.
*/
if (index->pages > 1 && index->tuples > 0)
* CPU costs as cpu_index_tuple_cost plus one cpu_operator_cost per
* indexqual operator.
*
- * Note: this neglects the possible costs of rechecking lossy operators and
- * OR-clause expressions. Detecting that that might be needed seems more
- * expensive than it's worth, though, considering all the other
+ * Note: this neglects the possible costs of rechecking lossy operators
+ * and OR-clause expressions. Detecting that that might be needed seems
+ * more expensive than it's worth, though, considering all the other
* inaccuracies here ...
*/
cost_qual_eval(&index_qual_cost, indexQuals);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.158 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.159 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
result->day = 0;
/*
- * This is wrong, but removing it breaks a lot of regression tests.
- * For example:
+ * This is wrong, but removing it breaks a lot of regression tests. For
+ * example:
*
- * test=> SET timezone = 'EST5EDT';
- * test=> SELECT
- * test-> ('2005-10-30 13:22:00-05'::timestamptz -
- * test(> '2005-10-29 13:22:00-04'::timestamptz);
- * ?column?
- * ----------------
- * 1 day 01:00:00
- * (1 row)
+ * test=> SET timezone = 'EST5EDT'; test=> SELECT test-> ('2005-10-30
+ * 13:22:00-05'::timestamptz - test(> '2005-10-29
+ * 13:22:00-04'::timestamptz); ?column? ---------------- 1 day 01:00:00 (1
+ * row)
*
- * so adding that to the first timestamp gets:
+ * so adding that to the first timestamp gets:
*
- * test=> SELECT
- * test-> ('2005-10-29 13:22:00-04'::timestamptz +
- * test(> ('2005-10-30 13:22:00-05'::timestamptz -
- * test(> '2005-10-29 13:22:00-04'::timestamptz)) at time zone 'EST';
- * timezone
- * --------------------
- * 2005-10-30 14:22:00
- * (1 row)
+ * test=> SELECT test-> ('2005-10-29 13:22:00-04'::timestamptz + test(>
+ * ('2005-10-30 13:22:00-05'::timestamptz - test(> '2005-10-29
+ * 13:22:00-04'::timestamptz)) at time zone 'EST'; timezone
+ * -------------------- 2005-10-30 14:22:00 (1 row)
*/
- result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
+ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
PG_RETURN_INTERVAL_P(result);
{
Interval *span = PG_GETARG_INTERVAL_P(0);
Interval *result;
+
#ifdef HAVE_INT64_TIMESTAMP
int64 wholeday;
#else
day_remainder -= result->day;
/*
- * The above correctly handles the whole-number part of the month and
- * day products, but we have to do something with any fractional part
+ * The above correctly handles the whole-number part of the month and day
+ * products, but we have to do something with any fractional part
* resulting when the factor is nonintegral. We cascade the fractions
* down to lower units using the conversion factors DAYS_PER_MONTH and
- * SECS_PER_DAY. Note we do NOT cascade up, since we are not forced to
- * do so by the representation. The user can choose to cascade up later,
+ * SECS_PER_DAY. Note we do NOT cascade up, since we are not forced to do
+ * so by the representation. The user can choose to cascade up later,
* using justify_hours and/or justify_days.
*/
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.140 2005/11/18 02:38:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.141 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(LPWSTR) a1p, a1len / 2);
if (!r)
ereport(ERROR,
- (errmsg("could not convert string to UTF-16: error %lu",
- GetLastError())));
+ (errmsg("could not convert string to UTF-16: error %lu",
+ GetLastError())));
}
((LPWSTR) a1p)[r] = 0;
(LPWSTR) a2p, a2len / 2);
if (!r)
ereport(ERROR,
- (errmsg("could not convert string to UTF-16: error %lu",
- GetLastError())));
+ (errmsg("could not convert string to UTF-16: error %lu",
+ GetLastError())));
}
((LPWSTR) a2p)[r] = 0;
if (eml == 1)
{
for (; p < p_end && *p != '\\'; p++)
- /* nothing */ ;
+ /* nothing */ ;
}
else
{
for (; p < p_end && *p != '\\'; p += pg_mblen(p))
- /* nothing */ ;
+ /* nothing */ ;
}
/* Copy the text we just scanned over, if any. */
else
{
/*
- * If escape char is not followed by any expected char,
- * just treat it as ordinary data to copy. (XXX would it be
- * better to throw an error?)
+ * If escape char is not followed by any expected char, just treat
+ * it as ordinary data to copy. (XXX would it be better to throw
+ * an error?)
*/
appendStringInfoChar(str, '\\');
continue;
if (so != -1 && eo != -1)
{
/*
- * Copy the text that is back reference of regexp. Because so and
+ * Copy the text that is back reference of regexp. Because so and
* eo are counted in characters not bytes, it's easiest to use
* text_substring to pull out the correct chunk of text.
*/
break;
/*
- * Copy the text to the left of the match position. Because we
- * are working with character not byte indexes, it's easiest to
- * use text_substring to pull out the needed data.
+ * Copy the text to the left of the match position. Because we are
+ * working with character not byte indexes, it's easiest to use
+ * text_substring to pull out the needed data.
*/
if (pmatch[0].rm_so - data_pos > 0)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.125 2005/10/15 02:49:30 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.126 2005/11/22 18:17:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* relation. For each matching tuple found in the relation, use an
* existing cache entry if possible, else build a new one.
*
- * We have to bump the member refcounts temporarily to ensure they won't get
- * dropped from the cache while loading other members. We use a PG_TRY
+ * We have to bump the member refcounts temporarily to ensure they won't
+ * get dropped from the cache while loading other members. We use a PG_TRY
* block to ensure we can undo those refcounts if we get an error before
* we finish constructing the CatCList.
*/
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.73 2005/10/15 02:49:31 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.74 2005/11/22 18:17:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* is needed because other backends might possibly possess smgr cache
* but not relcache entries for the target relation.
*
- * Note: during a pg_class row update that assigns a new relfilenode or
- * reltablespace value, we will be called on both the old and new
+ * Note: during a pg_class row update that assigns a new relfilenode
+ * or reltablespace value, we will be called on both the old and new
* tuples, and thus will broadcast invalidation messages showing both
* the old and new RelFileNode values. This ensures that other
* backends will close smgr references to the old file.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.231 2005/11/20 19:49:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.232 2005/11/22 18:17:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Copy the relation tuple form
*
- * We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE. relacl
- * is NOT stored in the relcache --- there'd be little point in it, since
- * we don't copy the tuple's nullvalues bitmap and hence wouldn't know if
- * the value is valid ... bottom line is that relacl *cannot* be retrieved
- * from the relcache. Get it from the syscache if you need it.
+ * We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE.
+ * relacl is NOT stored in the relcache --- there'd be little point in it,
+ * since we don't copy the tuple's nullvalues bitmap and hence wouldn't
+ * know if the value is valid ... bottom line is that relacl *cannot* be
+ * retrieved from the relcache. Get it from the syscache if you need it.
*/
relationForm = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
/*
* open pg_rewrite and begin a scan
*
- * Note: since we scan the rules using RewriteRelRulenameIndexId, we will be
- * reading the rules in name order, except possibly during
+ * Note: since we scan the rules using RewriteRelRulenameIndexId, we will
+ * be reading the rules in name order, except possibly during
* emergency-recovery operations (ie, IsIgnoringSystemIndexes). This in
* turn ensures that rules will be fired in name order.
*/
/*
* initialize relation tuple form
*
- * The data we insert here is pretty incomplete/bogus, but it'll serve to get
- * us launched. RelationCacheInitializePhase2() will read the real data
- * from pg_class and replace what we've done here.
+ * The data we insert here is pretty incomplete/bogus, but it'll serve to
+ * get us launched. RelationCacheInitializePhase2() will read the real
+ * data from pg_class and replace what we've done here.
*/
relation->rd_rel = (Form_pg_class) palloc0(CLASS_TUPLE_SIZE);
/*
* Read the pg_class row
*
- * Don't try to use an indexscan of pg_class_oid_index to reload the info for
- * pg_class_oid_index ...
+ * Don't try to use an indexscan of pg_class_oid_index to reload the info
+ * for pg_class_oid_index ...
*/
indexOK = (RelationGetRelid(relation) != ClassOidIndexId);
pg_class_tuple = ScanPgRelation(RelationGetRelid(relation), indexOK);
* got called because of a relation cache flush that was triggered by
* VACUUM.
*
- * If it's a nailed index, then we need to re-read the pg_class row to see if
- * its relfilenode changed. We can't necessarily do that here, because we
- * might be in a failed transaction. We assume it's okay to do it if
+ * If it's a nailed index, then we need to re-read the pg_class row to see
+ * if its relfilenode changed. We can't necessarily do that here, because
+ * we might be in a failed transaction. We assume it's okay to do it if
* there are open references to the relcache entry (cf notes for
* AtEOXact_RelationCache). Otherwise just mark the entry as possibly
* invalid, and it'll be fixed when next opened.
* rd_createSubid state. Also attempt to preserve the tupledesc and
* rewrite-rule substructures in place.
*
- * Note that this process does not touch CurrentResourceOwner; which is
- * good because whatever ref counts the entry may have do not
+ * Note that this process does not touch CurrentResourceOwner; which
+ * is good because whatever ref counts the entry may have do not
* necessarily belong to that resource owner.
*/
Oid save_relid = RelationGetRelid(relation);
/*
* Is it a relation created in the current subtransaction?
*
- * During subcommit, mark it as belonging to the parent, instead. During
- * subabort, simply delete the relcache entry.
+ * During subcommit, mark it as belonging to the parent, instead.
+ * During subabort, simply delete the relcache entry.
*/
if (relation->rd_createSubid == mySubid)
{
* Rules and triggers are not saved (mainly because the internal
* format is complex and subject to change). They must be rebuilt if
* needed by RelationCacheInitializePhase2. This is not expected to
- * be a big performance hit since few system catalogs have such.
- * Ditto for index expressions and predicates.
+ * be a big performance hit since few system catalogs have such. Ditto
+ * for index expressions and predicates.
*/
rel->rd_rules = NULL;
rel->rd_rulescxt = NULL;
* OK, rename the temp file to its final name, deleting any
* previously-existing init file.
*
- * Note: a failure here is possible under Cygwin, if some other backend
- * is holding open an unlinked-but-not-yet-gone init file. So treat
- * this as a noncritical failure; just remove the useless temp file on
- * failure.
+ * Note: a failure here is possible under Cygwin, if some other
+ * backend is holding open an unlinked-but-not-yet-gone init file. So
+ * treat this as a noncritical failure; just remove the useless temp
+ * file on failure.
*/
if (rename(tempfilename, finalfilename) < 0)
unlink(tempfilename);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.15 2005/10/15 02:49:32 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.16 2005/11/22 18:17:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Set up fmgr lookup info as requested
*
- * Note: we tell fmgr the finfo structures live in CacheMemoryContext, which
- * is not quite right (they're really in DynaHashContext) but this will do
- * for our purposes.
+ * Note: we tell fmgr the finfo structures live in CacheMemoryContext,
+ * which is not quite right (they're really in DynaHashContext) but this
+ * will do for our purposes.
*/
if ((flags & TYPECACHE_EQ_OPR_FINFO) &&
typentry->eq_opr_finfo.fn_oid == InvalidOid &&
* require the user to specify which one he wants. If we find more than
* one exact match, then someone put bogus entries in pg_opclass.
*
- * This is the same logic as GetDefaultOpClass() in indexcmds.c, except that
- * we consider all opclasses, regardless of the current search path.
+ * This is the same logic as GetDefaultOpClass() in indexcmds.c, except
+ * that we consider all opclasses, regardless of the current search path.
*/
rel = heap_open(OperatorClassRelationId, AccessShareLock);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.167 2005/11/05 03:04:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.168 2005/11/22 18:17:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* the connection until needed, since this routine will get called whether
* or not Log_destination actually mentions syslog.
*
- * Note that we make our own copy of the ident string rather than relying on
- * guc.c's. This may be overly paranoid, but it ensures that we cannot
+ * Note that we make our own copy of the ident string rather than relying
+ * on guc.c's. This may be overly paranoid, but it ensures that we cannot
* accidentally free a string that syslog is still using.
*/
if (syslog_ident == NULL || strcmp(syslog_ident, ident) != 0 ||
if (MyProcPort)
{
const char *psdisp;
- int displen;
+ int displen;
psdisp = get_ps_display(&displen);
appendStringInfo(buf, "%.*s", displen, psdisp);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.97 2005/10/15 02:49:32 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.98 2005/11/22 18:17:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* backwards-compatibility wrapper). Note, however, that we'll never get
* here with NULL arguments if the function is marked strict.
*
- * We also need to detoast any TOAST-ed inputs, since it's unlikely that an
- * old-style function knows about TOASTing.
+ * We also need to detoast any TOAST-ed inputs, since it's unlikely that
+ * an old-style function knows about TOASTing.
*/
isnull = false;
for (i = 0; i < n_arguments; i++)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.65 2005/10/15 02:49:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.66 2005/11/22 18:17:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* For shared hash tables, we have a local hash header (HTAB struct) that
* we allocate in TopMemoryContext; all else is in shared memory.
*
- * For non-shared hash tables, everything including the hash header is in a
- * memory context created specially for the hash table --- this makes
+ * For non-shared hash tables, everything including the hash header is in
+ * a memory context created specially for the hash table --- this makes
* hash_destroy very simple. The memory context is made a child of either
* a context specified by the caller, or TopMemoryContext if nothing is
* specified.
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.15 2005/10/15 02:49:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.16 2005/11/22 18:17:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Convert list of role Oids to list of role names. We must do
* this before re-sorting auth_info.
*
- * We skip the first list element (curr_role itself) since there is
- * no point in writing that a role is a member of itself.
+ * We skip the first list element (curr_role itself) since there
+ * is no point in writing that a role is a member of itself.
*/
for_each_cell(mem, lnext(list_head(roles_list)))
{
* likely won't have gotten a strong enough lock), so get the locks we
* need before writing anything.
*
- * For writing the auth file, it's sufficient to ExclusiveLock pg_authid; we
- * take just regular AccessShareLock on pg_auth_members.
+ * For writing the auth file, it's sufficient to ExclusiveLock pg_authid;
+ * we take just regular AccessShareLock on pg_auth_members.
*/
if (database_file_update_subid != InvalidSubTransactionId)
drel = heap_open(DatabaseRelationId, ExclusiveLock);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.150 2005/10/15 02:49:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.151 2005/11/22 18:17:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Try to create the lock file --- O_EXCL makes this atomic.
*
- * Think not to make the file protection weaker than 0600. See comments
- * below.
+ * Think not to make the file protection weaker than 0600. See
+ * comments below.
*/
fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd >= 0)
* carefully then all but the immediate parent shell will be
* root-owned processes and so the kill test will fail with EPERM.
*
- * We can treat the EPERM-error case as okay because that error implies
- * that the existing process has a different userid than we do, which
- * means it cannot be a competing postmaster. A postmaster cannot
- * successfully attach to a data directory owned by a userid other
- * than its own. (This is now checked directly in checkDataDir(), but
- * has been true for a long time because of the restriction that the
- * data directory isn't group- or world-accessible.) Also, since we
- * create the lockfiles mode 600, we'd have failed above if the
- * lockfile belonged to another userid --- which means that whatever
- * process kill() is reporting about isn't the one that made the
- * lockfile. (NOTE: this last consideration is the only one that
- * keeps us from blowing away a Unix socket file belonging to an
- * instance of Postgres being run by someone else, at least on
- * machines where /tmp hasn't got a stickybit.)
+ * We can treat the EPERM-error case as okay because that error
+ * implies that the existing process has a different userid than we
+ * do, which means it cannot be a competing postmaster. A postmaster
+ * cannot successfully attach to a data directory owned by a userid
+ * other than its own. (This is now checked directly in
+ * checkDataDir(), but has been true for a long time because of the
+ * restriction that the data directory isn't group- or
+ * world-accessible.) Also, since we create the lockfiles mode 600,
+ * we'd have failed above if the lockfile belonged to another userid
+ * --- which means that whatever process kill() is reporting about
+ * isn't the one that made the lockfile. (NOTE: this last
+ * consideration is the only one that keeps us from blowing away a
+ * Unix socket file belonging to an instance of Postgres being run by
+ * someone else, at least on machines where /tmp hasn't got a
+ * stickybit.)
*
- * Windows hasn't got getppid(), but doesn't need it since it's not using
- * real kill() either...
+ * Windows hasn't got getppid(), but doesn't need it since it's not
+ * using real kill() either...
*
- * Normally kill() will fail with ESRCH if the given PID doesn't exist.
- * BeOS returns EINVAL for some silly reason, however.
+ * Normally kill() will fail with ESRCH if the given PID doesn't
+ * exist. BeOS returns EINVAL for some silly reason, however.
*/
if (other_pid != my_pid
#ifndef WIN32
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.158 2005/10/15 02:49:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.159 2005/11/22 18:17:26 momjian Exp $
*
*
*-------------------------------------------------------------------------
/*
* Set up the global variables holding database id and path.
*
- * We take a shortcut in the bootstrap case, otherwise we have to look up the
- * db name in pg_database.
+ * We take a shortcut in the bootstrap case, otherwise we have to look up
+ * the db name in pg_database.
*/
if (bootstrap)
{
*
* 1999/1/15 Tatsuo Ishii
*
- * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c,v 1.6 2005/10/15 02:49:34 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c,v 1.7 2005/11/22 18:17:26 momjian Exp $
*/
/* can be used in either frontend or backend */
{
unsigned short code,
peer;
-} codes_t;
+} codes_t;
/* map Big5 Level 1 to CNS 11643-1992 Plane 1 */
static codes_t big5Level1ToCnsPlane1[25] = { /* range */
};
static unsigned short BinarySearchRange
- (codes_t * array, int high, unsigned short code)
+ (codes_t *array, int high, unsigned short code)
{
int low,
mid,
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.15 2005/10/15 02:49:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.16 2005/11/22 18:17:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pg_utf_to_local *map2; /* from UTF8 map name */
int size1; /* size of map1 */
int size2; /* size of map2 */
-} pg_conv_map;
+} pg_conv_map;
static pg_conv_map maps[] = {
{PG_SQL_ASCII}, /* SQL/ASCII */
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.300 2005/11/17 22:14:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.301 2005/11/22 18:17:26 momjian Exp $
*
*--------------------------------------------------------------------
*/
{"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER,
gettext_noop("Enables the planner to use constraints to optimize queries."),
gettext_noop("Child table scans will be skipped if their "
- "constraints guarantee that no rows match the query.")
+ "constraints guarantee that no rows match the query.")
},
&constraint_exclusion,
false, NULL, NULL
{"fsync", PGC_SIGHUP, WAL_SETTINGS,
gettext_noop("Forces synchronization of updates to disk."),
gettext_noop("The server will use the fsync() system call in several places to make "
- "sure that updates are physically written to disk. This insures "
+ "sure that updates are physically written to disk. This insures "
"that a database cluster will recover to a consistent state after "
"an operating system or hardware crash.")
},
gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),
gettext_noop("A page write in process during an operating system crash might be "
"only partially written to disk. During recovery, the row changes "
- "stored in WAL are not enough to recover. This option writes "
+ "stored in WAL are not enough to recover. This option writes "
"pages when first modified after a checkpoint to WAL so full recovery "
"is possible.")
},
* If the data_directory GUC variable has been set, use that as DataDir;
* otherwise use configdir if set; else punt.
*
- * Note: SetDataDir will copy and absolute-ize its argument, so we don't have
- * to.
+ * Note: SetDataDir will copy and absolute-ize its argument, so we don't
+ * have to.
*/
if (data_directory)
SetDataDir(data_directory);
/*
* We have two cases:
*
- * If commit and HAVE_TENTATIVE, set actual value to tentative (this is
- * to override a SET LOCAL if one occurred later than SET). We keep
+ * If commit and HAVE_TENTATIVE, set actual value to tentative (this
+ * is to override a SET LOCAL if one occurred later than SET). We keep
* the tentative value and propagate HAVE_TENTATIVE to the parent
* status, allowing the SET's effect to percolate up. (But if we're
* exiting the outermost transaction, we'll drop the HAVE_TENTATIVE
* If newval should now be freed, it'll be
* taken care of below.
*
- * See notes in set_config_option about casting
+ * See notes in set_config_option about
+ * casting
*/
newval = (char *) newstr;
}
* to contain some useful information. Mechanism differs wildly across
* platforms.
*
- * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.26 2005/11/05 03:04:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.27 2005/11/22 18:17:26 momjian Exp $
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
* various details abducted from various places
/* Remove any trailing spaces to offset the effect of PS_PADDING */
offset = ps_buffer_size;
- while (offset > ps_buffer_fixed_size && ps_buffer[offset-1] == PS_PADDING)
+ while (offset > ps_buffer_fixed_size && ps_buffer[offset - 1] == PS_PADDING)
offset--;
*displen = offset - ps_buffer_fixed_size;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.82 2005/10/15 02:49:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.83 2005/11/22 18:17:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Release any resources still attached to the portal. There are several
* cases being covered here:
*
- * Top transaction commit (indicated by isTopCommit): normally we should do
- * nothing here and let the regular end-of-transaction resource releasing
- * mechanism handle these resources too. However, if we have a FAILED
- * portal (eg, a cursor that got an error), we'd better clean up its
- * resources to avoid resource-leakage warning messages.
+ * Top transaction commit (indicated by isTopCommit): normally we should
+ * do nothing here and let the regular end-of-transaction resource
+ * releasing mechanism handle these resources too. However, if we have a
+ * FAILED portal (eg, a cursor that got an error), we'd better clean up
+ * its resources to avoid resource-leakage warning messages.
*
- * Sub transaction commit: never comes here at all, since we don't kill any
- * portals in AtSubCommit_Portals().
+ * Sub transaction commit: never comes here at all, since we don't kill
+ * any portals in AtSubCommit_Portals().
*
* Main or sub transaction abort: we will do nothing here because
* portal->resowner was already set NULL; the resources were already
* cleaned up in transaction abort.
*
- * Ordinary portal drop: must release resources. However, if the portal is
- * not FAILED then we do not release its locks. The locks become the
+ * Ordinary portal drop: must release resources. However, if the portal
+ * is not FAILED then we do not release its locks. The locks become the
* responsibility of the transaction's ResourceOwner (since it is the
* parent of the portal's owner) and will be released when the transaction
* eventually ends.
* Instead of dropping the portal, prepare it for access by later
* transactions.
*
- * Note that PersistHoldablePortal() must release all resources used
- * by the portal that are local to the creating transaction.
+ * Note that PersistHoldablePortal() must release all resources
+ * used by the portal that are local to the creating transaction.
*/
PortalCreateHoldStore(portal);
PersistHoldablePortal(portal);
* If the portal is READY then allow it to survive into the parent
* transaction; otherwise shut it down.
*
- * Currently, we can't actually support that because the portal's query
- * might refer to objects created or changed in the failed
+ * Currently, we can't actually support that because the portal's
+ * query might refer to objects created or changed in the failed
* subtransaction, leading to crashes if execution is resumed. So,
* even READY portals are deleted. It would be nice to detect whether
* the query actually depends on any such object, instead.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.15 2005/11/07 17:36:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.16 2005/11/22 18:17:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* buffer entry from my list, so I just have to iterate till there are
* none.
*
- * During a commit, there shouldn't be any remaining pins --- that would
- * indicate failure to clean up the executor correctly --- so issue
- * warnings. In the abort case, just clean up quietly.
+ * During a commit, there shouldn't be any remaining pins --- that
+ * would indicate failure to clean up the executor correctly --- so
+ * issue warnings. In the abort case, just clean up quietly.
*
* We are careful to do the releasing back-to-front, so as to avoid
* O(N^2) behavior in ResourceOwnerForgetBuffer().
* the relref entry from my list, so I just have to iterate till there
* are none.
*
- * As with buffer pins, warn if any are left at commit time, and release
- * back-to-front for speed.
+ * As with buffer pins, warn if any are left at commit time, and
+ * release back-to-front for speed.
*/
while (owner->nrelrefs > 0)
{
* the catref entry from my list, so I just have to iterate till there
* are none. Ditto for catcache lists.
*
- * As with buffer pins, warn if any are left at commit time, and release
- * back-to-front for speed.
+ * As with buffer pins, warn if any are left at commit time, and
+ * release back-to-front for speed.
*/
while (owner->ncatrefs > 0)
{
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.55 2005/11/20 19:49:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.56 2005/11/22 18:17:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
tuplesort_end(Tuplesortstate *state)
{
int i;
+
#ifdef TRACE_SORT
long spaceUsed;
#endif
* and it's simplest to let writetup free each tuple as soon as
* it's written.)
*
- * Note there will always be at least one tuple in the heap at this
- * point; see dumptuples.
+ * Note there will always be at least one tuple in the heap at
+ * this point; see dumptuples.
*/
Assert(state->memtupcount > 0);
if (COMPARETUP(state, tuple, state->memtuples[0]) >= 0)
/*
* Backward.
*
- * if all tuples are fetched already then we return last tuple, else
- * - tuple before last returned.
+ * if all tuples are fetched already then we return last tuple,
+ * else - tuple before last returned.
*/
if (state->eof_reached)
{
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.24 2005/11/20 19:49:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.25 2005/11/22 18:17:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* These variables are used to keep track of the current position.
*
- * In state WRITEFILE, the current file seek position is the write point, and
- * the read position is remembered in readpos_xxx; in state READFILE, the
- * current file seek position is the read point, and the write position is
- * remembered in writepos_xxx. (The write position is the same as EOF,
- * but since BufFileSeek doesn't currently implement SEEK_END, we have to
- * remember it explicitly.)
+ * In state WRITEFILE, the current file seek position is the write point,
+ * and the read position is remembered in readpos_xxx; in state READFILE,
+ * the current file seek position is the read point, and the write
+ * position is remembered in writepos_xxx. (The write position is the
+ * same as EOF, but since BufFileSeek doesn't currently implement
+ * SEEK_END, we have to remember it explicitly.)
*
- * Special case: if we are in WRITEFILE state and eof_reached is true, then
- * the read position is implicitly equal to the write position (and hence
- * to the file seek position); this way we need not update the readpos_xxx
- * variables on each write.
+ * Special case: if we are in WRITEFILE state and eof_reached is true,
+ * then the read position is implicitly equal to the write position (and
+ * hence to the file seek position); this way we need not update the
+ * readpos_xxx variables on each write.
*/
bool eof_reached; /* read reached EOF (always valid) */
int current; /* next array index (valid if INMEM) */
/*
* Backward.
*
- * if all tuples are fetched already then we return last tuple, else
- * - tuple before last returned.
+ * if all tuples are fetched already then we return last tuple,
+ * else - tuple before last returned.
*
- * Back up to fetch previously-returned tuple's ending length word.
- * If seek fails, assume we are at start of file.
+ * Back up to fetch previously-returned tuple's ending length
+ * word. If seek fails, assume we are at start of file.
*/
if (BufFileSeek(state->myfile, 0, -(long) sizeof(unsigned int),
SEEK_CUR) != 0)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.91 2005/10/15 02:49:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.92 2005/11/22 18:17:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* By here, the inserting transaction has committed - have to check
* when...
*
- * Note that the provided snapshot contains only top-level XIDs, so we have
- * to convert a subxact XID to its parent for comparison. However, we can
- * make first-pass range checks with the given XID, because a subxact with
- * XID < xmin has surely also got a parent with XID < xmin, while one with
- * XID >= xmax must belong to a parent that was not yet committed at the
- * time of this snapshot.
+ * Note that the provided snapshot contains only top-level XIDs, so we
+ * have to convert a subxact XID to its parent for comparison. However, we
+ * can make first-pass range checks with the given XID, because a subxact
+ * with XID < xmin has surely also got a parent with XID < xmin, while one
+ * with XID >= xmax must belong to a parent that was not yet committed at
+ * the time of this snapshot.
*/
if (TransactionIdFollowsOrEquals(HeapTupleHeaderGetXmin(tuple),
snapshot->xmin))
/*
* Has inserting transaction committed?
*
- * If the inserting transaction aborted, then the tuple was never visible to
- * any other transaction, so we can delete it immediately.
+ * If the inserting transaction aborted, then the tuple was never visible
+ * to any other transaction, so we can delete it immediately.
*/
if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))
{
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.99 2005/10/15 02:49:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.100 2005/11/22 18:17:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* existing directory, effects equivalent to those caused by the
* following command shall occcur:
*
- * mkdir -p -m $(umask -S),u+wx $(dirname dir) && mkdir [-m mode] dir
+ * mkdir -p -m $(umask -S),u+wx $(dirname dir) && mkdir [-m mode]
+ * dir
*
- * We change the user's umask and then restore it, instead of doing
- * chmod's.
+ * We change the user's umask and then restore it, instead of
+ * doing chmod's.
*/
oumask = umask(0);
numask = oumask & ~(S_IWUSR | S_IXUSR);
/*
* Pass correct LC_xxx environment to bootstrap.
*
- * The shell script arranged to restore the LC settings afterwards, but there
- * doesn't seem to be any compelling reason to do that.
+ * The shell script arranged to restore the LC settings afterwards, but
+ * there doesn't seem to be any compelling reason to do that.
*/
snprintf(cmd, sizeof(cmd), "LC_COLLATE=%s", lc_collate);
putenv(xstrdup(cmd));
* for instance) but generating only the minimum required set of
* dependencies seems hard.
*
- * Note that we deliberately do not pin the system views, which haven't
- * been created yet.
+ * Note that we deliberately do not pin the system views, which
+ * haven't been created yet.
*
* First delete any already-made entries; PINs override all else, and
* must be the only entries for their objects.
/*
* Determine platform-specific config settings
*
- * Use reasonable values if kernel will let us, else scale back. Probe for
- * max_connections first since it is subject to more constraints than
+ * Use reasonable values if kernel will let us, else scale back. Probe
+ * for max_connections first since it is subject to more constraints than
* shared_buffers.
*/
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.61 2005/10/15 02:49:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.62 2005/11/22 18:17:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Win32 needs START /B rather than "&".
*
- * Win32 has a problem with START and quoted executable names. You must add a
- * "" as the title at the beginning so you can quote the executable name:
- * http://www.winnetmag.com/Article/ArticleID/14589/14589.html
+ * Win32 has a problem with START and quoted executable names. You must
+ * add a "" as the title at the beginning so you can quote the executable
+ * name: http://www.winnetmag.com/Article/ArticleID/14589/14589.html
* http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm
*/
if (log_file != NULL)
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.20 2005/10/15 02:49:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.21 2005/11/22 18:17:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* either raw data, or surrounded by double quotes (in which case embedded
* characters including backslashes and quotes are backslashed).
*
- * We build the result as an array of pointers followed by the actual string
- * data, all in one malloc block for convenience of deallocation. The
- * worst-case storage need is not more than one pointer and one character
- * for each input character (consider "{,,,,,,,,,,}").
+ * We build the result as an array of pointers followed by the actual
+ * string data, all in one malloc block for convenience of deallocation.
+ * The worst-case storage need is not more than one pointer and one
+ * character for each input character (consider "{,,,,,,,,,,}").
*/
*itemarray = NULL;
*nitems = 0;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.117 2005/10/15 02:49:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.118 2005/11/22 18:17:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* withing a database connection. Pre 1.3 archives can
* not use DB connections and are sent to output only.
*
- * For V1.3+, the table data MUST have a copy statement
- * so that we can go into appropriate mode with libpq.
+ * For V1.3+, the table data MUST have a copy
+ * statement so that we can go into appropriate mode
+ * with libpq.
*/
if (te->copyStmt && strlen(te->copyStmt) > 0)
ahprintf(AH, "%s", te->copyStmt);
* Read the flag indicating the state of the data pointer. Check if valid
* and die if not.
*
- * This used to be handled by a negative or zero pointer, now we use an extra
- * byte specifically for the state.
+ * This used to be handled by a negative or zero pointer, now we use an
+ * extra byte specifically for the state.
*/
offsetFlg = (*AH->ReadBytePtr) (AH) & 0xFF;
/*
* Not used; maybe later....
*
- * AH->workDir = strdup(FileSpec); for(i=strlen(FileSpec) ; i > 0 ; i--)
- * if (AH->workDir[i-1] == '/')
+ * AH->workDir = strdup(FileSpec); for(i=strlen(FileSpec) ; i > 0 ;
+ * i--) if (AH->workDir[i-1] == '/')
*/
}
else
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.422 2005/10/15 02:49:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.423 2005/11/22 18:17:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* THROTTLE:
*
- * There was considerable discussion in late July, 2000 regarding slowing
- * down pg_dump when backing up large tables. Users with both slow &
- * fast (muti-processor) machines experienced performance degradation
- * when doing a backup.
+ * There was considerable discussion in late July, 2000 regarding
+ * slowing down pg_dump when backing up large tables. Users with both
+ * slow & fast (muti-processor) machines experienced performance
+ * degradation when doing a backup.
*
- * Initial attempts based on sleeping for a number of ms for each ms of
- * work were deemed too complex, then a simple 'sleep in each loop'
+ * Initial attempts based on sleeping for a number of ms for each ms
+ * of work were deemed too complex, then a simple 'sleep in each loop'
* implementation was suggested. The latter failed because the loop
* was too tight. Finally, the following was implemented:
*
- * If throttle is non-zero, then See how long since the last sleep. Work
- * out how long to sleep (based on ratio). If sleep is more than
+ * If throttle is non-zero, then See how long since the last sleep.
+ * Work out how long to sleep (based on ratio). If sleep is more than
* 100ms, then sleep reset timer EndIf EndIf
*
- * where the throttle value was the number of ms to sleep per ms of work.
- * The calculation was done in each loop.
+ * where the throttle value was the number of ms to sleep per ms of
+ * work. The calculation was done in each loop.
*
- * Most of the hard work is done in the backend, and this solution still
- * did not work particularly well: on slow machines, the ratio was
- * 50:1, and on medium paced machines, 1:1, and on fast
+ * Most of the hard work is done in the backend, and this solution
+ * still did not work particularly well: on slow machines, the ratio
+ * was 50:1, and on medium paced machines, 1:1, and on fast
* multi-processor machines, it had little or no effect, for reasons
* that were unclear.
*
* strtod() and friends might accept NaN, so we
* can't use that to test.
*
- * In reality we only need to defend against infinity
- * and NaN, so we need not get too crazy about
- * pattern matching here.
+ * In reality we only need to defend against
+ * infinity and NaN, so we need not get too crazy
+ * about pattern matching here.
*/
const char *s = PQgetvalue(res, tuple, field);
/*
* Find all the tables (including views and sequences).
*
- * We include system catalogs, so that we can work if a user table is defined
- * to inherit from a system catalog (pretty weird, but...)
+ * We include system catalogs, so that we can work if a user table is
+ * defined to inherit from a system catalog (pretty weird, but...)
*
* We ignore tables that are not type 'r' (ordinary relation), 'S'
* (sequence), 'v' (view), or 'c' (composite type).
*
- * Composite-type table entries won't be dumped as such, but we have to make
- * a DumpableObject for them so that we can track dependencies of the
+ * Composite-type table entries won't be dumped as such, but we have to
+ * make a DumpableObject for them so that we can track dependencies of the
* composite type (pg_depend entries for columns of the composite type
* link to the pg_class entry not the pg_type entry).
*
- * Note: in this phase we should collect only a minimal amount of information
- * about each table, basically just enough to decide if it is interesting.
- * We must fetch all tables in this phase because otherwise we cannot
- * correctly identify inherited columns, serial columns, etc.
+ * Note: in this phase we should collect only a minimal amount of
+ * information about each table, basically just enough to decide if it is
+ * interesting. We must fetch all tables in this phase because otherwise
+ * we cannot correctly identify inherited columns, serial columns, etc.
*/
if (g_fout->remoteVersion >= 80000)
/*
* Not Null constraint --- suppress if inherited
*
- * Note: we could suppress this for serial columns since SERIAL
- * implies NOT NULL. We choose not to for forward
+ * Note: we could suppress this for serial columns since
+ * SERIAL implies NOT NULL. We choose not to for forward
* compatibility, since there has been some talk of making
* SERIAL not imply NOT NULL, in which case the explicit
* specification would be needed.
/*
* The logic we use for restoring sequences is as follows:
*
- * Add a basic CREATE SEQUENCE statement (use last_val for start if called is
- * false, else use min_val for start_val). Skip this if the sequence came
- * from a SERIAL column.
+ * Add a basic CREATE SEQUENCE statement (use last_val for start if called
+ * is false, else use min_val for start_val). Skip this if the sequence
+ * came from a SERIAL column.
*
- * Add a 'SETVAL(seq, last_val, iscalled)' at restore-time iff we load data.
- * We do this for serial sequences too.
+ * Add a 'SETVAL(seq, last_val, iscalled)' at restore-time iff we load
+ * data. We do this for serial sequences too.
*/
if (!dataOnly && !OidIsValid(tbinfo->owning_tab))
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.11 2005/10/15 02:49:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.12 2005/11/22 18:17:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Now initialize the heap of items-ready-to-output by filling it with the
* indexes of items that already have beforeConstraints[id] == 0.
*
- * The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j in
- * the range 1..heapLength-1 (note we are using 0-based subscripts here,
- * while the discussion in Knuth assumes 1-based subscripts). So, if we
- * simply enter the indexes into pendingHeap[] in decreasing order, we
+ * The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j
+ * in the range 1..heapLength-1 (note we are using 0-based subscripts
+ * here, while the discussion in Knuth assumes 1-based subscripts). So, if
+ * we simply enter the indexes into pendingHeap[] in decreasing order, we
* a-fortiori have the heap invariant satisfied at completion of this
* loop, and don't need to do any sift-up comparisons.
*/
* representation. After we identify and process a loop, we can add it to
* the initial part of the workspace just by moving the boundary pointer.
*
- * When we determine that an object is not part of any interesting loop, we
- * also add it to the initial part of the workspace. This is not
+ * When we determine that an object is not part of any interesting loop,
+ * we also add it to the initial part of the workspace. This is not
* necessary for correctness, but saves later invocations of findLoop()
* from uselessly chasing references to such an object.
*
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.110 2005/11/04 18:35:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.111 2005/11/22 18:17:29 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
}
errno = save_errno; /* just in case the write changed it */
}
-
#else /* WIN32 */
static BOOL WINAPI
done = true;
}
}
-
#endif /* WIN32 */
* want to think about coping with their variable screen width, but
* not today.)
*
- * Extract line number and begin and end indexes of line containing error
- * location. There will not be any newlines or carriage returns in
- * the selected extract.
+ * Extract line number and begin and end indexes of line containing
+ * error location. There will not be any newlines or carriage returns
+ * in the selected extract.
*/
for (i = 0; i < clen; i++)
{
* gives rise to a TransactionStmt in the backend grammar, except for the
* savepoint-related commands.
*
- * (We assume that START must be START TRANSACTION, since there is presently
- * no other "START foo" command.)
+ * (We assume that START must be START TRANSACTION, since there is
+ * presently no other "START foo" command.)
*/
if (wordlen == 5 && pg_strncasecmp(query, "abort", 5) == 0)
return true;
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.129 2005/10/27 13:34:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.130 2005/11/22 18:17:29 momjian Exp $
*/
#include "postgres_fe.h"
#include "describe.h"
/*
* Ordinary data character, transfer to pattern
*
- * Inside double quotes, or at all times if parsing an operator name,
- * quote regexp special characters with a backslash to avoid
+ * Inside double quotes, or at all times if parsing an operator
+ * name, quote regexp special characters with a backslash to avoid
* regexp errors. Outside quotes, however, let them pass through
* as-is; this lets knowledgeable users build regexp expressions
* that are more powerful than shell-style patterns.
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.127 2005/11/17 23:42:26 adunstan Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.128 2005/11/22 18:17:29 momjian Exp $
*/
#include "postgres_fe.h"
{
need_pass = false;
pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL,
- options.action == ACT_LIST_DB && options.dbname == NULL ?
+ options.action == ACT_LIST_DB && options.dbname == NULL ?
"postgres" : options.dbname,
username, password);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.79 2005/11/20 19:49:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.80 2005/11/22 18:17:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* This is the output format of heap_form_tuple and related routines.
*
* * Separately allocated tuple: t_data points to a palloc'd chunk that
- * is not adjacent to the HeapTupleData. (This case is deprecated since
+ * is not adjacent to the HeapTupleData. (This case is deprecated since
* it's difficult to tell apart from case #1. It should be used only in
* limited contexts where the code knows that case #1 will never apply.)
*
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/access/tuptoaster.h,v 1.24 2005/11/20 18:38:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/tuptoaster.h,v 1.25 2005/11/22 18:17:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* ----------
*/
extern HeapTuple toast_insert_or_update(Relation rel,
- HeapTuple newtup, HeapTuple oldtup);
+ HeapTuple newtup, HeapTuple oldtup);
/* ----------
* toast_delete -
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_constraint.h,v 1.18 2005/10/15 02:49:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_constraint.h,v 1.19 2005/11/22 18:17:30 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* contypid links to the pg_type row for a domain if this is a domain
* constraint. Otherwise it's 0.
*
- * For SQL-style global ASSERTIONs, both conrelid and contypid would be zero.
- * This is not presently supported, however.
+ * For SQL-style global ASSERTIONs, both conrelid and contypid would be
+ * zero. This is not presently supported, however.
*/
Oid contypid; /* domain this constraint constrains */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.25 2005/10/15 02:49:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.26 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* pg_control_version identifies the format of pg_control itself.
* catalog_version_no identifies the format of the system catalogs.
*
- * There are additional version identifiers in individual files; for example,
- * WAL logs contain per-page magic numbers that can serve as version cues
- * for the WAL log.
+ * There are additional version identifiers in individual files; for
+ * example, WAL logs contain per-page magic numbers that can serve as
+ * version cues for the WAL log.
*/
uint32 pg_control_version; /* PG_CONTROL_VERSION */
uint32 catalog_version_no; /* see catversion.h */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_shdepend.h,v 1.2 2005/10/15 02:49:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_shdepend.h,v 1.3 2005/11/22 18:17:30 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
/*
* Identification of the dependent (referencing) object.
*
- * These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can be
- * zero to denote a shared object.
+ * These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can
+ * be zero to denote a shared object.
*/
Oid dbid; /* OID of database containing object */
Oid classid; /* OID of table containing object */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.166 2005/10/15 02:49:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.167 2005/11/22 18:17:30 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
/*
* This flag represents a "NOT NULL" constraint against this datatype.
*
- * If true, the attnotnull column for a corresponding table column using this
- * datatype will always enforce the NOT NULL constraint.
+ * If true, the attnotnull column for a corresponding table column using
+ * this datatype will always enforce the NOT NULL constraint.
*
* Used primarily for domain types.
*/
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.12 2005/11/21 12:49:32 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.13 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "nodes/parsenodes.h"
extern void CreateConversionCommand(CreateConversionStmt *parsetree);
-extern void DropConversionCommand(List *conversion_name,
- DropBehavior behavior, bool missing_ok);
+extern void DropConversionCommand(List *conversion_name,
+ DropBehavior behavior, bool missing_ok);
extern void RenameConversion(List *name, const char *newname);
extern void AlterConversionOwner(List *name, Oid newOwnerId);
extern void AlterConversionOwner_oid(Oid conversionOid, Oid newOwnerId);
* Commands for manipulating roles (formerly called users).
*
*
- * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.28 2005/11/21 12:49:32 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.29 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void DropRole(DropRoleStmt *stmt);
extern void GrantRole(GrantRoleStmt *stmt);
extern void RenameRole(const char *oldname, const char *newname);
-extern void DropOwnedObjects(DropOwnedStmt *stmt);
-extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt);
+extern void DropOwnedObjects(DropOwnedStmt * stmt);
+extern void ReassignOwnedObjects(ReassignOwnedStmt * stmt);
#endif /* USER_H */
*
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/funcapi.h,v 1.20 2005/10/15 02:49:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/funcapi.h,v 1.21 2005/11/22 18:17:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* OPTIONAL maximum number of calls
*
- * max_calls is here for convenience only and setting it is optional. If not
- * set, you must provide alternative means to know when the function is
- * done.
+ * max_calls is here for convenience only and setting it is optional. If
+ * not set, you must provide alternative means to know when the function
+ * is done.
*/
uint32 max_calls;
/*
* OPTIONAL pointer to miscellaneous user-provided context information
*
- * user_fctx is for use as a pointer to your own struct to retain arbitrary
- * context information between calls of your function.
+ * user_fctx is for use as a pointer to your own struct to retain
+ * arbitrary context information between calls of your function.
*/
void *user_fctx;
/*
* OPTIONAL pointer to struct containing attribute type input metadata
*
- * attinmeta is for use when returning tuples (i.e. composite data types) and
- * is not used when returning base data types. It is only needed if you
- * intend to use BuildTupleFromCStrings() to create the return tuple.
+ * attinmeta is for use when returning tuples (i.e. composite data types)
+ * and is not used when returning base data types. It is only needed if
+ * you intend to use BuildTupleFromCStrings() to create the return tuple.
*/
AttInMetadata *attinmeta;
/*
* memory context used for structures that must live for multiple calls
*
- * multi_call_memory_ctx is set by SRF_FIRSTCALL_INIT() for you, and used by
- * SRF_RETURN_DONE() for cleanup. It is the most appropriate memory
+ * multi_call_memory_ctx is set by SRF_FIRSTCALL_INIT() for you, and used
+ * by SRF_RETURN_DONE() for cleanup. It is the most appropriate memory
* context for any memory that is to be reused across multiple calls of
* the SRF.
*/
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/libpq/crypt.h,v 1.32 2005/10/17 16:24:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/libpq/crypt.h,v 1.33 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* in md5.c --- these are also present in frontend libpq */
extern bool pg_md5_hash(const void *buff, size_t len, char *hexsum);
extern bool pg_md5_encrypt(const char *passwd, const char *salt,
- size_t salt_len, char *buf);
+ size_t salt_len, char *buf);
#endif
*
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/libpq/ip.h,v 1.15 2005/10/17 16:24:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/libpq/ip.h,v 1.16 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern int pg_getaddrinfo_all(const char *hostname, const char *servname,
- const struct addrinfo *hintp,
- struct addrinfo **result);
-extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai);
+ const struct addrinfo * hintp,
+ struct addrinfo ** result);
+extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai);
-extern int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen,
- char *node, int nodelen,
- char *service, int servicelen,
- int flags);
+extern int pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen,
+ char *node, int nodelen,
+ char *service, int servicelen,
+ int flags);
-extern int pg_range_sockaddr(const struct sockaddr_storage *addr,
- const struct sockaddr_storage *netaddr,
- const struct sockaddr_storage *netmask);
+extern int pg_range_sockaddr(const struct sockaddr_storage * addr,
+ const struct sockaddr_storage * netaddr,
+ const struct sockaddr_storage * netmask);
-extern int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask,
- char *numbits, int family);
+extern int pg_sockaddr_cidr_mask(struct sockaddr_storage * mask,
+ char *numbits, int family);
#ifdef HAVE_IPV6
-extern void pg_promote_v4_to_v6_addr(struct sockaddr_storage *addr);
-extern void pg_promote_v4_to_v6_mask(struct sockaddr_storage *addr);
+extern void pg_promote_v4_to_v6_addr(struct sockaddr_storage * addr);
+extern void pg_promote_v4_to_v6_mask(struct sockaddr_storage * addr);
#endif
#ifdef HAVE_UNIX_SOCKETS
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.53 2005/11/05 03:04:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.54 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* TCP keepalive settings.
*
- * default values are 0 if AF_UNIX or not yet known; current values are 0 if
- * AF_UNIX or using the default. Also, -1 in a default value means we were
- * unable to find out the default (getsockopt failed).
+ * default values are 0 if AF_UNIX or not yet known; current values are 0
+ * if AF_UNIX or using the default. Also, -1 in a default value means we
+ * were unable to find out the default (getsockopt failed).
*/
int default_keepalives_idle;
int default_keepalives_interval;
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.183 2005/10/25 15:15:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.184 2005/11/22 18:17:29 momjian Exp $
*
* NOTES
* some of the information in this file should be moved to other files.
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
-
#else /* WIN32 */
#define CHECK_FOR_INTERRUPTS() \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
-
#endif /* WIN32 */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.140 2005/11/14 17:42:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.141 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ResultRelInfo *es_result_relation_info; /* currently active array elt */
JunkFilter *es_junkFilter; /* currently active junk filter */
- TupleTableSlot *es_trig_tuple_slot; /* for trigger output tuples */
+ TupleTableSlot *es_trig_tuple_slot; /* for trigger output tuples */
Relation es_into_relation_descriptor; /* for SELECT INTO */
bool es_into_relation_use_wal;
* We also need to store argument values across calls when evaluating a
* function-returning-set.
*
- * setArgsValid is true when we are evaluating a set-valued function and we
- * are in the middle of a call series; we want to pass the same argument
- * values to the function again (and again, until it returns
+ * setArgsValid is true when we are evaluating a set-valued function and
+ * we are in the middle of a call series; we want to pass the same
+ * argument values to the function again (and again, until it returns
* ExprEndResult).
*/
bool setArgsValid;
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.177 2005/11/21 12:49:32 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.178 2005/11/22 18:17:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* TAGS FOR EXPRESSION STATE NODES (execnodes.h)
*
- * These correspond (not always one-for-one) to primitive nodes derived from
- * Expr.
+ * These correspond (not always one-for-one) to primitive nodes derived
+ * from Expr.
*/
T_ExprState = 400,
T_GenericExprState,
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.295 2005/11/22 15:24:18 adunstan Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.296 2005/11/22 18:17:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Fields valid for a join RTE (else NULL/zero):
*
- * joinaliasvars is a list of Vars or COALESCE expressions corresponding to
- * the columns of the join result. An alias Var referencing column K of
- * the join result can be replaced by the K'th element of joinaliasvars
+ * joinaliasvars is a list of Vars or COALESCE expressions corresponding
+ * to the columns of the join result. An alias Var referencing column K
+ * of the join result can be replaced by the K'th element of joinaliasvars
* --- but to simplify the task of reverse-listing aliases correctly, we
* do not do that until planning time. In a Query loaded from a stored
* rule, it is also possible for joinaliasvars items to be NULL Consts,
List *objects; /* list of sublists of names (as Values) */
ObjectType removeType; /* object type */
DropBehavior behavior; /* RESTRICT or CASCADE behavior */
- bool missing_ok; /* skip error if object is missing? */
+ bool missing_ok; /* skip error if object is missing? */
} DropStmt;
/* ----------------------
{
NodeTag type;
char *dbname; /* database to drop */
- bool missing_ok; /* skip error if db is missing? */
+ bool missing_ok; /* skip error if db is missing? */
} DropdbStmt;
/* ----------------------
} DeallocateStmt;
/*
- * DROP OWNED statement
+ * DROP OWNED statement
*/
typedef struct DropOwnedStmt
{
NodeTag type;
List *roles;
DropBehavior behavior;
-} DropOwnedStmt;
+} DropOwnedStmt;
/*
- * REASSIGN OWNED statement
+ * REASSIGN OWNED statement
*/
typedef struct ReassignOwnedStmt
{
NodeTag type;
List *roles;
char *newrole;
-} ReassignOwnedStmt;
+} ReassignOwnedStmt;
#endif /* PARSENODES_H */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.80 2005/10/15 02:49:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.81 2005/11/22 18:17:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Information for management of parameter-change-driven rescanning
*
- * extParam includes the paramIDs of all external PARAM_EXEC params affecting
- * this plan node or its children. setParam params from the node's
- * initPlans are not included, but their extParams are.
+ * extParam includes the paramIDs of all external PARAM_EXEC params
+ * affecting this plan node or its children. setParam params from the
+ * node's initPlans are not included, but their extParams are.
*
- * allParam includes all the extParam paramIDs, plus the IDs of local params
- * that affect the node (i.e., the setParams of its initplans). These are
- * _all_ the PARAM_EXEC params that affect this node.
+ * allParam includes all the extParam paramIDs, plus the IDs of local
+ * params that affect the node (i.e., the setParams of its initplans).
+ * These are _all_ the PARAM_EXEC params that affect this node.
*/
Bitmapset *extParam;
Bitmapset *allParam;
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.82 2005/11/17 17:42:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.83 2005/11/22 18:17:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bool *foundPtr);
extern void WriteLocalBuffer(Buffer buffer, bool release);
extern void DropRelFileNodeLocalBuffers(RelFileNode rnode,
- BlockNumber firstDelBlock);
+ BlockNumber firstDelBlock);
extern void AtEOXact_LocalBuffers(bool isCommit);
#endif /* BUFMGR_INTERNALS_H */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.48 2005/11/03 17:11:40 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.49 2005/11/22 18:17:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
typedef enum
{
- DestNone, /* results are discarded */
- DestDebug, /* results go to debugging output */
- DestRemote, /* results sent to frontend process */
- DestRemoteExecute, /* sent to frontend, in Execute command */
- DestSPI, /* results sent to SPI manager */
- DestTuplestore /* results sent to Tuplestore */
+ DestNone, /* results are discarded */
+ DestDebug, /* results go to debugging output */
+ DestRemote, /* results sent to frontend process */
+ DestRemoteExecute, /* sent to frontend, in Execute command */
+ DestSPI, /* results sent to SPI manager */
+ DestTuplestore /* results sent to Tuplestore */
} CommandDest;
/* ----------------
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.89 2005/11/21 12:49:33 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.90 2005/11/22 18:17:31 momjian Exp $
*
* NOTES
* An ACL array is simply an array of AclItems, representing the union
/*
* Definitions for convenient access to Acl (array of AclItem).
* These are standard PostgreSQL arrays, but are restricted to have one
- * dimension and no nulls. We also ignore the lower bound when reading,
+ * dimension and no nulls. We also ignore the lower bound when reading,
* and set it to one when writing.
*
* CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all
* <elemtype> - element type OID
* <dimensions> - length of each array axis (C array of int)
* <lower bnds> - lower boundary of each dimension (C array of int)
- * <null bitmap> - bitmap showing locations of nulls (OPTIONAL)
+ * <null bitmap> - bitmap showing locations of nulls (OPTIONAL)
* <actual data> - whatever is the stored data
*
* The <dimensions> and <lower bnds> arrays each have ndim elements.
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/array.h,v 1.56 2005/11/17 22:14:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/array.h,v 1.57 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ArrayMapState *amstate);
extern void array_bitmap_copy(bits8 *destbitmap, int destoffset,
- const bits8 *srcbitmap, int srcoffset,
- int nitems);
+ const bits8 *srcbitmap, int srcoffset,
+ int nitems);
extern ArrayType *construct_array(Datum *elems, int nelems,
Oid elmtype,
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.267 2005/10/18 20:38:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.268 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List **namelist);
extern Datum replace_text(PG_FUNCTION_ARGS);
extern text *replace_text_regexp(text *src_text, void *regexp,
- text *replace_text, bool glob);
+ text *replace_text, bool glob);
extern Datum split_text(PG_FUNCTION_ARGS);
extern Datum text_to_array(PG_FUNCTION_ARGS);
extern Datum array_to_text(PG_FUNCTION_ARGS);
extern Datum numeric_out(PG_FUNCTION_ARGS);
extern Datum numeric_recv(PG_FUNCTION_ARGS);
extern Datum numeric_send(PG_FUNCTION_ARGS);
-extern Datum numeric(PG_FUNCTION_ARGS);
+extern Datum numeric (PG_FUNCTION_ARGS);
extern Datum numeric_abs(PG_FUNCTION_ARGS);
extern Datum numeric_uminus(PG_FUNCTION_ARGS);
extern Datum numeric_uplus(PG_FUNCTION_ARGS);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.56 2005/10/15 02:49:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.57 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* refcount must go to zero, too; also, remember to mark the list dead at
* the same time the tuple is marked.)
*
- * A negative cache entry is an assertion that there is no tuple matching a
- * particular key. This is just as useful as a normal entry so far as
+ * A negative cache entry is an assertion that there is no tuple matching
+ * a particular key. This is just as useful as a normal entry so far as
* avoiding catalog searches is concerned. Management of positive and
* negative entries is identical.
*/
* table rows satisfying the partial key. (Note: none of these will be
* negative cache entries.)
*
- * A CatCList is only a member of a per-cache list; we do not do separate LRU
- * management for CatCLists. See CatalogCacheCleanup() for the details of
- * the management algorithm.
+ * A CatCList is only a member of a per-cache list; we do not do separate
+ * LRU management for CatCLists. See CatalogCacheCleanup() for the
+ * details of the management algorithm.
*
- * A list marked "dead" must not be returned by subsequent searches. However,
- * it won't be physically deleted from the cache until its refcount goes
- * to zero. (A list should be marked dead if any of its member entries
- * are dead.)
+ * A list marked "dead" must not be returned by subsequent searches.
+ * However, it won't be physically deleted from the cache until its
+ * refcount goes to zero. (A list should be marked dead if any of its
+ * member entries are dead.)
*
* If "ordered" is true then the member tuples appear in the order of the
* cache's underlying index. This will be true in normal operation, but
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.8 2005/10/15 02:49:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.9 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Information obtained from opclass entries
*
- * These will be InvalidOid if no match could be found, or if the information
- * hasn't yet been requested.
+ * These will be InvalidOid if no match could be found, or if the
+ * information hasn't yet been requested.
*/
Oid btree_opc; /* OID of the default btree opclass */
Oid hash_opc; /* OID of the default hash opclass */
char *ECPGalloc(long, int);
static int
-deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *))
+deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *))
{
numeric *a1,
*a2;
}
static int
-deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric *, numeric *, numeric *))
+deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, numeric *, numeric *))
{
numeric *a1,
*a2,
/* we start with the numeric functions */
int
-decadd(decimal * arg1, decimal * arg2, decimal * sum)
+decadd(decimal *arg1, decimal *arg2, decimal *sum)
{
deccall3(arg1, arg2, sum, PGTYPESnumeric_add);
}
int
-deccmp(decimal * arg1, decimal * arg2)
+deccmp(decimal *arg1, decimal *arg2)
{
return (deccall2(arg1, arg2, PGTYPESnumeric_cmp));
}
void
-deccopy(decimal * src, decimal * target)
+deccopy(decimal *src, decimal *target)
{
memcpy(target, src, sizeof(decimal));
}
}
int
-deccvasc(char *cp, int len, decimal * np)
+deccvasc(char *cp, int len, decimal *np)
{
char *str = ecpg_strndup(cp, len); /* decimal_in always converts
* the complete string */
}
int
-deccvdbl(double dbl, decimal * np)
+deccvdbl(double dbl, decimal *np)
{
numeric *nres = PGTYPESnumeric_new();
int result = 1;
}
int
-deccvint(int in, decimal * np)
+deccvint(int in, decimal *np)
{
numeric *nres = PGTYPESnumeric_new();
int result = 1;
}
int
-deccvlong(long lng, decimal * np)
+deccvlong(long lng, decimal *np)
{
numeric *nres = PGTYPESnumeric_new();
int result = 1;
}
int
-decdiv(decimal * n1, decimal * n2, decimal * result)
+decdiv(decimal *n1, decimal *n2, decimal *result)
{
int i;
}
int
-decmul(decimal * n1, decimal * n2, decimal * result)
+decmul(decimal *n1, decimal *n2, decimal *result)
{
int i;
}
int
-decsub(decimal * n1, decimal * n2, decimal * result)
+decsub(decimal *n1, decimal *n2, decimal *result)
{
int i;
}
int
-dectoasc(decimal * np, char *cp, int len, int right)
+dectoasc(decimal *np, char *cp, int len, int right)
{
char *str;
numeric *nres = PGTYPESnumeric_new();
}
int
-dectodbl(decimal * np, double *dblp)
+dectodbl(decimal *np, double *dblp)
{
numeric *nres = PGTYPESnumeric_new();
int i;
}
int
-dectoint(decimal * np, int *ip)
+dectoint(decimal *np, int *ip)
{
int ret;
numeric *nres = PGTYPESnumeric_new();
}
int
-dectolong(decimal * np, long *lngp)
+dectolong(decimal *np, long *lngp)
{
int ret;
numeric *nres = PGTYPESnumeric_new();;
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
NumericDigit *buf; /* start of alloc'd space for digits[] */
NumericDigit *digits; /* decimal digits */
-} numeric;
+} numeric;
typedef struct
{
int dscale; /* display scale */
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
NumericDigit digits[DECSIZE]; /* decimal digits */
-} decimal;
+} decimal;
#ifdef __cplusplus
extern "C"
{
#endif
- numeric * PGTYPESnumeric_new(void);
+numeric *PGTYPESnumeric_new(void);
void PGTYPESnumeric_free(numeric *);
numeric *PGTYPESnumeric_from_asc(char *, char **);
char *PGTYPESnumeric_to_asc(numeric *, int);
* here we found a month. token[token_count] and
* token_values[token_count] reflect the month's details.
*
- * only the month can be specified with a literal. Here we can do a quick
- * check if the month is at the right position according to the format
- * string because we can check if the token that we expect to be the
- * month is at the position of the only token that already has a
- * value. If we wouldn't check here we could say "December 4 1990"
+ * only the month can be specified with a literal. Here we can do a
+ * quick check if the month is at the right position according to the
+ * format string because we can check if the token that we expect to
+ * be the month is at the position of the only token that already has
+ * a value. If we wouldn't check here we could say "December 4 1990"
* with a fmt string of "dd mm yy" for 12 April 1990.
*/
if (fmt_token_order[token_count] != 'm')
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
* localtime() call and delta calculation. We may have to do it
* twice before we have a trustworthy delta.
*
- * Note: think not to put a loop here, since if we've been given an
- * "impossible" local time (in the gap during a spring-forward
+ * Note: think not to put a loop here, since if we've been given
+ * an "impossible" local time (in the gap during a spring-forward
* transition) we'd never get out of the loop. Twice is enough to
* give the behavior we want, which is that "impossible" times are
* taken as standard time, while at a fall-back boundary ambiguous
* functions gets called as find_end_token("28the day12the hour", "the
* day%hthehour")
*
- * fmt points to "the day%hthehour", next_percent points to %hthehour and we
- * have to find a match for everything between these positions ("the
+ * fmt points to "the day%hthehour", next_percent points to %hthehour and
+ * we have to find a match for everything between these positions ("the
* day"). We look for "the day" in str and know that the pattern we are
* about to scan ends where this string starts (right after the "28")
*
- * At the end, *fmt is '\0' and *str isn't. end_position then is unchanged.
+ * At the end, *fmt is '\0' and *str isn't. end_position then is
+ * unchanged.
*/
char *end_position = NULL;
char *next_percent,
*
* and have set fmt to " " because overwrote the % sign with a NULL
*
- * In this case where we would have to match a space but can't find it,
- * set end_position to the end of the string
+ * In this case where we would have to match a space but can't find
+ * it, set end_position to the end of the string
*/
if ((fmt + scan_offset)[0] == ' ' && fmt + scan_offset + 1 == subst_location)
end_position = str + strlen(str);
* ----------
*/
static int
-apply_typmod(numeric * var, long typmod)
+apply_typmod(numeric *var, long typmod)
{
int precision;
int scale;
* ----------
*/
static int
-alloc_var(numeric * var, int ndigits)
+alloc_var(numeric *var, int ndigits)
{
digitbuf_free(var->buf);
var->buf = digitbuf_alloc(ndigits + 1);
* ----------
*/
static int
-set_var_from_str(char *str, char **ptr, numeric * dest)
+set_var_from_str(char *str, char **ptr, numeric *dest)
{
bool have_dp = FALSE;
int i = 0;
* ----------
*/
static char *
-get_str_from_var(numeric * var, int dscale)
+get_str_from_var(numeric *var, int dscale)
{
char *str;
char *cp;
}
char *
-PGTYPESnumeric_to_asc(numeric * num, int dscale)
+PGTYPESnumeric_to_asc(numeric *num, int dscale)
{
if (dscale < 0)
dscale = num->dscale;
* ----------
*/
static void
-zero_var(numeric * var)
+zero_var(numeric *var)
{
digitbuf_free(var->buf);
var->buf = NULL;
}
void
-PGTYPESnumeric_free(numeric * var)
+PGTYPESnumeric_free(numeric *var)
{
digitbuf_free(var->buf);
free(var);
* ----------
*/
static int
-cmp_abs(numeric * var1, numeric * var2)
+cmp_abs(numeric *var1, numeric *var2)
{
int i1 = 0;
int i2 = 0;
* ----------
*/
static int
-add_abs(numeric * var1, numeric * var2, numeric * result)
+add_abs(numeric *var1, numeric *var2, numeric *result)
{
NumericDigit *res_buf;
NumericDigit *res_digits;
* ----------
*/
static int
-sub_abs(numeric * var1, numeric * var2, numeric * result)
+sub_abs(numeric *var1, numeric *var2, numeric *result)
{
NumericDigit *res_buf;
NumericDigit *res_digits;
* ----------
*/
int
-PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result)
+PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result)
{
/*
* Decide on the signs of the two variables what to do
* ----------
*/
int
-PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result)
+PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result)
{
/*
* Decide on the signs of the two variables what to do
* ----------
*/
int
-PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result)
+PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result)
{
NumericDigit *res_buf;
NumericDigit *res_digits;
* Note that this must be called before div_var.
*/
static int
-select_div_scale(numeric * var1, numeric * var2, int *rscale)
+select_div_scale(numeric *var1, numeric *var2, int *rscale)
{
int weight1,
weight2,
}
int
-PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result)
+PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result)
{
NumericDigit *res_digits;
int res_ndigits;
int
-PGTYPESnumeric_cmp(numeric * var1, numeric * var2)
+PGTYPESnumeric_cmp(numeric *var1, numeric *var2)
{
/* use cmp_abs function to calculate the result */
}
int
-PGTYPESnumeric_from_int(signed int int_val, numeric * var)
+PGTYPESnumeric_from_int(signed int int_val, numeric *var)
{
/* implicit conversion */
signed long int long_int = int_val;
}
int
-PGTYPESnumeric_from_long(signed long int long_val, numeric * var)
+PGTYPESnumeric_from_long(signed long int long_val, numeric *var)
{
/* calculate the size of the long int number */
/* a number n needs log_10 n digits */
}
int
-PGTYPESnumeric_copy(numeric * src, numeric * dst)
+PGTYPESnumeric_copy(numeric *src, numeric *dst)
{
int i;
}
int
-PGTYPESnumeric_from_double(double d, numeric * dst)
+PGTYPESnumeric_from_double(double d, numeric *dst)
{
char buffer[100];
numeric *tmp;
}
static int
-numericvar_to_double_no_overflow(numeric * var, double *dp)
+numericvar_to_double_no_overflow(numeric *var, double *dp)
{
char *tmp;
double val;
}
int
-PGTYPESnumeric_to_double(numeric * nv, double *dp)
+PGTYPESnumeric_to_double(numeric *nv, double *dp)
{
double tmp;
int i;
}
int
-PGTYPESnumeric_to_int(numeric * nv, int *ip)
+PGTYPESnumeric_to_int(numeric *nv, int *ip)
{
long l;
int i;
}
int
-PGTYPESnumeric_to_long(numeric * nv, long *lp)
+PGTYPESnumeric_to_long(numeric *nv, long *lp)
{
int i;
long l = 0;
}
int
-PGTYPESnumeric_to_decimal(numeric * src, decimal * dst)
+PGTYPESnumeric_to_decimal(numeric *src, decimal *dst)
{
int i;
}
int
-PGTYPESnumeric_from_decimal(decimal * src, numeric * dst)
+PGTYPESnumeric_from_decimal(decimal *src, numeric *dst)
{
int i;
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.107 2005/10/24 15:38:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.108 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
return ret;
}
-
#endif /* KRB5 */
#endif
/*
- * pglock_thread() really only needs to be called around
- * pg_krb5_authname(), but some users are using configure
- * --enable-thread-safety-force, so we might as well do
- * the locking within our library to protect pqGetpwuid().
- * In fact, application developers can use getpwuid()
- * in their application if they use the locking call we
- * provide, or install their own locking function using
- * PQregisterThreadLock().
+ * pglock_thread() really only needs to be called around
+ * pg_krb5_authname(), but some users are using configure
+ * --enable-thread-safety-force, so we might as well do the locking within
+ * our library to protect pqGetpwuid(). In fact, application developers
+ * can use getpwuid() in their application if they use the locking call we
+ * provide, or install their own locking function using
+ * PQregisterThreadLock().
*/
pglock_thread();
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.h,v 1.23 2005/10/17 16:24:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.h,v 1.24 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern int pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
- const char *password, char *PQerrormsg);
+ const char *password, char *PQerrormsg);
extern char *pg_fe_getauthname(char *PQerrormsg);
#endif /* FE_AUTH_H */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.323 2005/10/17 16:24:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.324 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Move option values into conn structure
*
- * Don't put anything cute here --- intelligence should be in connectOptions2
- * ...
+ * Don't put anything cute here --- intelligence should be in
+ * connectOptions2 ...
*
* XXX: probably worth checking strdup() return value here...
*/
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not connect to server: %s\n"
"\tIs the server running locally and accepting\n"
- "\tconnections on Unix domain socket \"%s\"?\n"),
+ "\tconnections on Unix domain socket \"%s\"?\n"),
SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)),
service);
}
/*
* Try to initiate a connection to one of the addresses
* returned by pg_getaddrinfo_all(). conn->addr_cur is the
- * next one to try. We fail when we run out of addresses
+ * next one to try. We fail when we run out of addresses
* (reporting the error returned for the *last* alternative,
* which may not be what users expect :-().
*/
/*
* Send the SSL request packet.
*
- * Theoretically, this could block, but it really shouldn't
- * since we only got here if the socket is write-ready.
+ * Theoretically, this could block, but it really
+ * shouldn't since we only got here if the socket is
+ * write-ready.
*/
pv = htonl(NEGOTIATE_SSL_CODE);
if (pqPacketSend(conn, 0, &pv, sizeof(pv)) != STATUS_OK)
/*
* Send the startup packet.
*
- * Theoretically, this could block, but it really shouldn't since
- * we only got here if the socket is write-ready.
+ * Theoretically, this could block, but it really shouldn't
+ * since we only got here if the socket is write-ready.
*/
if (pqPacketSend(conn, 0, startpacket, packetlen) != STATUS_OK)
{
/*
* Can't process if message body isn't all here yet.
*
- * (In protocol 2.0 case, we are assuming messages carry at least
- * 4 bytes of data.)
+ * (In protocol 2.0 case, we are assuming messages carry at
+ * least 4 bytes of data.)
*/
msgLength -= 4;
avail = conn->inEnd - conn->inCursor;
* bufferloads. The output buffer is initially made 16K in size, and we
* try to dump it after accumulating 8K.
*
- * With the same goal of minimizing context swaps, the input buffer will be
- * enlarged anytime it has less than 8K free, so we initially allocate
+ * With the same goal of minimizing context swaps, the input buffer will
+ * be enlarged anytime it has less than 8K free, so we initially allocate
* twice that.
*/
conn->inBufSize = 16 * 1024;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.176 2005/10/15 02:49:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.177 2005/11/22 18:17:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* a trailing newline, and should not be more than one line).
*/
void
-pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
+pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
{
char msgBuf[1024];
va_list args;
* Returns TRUE if OK, FALSE if not enough memory to add the row
*/
int
-pqAddTuple(PGresult *res, PGresAttValue * tup)
+pqAddTuple(PGresult *res, PGresAttValue *tup)
{
if (res->ntups >= res->tupArrSize)
{
/*
* Try to grow the array.
*
- * We can use realloc because shallow copying of the structure is okay.
- * Note that the first time through, res->tuples is NULL. While ANSI
- * says that realloc() should act like malloc() in that case, some old
- * C libraries (like SunOS 4.1.x) coredump instead. On failure realloc
- * is supposed to return NULL without damaging the existing
- * allocation. Note that the positions beyond res->ntups are garbage,
- * not necessarily NULL.
+ * We can use realloc because shallow copying of the structure is
+ * okay. Note that the first time through, res->tuples is NULL. While
+ * ANSI says that realloc() should act like malloc() in that case,
+ * some old C libraries (like SunOS 4.1.x) coredump instead. On
+ * failure realloc is supposed to return NULL without damaging the
+ * existing allocation. Note that the positions beyond res->ntups are
+ * garbage, not necessarily NULL.
*/
int newSize = (res->tupArrSize > 0) ? res->tupArrSize * 2 : 128;
PGresAttValue **newTuples;
* Store new info as a single malloc block
*/
pstatus = (pgParameterStatus *) malloc(sizeof(pgParameterStatus) +
- strlen(name) + strlen(value) + 2);
+ strlen(name) +strlen(value) + 2);
if (pstatus)
{
char *ptr;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.122 2005/10/15 02:49:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.123 2005/11/22 18:17:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* If the buffer is fairly full, enlarge it. We need to be able to enlarge
- * the buffer in case a single message exceeds the initial buffer size.
- * We enlarge before filling the buffer entirely so as to avoid asking the
+ * the buffer in case a single message exceeds the initial buffer size. We
+ * enlarge before filling the buffer entirely so as to avoid asking the
* kernel for a partial packet. The magic constant here should be large
* enough for a TCP packet or Unix pipe bufferload. 8K is the usual pipe
* buffer size, so...
* buffer space. Without this, the block-and-restart behavior of
* libpq's higher levels leads to O(N^2) performance on long messages.
*
- * Since we left-justified the data above, conn->inEnd gives the amount
- * of data already read in the current message. We consider the
- * message "long" once we have acquired 32k ...
+ * Since we left-justified the data above, conn->inEnd gives the
+ * amount of data already read in the current message. We consider
+ * the message "long" once we have acquired 32k ...
*/
if (conn->inEnd > 32768 &&
(conn->inBufSize - conn->inEnd) >= 8192)
* since in normal practice we should not be trying to read data unless
* the file selected for reading already.
*
- * In SSL mode it's even worse: SSL_read() could say WANT_READ and then data
- * could arrive before we make the pqReadReady() test. So we must play
- * dumb and assume there is more data, relying on the SSL layer to detect
- * true EOF.
+ * In SSL mode it's even worse: SSL_read() could say WANT_READ and then
+ * data could arrive before we make the pqReadReady() test. So we must
+ * play dumb and assume there is more data, relying on the SSL layer to
+ * detect true EOF.
*/
#ifdef USE_SSL
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.19 2005/10/15 02:49:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.20 2005/11/22 18:17:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* NOTIFY and NOTICE messages can happen in any state besides COPY
* OUT; always process them right away.
*
- * Most other messages should only be processed while in BUSY state. (In
- * particular, in READY state we hold off further parsing until the
- * application collects the current PGresult.)
+ * Most other messages should only be processed while in BUSY state.
+ * (In particular, in READY state we hold off further parsing until
+ * the application collects the current PGresult.)
*
* However, if the state is IDLE then we got trouble; we need to deal
* with the unexpected message somehow.
*/
char *
pqBuildStartupPacket2(PGconn *conn, int *packetlen,
- const PQEnvironmentOption * options)
+ const PQEnvironmentOption *options)
{
StartupPacket *startpacket;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.22 2005/10/15 02:49:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.23 2005/11/22 18:17:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static int getCopyStart(PGconn *conn, ExecStatusType copytype);
static int getReadyForQuery(PGconn *conn);
static int build_startup_packet(const PGconn *conn, char *packet,
- const PQEnvironmentOption * options);
+ const PQEnvironmentOption *options);
/*
* NOTIFY and NOTICE messages can happen in any state; always process
* them right away.
*
- * Most other messages should only be processed while in BUSY state. (In
- * particular, in READY state we hold off further parsing until the
- * application collects the current PGresult.)
+ * Most other messages should only be processed while in BUSY state.
+ * (In particular, in READY state we hold off further parsing until
+ * the application collects the current PGresult.)
*
* However, if the state is IDLE then we got trouble; we need to deal
* with the unexpected message somehow.
*/
char *
pqBuildStartupPacket3(PGconn *conn, int *packetlen,
- const PQEnvironmentOption * options)
+ const PQEnvironmentOption *options)
{
char *startpacket;
*/
static int
build_startup_packet(const PGconn *conn, char *packet,
- const PQEnvironmentOption * options)
+ const PQEnvironmentOption *options)
{
int packet_len = 0;
const PQEnvironmentOption *next_eo;
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.120 2005/10/15 02:49:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.121 2005/11/22 18:17:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Application-visible enum types */
-typedef enum
+ typedef enum
{
/*
* Although it is okay to add to this list, values which become unused
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.108 2005/10/15 02:49:49 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.109 2005/11/22 18:17:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Oid typid; /* type id */
int typlen; /* type size */
int atttypmod; /* type-specific modifier info */
-} PGresAttDesc;
+} PGresAttDesc;
/*
* Data for a single attribute of a single tuple
{
int len; /* length in bytes of the value */
char *value; /* actual value, plus terminating zero byte */
-} PGresAttValue;
+} PGresAttValue;
/* Typedef for message-field list entries */
typedef struct pgMessageField
struct pgMessageField *next; /* list link */
char code; /* field code */
char contents[1]; /* field value (VARIABLE LENGTH) */
-} PGMessageField;
+} PGMessageField;
/* Fields needed for notice handling */
typedef struct
void *noticeRecArg;
PQnoticeProcessor noticeProc; /* notice message processor */
void *noticeProcArg;
-} PGNoticeHooks;
+} PGNoticeHooks;
struct pg_result
{
PGASYNC_READY, /* result ready for PQgetResult */
PGASYNC_COPY_IN, /* Copy In data transfer in progress */
PGASYNC_COPY_OUT /* Copy Out data transfer in progress */
-} PGAsyncStatusType;
+} PGAsyncStatusType;
/* PGQueryClass tracks which query protocol we are now executing */
typedef enum
PGQUERY_SIMPLE, /* simple Query protocol (PQexec) */
PGQUERY_EXTENDED, /* full Extended protocol (PQexecParams) */
PGQUERY_PREPARE /* Parse only (PQprepare) */
-} PGQueryClass;
+} PGQueryClass;
/* PGSetenvStatusType defines the state of the PQSetenv state machine */
/* (this is used only for 2.0-protocol connections) */
SETENV_STATE_QUERY2_SEND, /* About to send a status query */
SETENV_STATE_QUERY2_WAIT, /* Waiting for query to complete */
SETENV_STATE_IDLE
-} PGSetenvStatusType;
+} PGSetenvStatusType;
/* Typedef for the EnvironmentOptions[] array */
typedef struct PQEnvironmentOption
{
const char *envName, /* name of an environment variable */
*pgName; /* name of corresponding SET variable */
-} PQEnvironmentOption;
+} PQEnvironmentOption;
/* Typedef for parameter-status list entries */
typedef struct pgParameterStatus
char *name; /* parameter name */
char *value; /* parameter value */
/* Note: name and value are stored in same malloc block as struct is */
-} pgParameterStatus;
+} pgParameterStatus;
/* large-object-access data ... allocated only if large-object code is used. */
typedef struct pgLobjfuncs
Oid fn_lo_tell; /* OID of backend function lo_tell */
Oid fn_lo_read; /* OID of backend function LOread */
Oid fn_lo_write; /* OID of backend function LOwrite */
-} PGlobjfuncs;
+} PGlobjfuncs;
/*
* PGconn stores all the state data associated with a single connection
extern void pqSaveErrorResult(PGconn *conn);
extern PGresult *pqPrepareAsyncResult(PGconn *conn);
extern void
-pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
+pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
/* This lets gcc check the format string for consistency. */
__attribute__((format(printf, 2, 3)));
-extern int pqAddTuple(PGresult *res, PGresAttValue * tup);
+extern int pqAddTuple(PGresult *res, PGresAttValue *tup);
extern void pqSaveMessageField(PGresult *res, char code,
const char *value);
extern void pqSaveParameterStatus(PGconn *conn, const char *name,
extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn);
extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen,
- const PQEnvironmentOption * options);
+ const PQEnvironmentOption *options);
extern void pqParseInput2(PGconn *conn);
extern int pqGetCopyData2(PGconn *conn, char **buffer, int async);
extern int pqGetline2(PGconn *conn, char *s, int maxlen);
/* === in fe-protocol3.c === */
extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen,
- const PQEnvironmentOption * options);
+ const PQEnvironmentOption *options);
extern void pqParseInput3(PGconn *conn);
extern int pqGetErrorNotice3(PGconn *conn, bool isError);
extern int pqGetCopyData3(PGconn *conn, char **buffer, int async);
void pthread_mutex_init(pthread_mutex_t *, void *attr);
void pthread_mutex_lock(pthread_mutex_t *);
-//blocking
+/* blocking */
void pthread_mutex_unlock(pthread_mutex_t *);
#endif
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.95 2005/11/18 17:00:28 adunstan Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.96 2005/11/22 18:17:33 momjian Exp $
*
**********************************************************************/
FmgrInfo arg_out_func[FUNC_MAX_ARGS];
bool arg_is_rowtype[FUNC_MAX_ARGS];
SV *reference;
-} plperl_proc_desc;
+} plperl_proc_desc;
/**********************************************************************
/* Build a tuple from a hash. */
static HeapTuple
-plperl_build_tuple_result(HV * perlhash, AttInMetadata *attinmeta)
+plperl_build_tuple_result(HV *perlhash, AttInMetadata *attinmeta)
{
TupleDesc td = attinmeta->tupdesc;
char **values;
* convert perl array to postgres string representation
*/
static SV *
-plperl_convert_to_pg_array(SV * src)
+plperl_convert_to_pg_array(SV *src)
{
SV *rv;
int count;
/* Set up the new tuple returned from a trigger. */
static HeapTuple
-plperl_modify_tuple(HV * hvTD, TriggerData *tdata, HeapTuple otup)
+plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup)
{
SV **svp;
HV *hvNew;
*
**********************************************************************/
-EXTERN_C void boot_DynaLoader(pTHX_ CV * cv);
-EXTERN_C void boot_SPI(pTHX_ CV * cv);
+EXTERN_C void boot_DynaLoader(pTHX_ CV *cv);
+EXTERN_C void boot_SPI(pTHX_ CV *cv);
static void
plperl_init_shared_libs(pTHX)
static SV *
-plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
+plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo)
{
dSP;
SV *retval;
static SV *
-plperl_call_perl_trigger_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo,
- SV * td)
+plperl_call_perl_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo,
+ SV *td)
{
dSP;
SV *retval;
/*
* Note: plperl_return_next is called both in Postgres and Perl contexts.
- * We report any errors in Postgres fashion (via ereport). If called in
+ * We report any errors in Postgres fashion (via ereport). If called in
* Perl context, it is SPI.xs's responsibility to catch the error and
* convert to a Perl error. We assume (perhaps without adequate justification)
* that we need not abort the current transaction if the Perl code traps the
#else
#if defined(USE_THREADS)
static SV *
-newRV_noinc(SV * sv)
+newRV_noinc(SV *sv)
{
SV *nsv = (SV *) newRV(sv);
#if defined(NEED_newCONSTSUB)
static
#else
-extern void newCONSTSUB(HV * stash, char *name, SV * sv);
+extern void newCONSTSUB(HV *stash, char *name, SV *sv);
#endif
#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
static char *
-my_sv_2pvbyte(pTHX_ register SV * sv, STRLEN * lp)
+my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
{
sv_utf8_downgrade(sv, 0);
return SvPV(sv, *lp);
((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
? SvPVX(sv) : sv_2pv_nolen(sv))
static char *
-sv_2pv_nolen(pTHX_ register SV * sv)
+sv_2pv_nolen(pTHX_ register SV *sv)
{
STRLEN n_a;
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.95 2005/11/17 22:14:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.96 2005/11/22 18:17:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
{
PLpgSQL_func_hashkey key;
PLpgSQL_function *function;
-} plpgsql_HashEnt;
+} plpgsql_HashEnt;
#define FUNCS_PER_USER 128 /* initial table size */
{
const char *label;
int sqlerrstate;
-} ExceptionLabelMap;
+} ExceptionLabelMap;
static const ExceptionLabelMap exception_label_map[] = {
#include "plerrcodes.h"
*/
static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
HeapTuple procTup,
- PLpgSQL_func_hashkey * hashkey,
+ PLpgSQL_func_hashkey *hashkey,
bool forValidator);
static int fetchArgInfo(HeapTuple procTup,
Oid **p_argtypes, char ***p_argnames,
char **p_argmodes);
static PLpgSQL_row *build_row_from_class(Oid classOid);
-static PLpgSQL_row *build_row_from_vars(PLpgSQL_variable ** vars, int numvars);
+static PLpgSQL_row *build_row_from_vars(PLpgSQL_variable **vars, int numvars);
static PLpgSQL_type *build_datatype(HeapTuple typeTup, int32 typmod);
static void compute_function_hashkey(FunctionCallInfo fcinfo,
Form_pg_proc procStruct,
- PLpgSQL_func_hashkey * hashkey,
+ PLpgSQL_func_hashkey *hashkey,
bool forValidator);
static void plpgsql_resolve_polymorphic_argtypes(int numargs,
Oid *argtypes, char *argmodes,
Node *call_expr, bool forValidator,
const char *proname);
-static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key);
-static void plpgsql_HashTableInsert(PLpgSQL_function * function,
- PLpgSQL_func_hashkey * func_key);
-static void plpgsql_HashTableDelete(PLpgSQL_function * function);
-static void delete_function(PLpgSQL_function * func);
+static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key);
+static void plpgsql_HashTableInsert(PLpgSQL_function *function,
+ PLpgSQL_func_hashkey *func_key);
+static void plpgsql_HashTableDelete(PLpgSQL_function *function);
+static void delete_function(PLpgSQL_function *func);
/* ----------
* plpgsql_compile Make an execution tree for a PL/pgSQL function.
static PLpgSQL_function *
do_compile(FunctionCallInfo fcinfo,
HeapTuple procTup,
- PLpgSQL_func_hashkey * hashkey,
+ PLpgSQL_func_hashkey *hashkey,
bool forValidator)
{
Form_pg_proc procStruct = (Form_pg_proc) GETSTRUCT(procTup);
* Fetch info about the procedure's parameters. Allocations aren't
* needed permanently, so make them in tmp cxt.
*
- * We also need to resolve any polymorphic input or output argument
- * types. In validation mode we won't be able to, so we
+ * We also need to resolve any polymorphic input or output
+ * argument types. In validation mode we won't be able to, so we
* arbitrarily assume we are dealing with integers.
*/
MemoryContextSwitchTo(compile_tmp_cxt);
* array, and optionally to the current namespace.
*/
PLpgSQL_variable *
-plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type * dtype,
+plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype,
bool add2namespace)
{
PLpgSQL_variable *result;
/*
* Create the internal variable for the field
*
- * We know if the table definitions contain a default value or if the
- * field is declared in the table as NOT NULL. But it's possible
- * to create a table field as NOT NULL without a default value and
- * that would lead to problems later when initializing the
- * variables due to entering a block at execution time. Thus we
- * ignore this information for now.
+ * We know if the table definitions contain a default value or if
+ * the field is declared in the table as NOT NULL. But it's
+ * possible to create a table field as NOT NULL without a default
+ * value and that would lead to problems later when initializing
+ * the variables due to entering a block at execution time. Thus
+ * we ignore this information for now.
*/
var = plpgsql_build_variable(refname, 0,
plpgsql_build_datatype(attrStruct->atttypid,
* Build a row-variable data structure given the component variables.
*/
static PLpgSQL_row *
-build_row_from_vars(PLpgSQL_variable ** vars, int numvars)
+build_row_from_vars(PLpgSQL_variable **vars, int numvars)
{
PLpgSQL_row *row;
int i;
* ----------
*/
void
-plpgsql_adddatum(PLpgSQL_datum * new)
+plpgsql_adddatum(PLpgSQL_datum *new)
{
if (plpgsql_nDatums == datums_alloc)
{
static void
compute_function_hashkey(FunctionCallInfo fcinfo,
Form_pg_proc procStruct,
- PLpgSQL_func_hashkey * hashkey,
+ PLpgSQL_func_hashkey *hashkey,
bool forValidator)
{
/* Make sure any unused bytes of the struct are zero */
}
static void
-delete_function(PLpgSQL_function * func)
+delete_function(PLpgSQL_function *func)
{
/* remove function from hash table */
plpgsql_HashTableDelete(func);
}
static PLpgSQL_function *
-plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key)
+plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key)
{
plpgsql_HashEnt *hentry;
}
static void
-plpgsql_HashTableInsert(PLpgSQL_function * function,
- PLpgSQL_func_hashkey * func_key)
+plpgsql_HashTableInsert(PLpgSQL_function *function,
+ PLpgSQL_func_hashkey *func_key)
{
plpgsql_HashEnt *hentry;
bool found;
}
static void
-plpgsql_HashTableDelete(PLpgSQL_function * function)
+plpgsql_HashTableDelete(PLpgSQL_function *function)
{
plpgsql_HashEnt *hentry;
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.156 2005/11/18 02:38:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.157 2005/11/22 18:17:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
* Local function forward declarations
************************************************************/
static void plpgsql_exec_error_callback(void *arg);
-static PLpgSQL_datum *copy_plpgsql_datum(PLpgSQL_datum * datum);
+static PLpgSQL_datum *copy_plpgsql_datum(PLpgSQL_datum *datum);
-static int exec_stmt_block(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_block * block);
-static int exec_stmts(PLpgSQL_execstate * estate,
+static int exec_stmt_block(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_block *block);
+static int exec_stmts(PLpgSQL_execstate *estate,
List *stmts);
-static int exec_stmt(PLpgSQL_execstate * estate,
- PLpgSQL_stmt * stmt);
-static int exec_stmt_assign(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_assign * stmt);
-static int exec_stmt_perform(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_perform * stmt);
-static int exec_stmt_getdiag(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_getdiag * stmt);
-static int exec_stmt_if(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_if * stmt);
-static int exec_stmt_loop(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_loop * stmt);
-static int exec_stmt_while(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_while * stmt);
-static int exec_stmt_fori(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_fori * stmt);
-static int exec_stmt_fors(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_fors * stmt);
-static int exec_stmt_select(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_select * stmt);
-static int exec_stmt_open(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_open * stmt);
-static int exec_stmt_fetch(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_fetch * stmt);
-static int exec_stmt_close(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_close * stmt);
-static int exec_stmt_exit(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_exit * stmt);
-static int exec_stmt_return(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_return * stmt);
-static int exec_stmt_return_next(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_return_next * stmt);
-static int exec_stmt_raise(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_raise * stmt);
-static int exec_stmt_execsql(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_execsql * stmt);
-static int exec_stmt_dynexecute(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_dynexecute * stmt);
-static int exec_stmt_dynfors(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_dynfors * stmt);
-
-static void plpgsql_estate_setup(PLpgSQL_execstate * estate,
- PLpgSQL_function * func,
+static int exec_stmt(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt *stmt);
+static int exec_stmt_assign(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_assign *stmt);
+static int exec_stmt_perform(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_perform *stmt);
+static int exec_stmt_getdiag(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_getdiag *stmt);
+static int exec_stmt_if(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_if *stmt);
+static int exec_stmt_loop(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_loop *stmt);
+static int exec_stmt_while(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_while *stmt);
+static int exec_stmt_fori(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_fori *stmt);
+static int exec_stmt_fors(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_fors *stmt);
+static int exec_stmt_select(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_select *stmt);
+static int exec_stmt_open(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_open *stmt);
+static int exec_stmt_fetch(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_fetch *stmt);
+static int exec_stmt_close(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_close *stmt);
+static int exec_stmt_exit(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_exit *stmt);
+static int exec_stmt_return(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_return *stmt);
+static int exec_stmt_return_next(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_return_next *stmt);
+static int exec_stmt_raise(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_raise *stmt);
+static int exec_stmt_execsql(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_execsql *stmt);
+static int exec_stmt_dynexecute(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_dynexecute *stmt);
+static int exec_stmt_dynfors(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_dynfors *stmt);
+
+static void plpgsql_estate_setup(PLpgSQL_execstate *estate,
+ PLpgSQL_function *func,
ReturnSetInfo *rsi);
-static void exec_eval_cleanup(PLpgSQL_execstate * estate);
+static void exec_eval_cleanup(PLpgSQL_execstate *estate);
-static void exec_prepare_plan(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr);
+static void exec_prepare_plan(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr);
static bool exec_simple_check_node(Node *node);
-static void exec_simple_check_plan(PLpgSQL_expr * expr);
-static Datum exec_eval_simple_expr(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+static void exec_simple_check_plan(PLpgSQL_expr *expr);
+static Datum exec_eval_simple_expr(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull,
Oid *rettype);
-static void exec_assign_expr(PLpgSQL_execstate * estate,
- PLpgSQL_datum * target,
- PLpgSQL_expr * expr);
-static void exec_assign_value(PLpgSQL_execstate * estate,
- PLpgSQL_datum * target,
+static void exec_assign_expr(PLpgSQL_execstate *estate,
+ PLpgSQL_datum *target,
+ PLpgSQL_expr *expr);
+static void exec_assign_value(PLpgSQL_execstate *estate,
+ PLpgSQL_datum *target,
Datum value, Oid valtype, bool *isNull);
-static void exec_eval_datum(PLpgSQL_execstate * estate,
- PLpgSQL_datum * datum,
+static void exec_eval_datum(PLpgSQL_execstate *estate,
+ PLpgSQL_datum *datum,
Oid expectedtypeid,
Oid *typeid,
Datum *value,
bool *isnull);
-static int exec_eval_integer(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+static int exec_eval_integer(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull);
-static bool exec_eval_boolean(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+static bool exec_eval_boolean(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull);
-static Datum exec_eval_expr(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+static Datum exec_eval_expr(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull,
Oid *rettype);
-static int exec_run_select(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr, long maxtuples, Portal *portalP);
-static void exec_move_row(PLpgSQL_execstate * estate,
- PLpgSQL_rec * rec,
- PLpgSQL_row * row,
+static int exec_run_select(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr, long maxtuples, Portal *portalP);
+static void exec_move_row(PLpgSQL_execstate *estate,
+ PLpgSQL_rec *rec,
+ PLpgSQL_row *row,
HeapTuple tup, TupleDesc tupdesc);
-static HeapTuple make_tuple_from_row(PLpgSQL_execstate * estate,
- PLpgSQL_row * row,
+static HeapTuple make_tuple_from_row(PLpgSQL_execstate *estate,
+ PLpgSQL_row *row,
TupleDesc tupdesc);
static char *convert_value_to_string(Datum value, Oid valtype);
static Datum exec_cast_value(Datum value, Oid valtype,
static Datum exec_simple_cast_value(Datum value, Oid valtype,
Oid reqtype, int32 reqtypmod,
bool isnull);
-static void exec_init_tuple_store(PLpgSQL_execstate * estate);
+static void exec_init_tuple_store(PLpgSQL_execstate *estate);
static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2);
-static void exec_set_found(PLpgSQL_execstate * estate, bool state);
-static void free_var(PLpgSQL_var * var);
+static void exec_set_found(PLpgSQL_execstate *estate, bool state);
+static void free_var(PLpgSQL_var *var);
/* ----------
* ----------
*/
Datum
-plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
+plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo)
{
PLpgSQL_execstate estate;
ErrorContextCallback plerrcontext;
* ----------
*/
HeapTuple
-plpgsql_exec_trigger(PLpgSQL_function * func,
+plpgsql_exec_trigger(PLpgSQL_function *func,
TriggerData *trigdata)
{
PLpgSQL_execstate estate;
* ----------
*/
static PLpgSQL_datum *
-copy_plpgsql_datum(PLpgSQL_datum * datum)
+copy_plpgsql_datum(PLpgSQL_datum *datum)
{
PLpgSQL_datum *result;
static bool
-exception_matches_conditions(ErrorData *edata, PLpgSQL_condition * cond)
+exception_matches_conditions(ErrorData *edata, PLpgSQL_condition *cond)
{
for (; cond != NULL; cond = cond->next)
{
* ----------
*/
static int
-exec_stmt_block(PLpgSQL_execstate * estate, PLpgSQL_stmt_block * block)
+exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
{
volatile int rc = -1;
int i;
* ----------
*/
static int
-exec_stmts(PLpgSQL_execstate * estate, List *stmts)
+exec_stmts(PLpgSQL_execstate *estate, List *stmts)
{
ListCell *s;
* ----------
*/
static int
-exec_stmt(PLpgSQL_execstate * estate, PLpgSQL_stmt * stmt)
+exec_stmt(PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt)
{
PLpgSQL_stmt *save_estmt;
int rc = -1;
* ----------
*/
static int
-exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt)
+exec_stmt_assign(PLpgSQL_execstate *estate, PLpgSQL_stmt_assign *stmt)
{
Assert(stmt->varno >= 0);
* ----------
*/
static int
-exec_stmt_perform(PLpgSQL_execstate * estate, PLpgSQL_stmt_perform * stmt)
+exec_stmt_perform(PLpgSQL_execstate *estate, PLpgSQL_stmt_perform *stmt)
{
PLpgSQL_expr *expr = stmt->expr;
* ----------
*/
static int
-exec_stmt_getdiag(PLpgSQL_execstate * estate, PLpgSQL_stmt_getdiag * stmt)
+exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt)
{
ListCell *lc;
* ----------
*/
static int
-exec_stmt_if(PLpgSQL_execstate * estate, PLpgSQL_stmt_if * stmt)
+exec_stmt_if(PLpgSQL_execstate *estate, PLpgSQL_stmt_if *stmt)
{
bool value;
bool isnull;
* ----------
*/
static int
-exec_stmt_loop(PLpgSQL_execstate * estate, PLpgSQL_stmt_loop * stmt)
+exec_stmt_loop(PLpgSQL_execstate *estate, PLpgSQL_stmt_loop *stmt)
{
for (;;)
{
* ----------
*/
static int
-exec_stmt_while(PLpgSQL_execstate * estate, PLpgSQL_stmt_while * stmt)
+exec_stmt_while(PLpgSQL_execstate *estate, PLpgSQL_stmt_while *stmt)
{
for (;;)
{
* ----------
*/
static int
-exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
+exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
{
PLpgSQL_var *var;
Datum value;
* ----------
*/
static int
-exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
+exec_stmt_fors(PLpgSQL_execstate *estate, PLpgSQL_stmt_fors *stmt)
{
PLpgSQL_rec *rec = NULL;
PLpgSQL_row *row = NULL;
* ----------
*/
static int
-exec_stmt_select(PLpgSQL_execstate * estate, PLpgSQL_stmt_select * stmt)
+exec_stmt_select(PLpgSQL_execstate *estate, PLpgSQL_stmt_select *stmt)
{
PLpgSQL_rec *rec = NULL;
PLpgSQL_row *row = NULL;
* ----------
*/
static int
-exec_stmt_exit(PLpgSQL_execstate * estate, PLpgSQL_stmt_exit * stmt)
+exec_stmt_exit(PLpgSQL_execstate *estate, PLpgSQL_stmt_exit *stmt)
{
/*
* If the exit / continue has a condition, evaluate it
* ----------
*/
static int
-exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt)
+exec_stmt_return(PLpgSQL_execstate *estate, PLpgSQL_stmt_return *stmt)
{
/*
* If processing a set-returning PL/PgSQL function, the final RETURN
* ----------
*/
static int
-exec_stmt_return_next(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_return_next * stmt)
+exec_stmt_return_next(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_return_next *stmt)
{
TupleDesc tupdesc;
int natts;
}
static void
-exec_init_tuple_store(PLpgSQL_execstate * estate)
+exec_init_tuple_store(PLpgSQL_execstate *estate)
{
ReturnSetInfo *rsi = estate->rsi;
MemoryContext oldcxt;
* ----------
*/
static int
-exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
+exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
{
char *cp;
PLpgSQL_dstring ds;
* ----------
*/
static void
-plpgsql_estate_setup(PLpgSQL_execstate * estate,
- PLpgSQL_function * func,
+plpgsql_estate_setup(PLpgSQL_execstate *estate,
+ PLpgSQL_function *func,
ReturnSetInfo *rsi)
{
estate->retval = (Datum) 0;
* ----------
*/
static void
-exec_eval_cleanup(PLpgSQL_execstate * estate)
+exec_eval_cleanup(PLpgSQL_execstate *estate)
{
/* Clear result of a full SPI_execute */
if (estate->eval_tuptable != NULL)
* ----------
*/
static void
-exec_prepare_plan(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr)
+exec_prepare_plan(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr)
{
int i;
_SPI_plan *spi_plan;
* ----------
*/
static int
-exec_stmt_execsql(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_execsql * stmt)
+exec_stmt_execsql(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_execsql *stmt)
{
int i;
Datum *values;
* ----------
*/
static int
-exec_stmt_dynexecute(PLpgSQL_execstate * estate,
- PLpgSQL_stmt_dynexecute * stmt)
+exec_stmt_dynexecute(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_dynexecute *stmt)
{
Datum query;
bool isnull = false;
* ----------
*/
static int
-exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
+exec_stmt_dynfors(PLpgSQL_execstate *estate, PLpgSQL_stmt_dynfors *stmt)
{
Datum query;
bool isnull;
* ----------
*/
static int
-exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
+exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
{
PLpgSQL_var *curvar = NULL;
char *curname = NULL;
* ----------
*/
static int
-exec_stmt_fetch(PLpgSQL_execstate * estate, PLpgSQL_stmt_fetch * stmt)
+exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
{
PLpgSQL_var *curvar = NULL;
PLpgSQL_rec *rec = NULL;
* ----------
*/
static int
-exec_stmt_close(PLpgSQL_execstate * estate, PLpgSQL_stmt_close * stmt)
+exec_stmt_close(PLpgSQL_execstate *estate, PLpgSQL_stmt_close *stmt)
{
PLpgSQL_var *curvar = NULL;
Portal portal;
* ----------
*/
static void
-exec_assign_expr(PLpgSQL_execstate * estate, PLpgSQL_datum * target,
- PLpgSQL_expr * expr)
+exec_assign_expr(PLpgSQL_execstate *estate, PLpgSQL_datum *target,
+ PLpgSQL_expr *expr)
{
Datum value;
Oid valtype;
* ----------
*/
static void
-exec_assign_value(PLpgSQL_execstate * estate,
- PLpgSQL_datum * target,
+exec_assign_value(PLpgSQL_execstate *estate,
+ PLpgSQL_datum *target,
Datum value, Oid valtype, bool *isNull)
{
switch (target->dtype)
/*
* Target is an element of an array
*
- * To handle constructs like x[1][2] := something, we have to be
- * prepared to deal with a chain of arrayelem datums. Chase
+ * To handle constructs like x[1][2] := something, we have to
+ * be prepared to deal with a chain of arrayelem datums. Chase
* back to find the base array datum, and save the subscript
* expressions as we go. (We are scanning right to left here,
* but want to evaluate the subscripts left-to-right to
* subscript. This only works for varlena arrays, though; for
* fixed-length array types we skip the assignment. We can't
* support assignment of a null entry into a fixed-length
- * array, either, so that's a no-op too. This is all ugly
- * but corresponds to the current behavior of
- * ExecEvalArrayRef().
+ * array, either, so that's a no-op too. This is all ugly but
+ * corresponds to the current behavior of ExecEvalArrayRef().
*/
- if (arraytyplen > 0 && /* fixed-length array? */
+ if (arraytyplen > 0 && /* fixed-length array? */
(oldarrayisnull || *isNull))
return;
pfree(DatumGetPointer(coerced_value));
/*
- * Assign the new array to the base variable. It's never
- * NULL at this point.
+ * Assign the new array to the base variable. It's never NULL
+ * at this point.
*/
*isNull = false;
exec_assign_value(estate, target,
* the estate's short-term memory context.
*/
static void
-exec_eval_datum(PLpgSQL_execstate * estate,
- PLpgSQL_datum * datum,
+exec_eval_datum(PLpgSQL_execstate *estate,
+ PLpgSQL_datum *datum,
Oid expectedtypeid,
Oid *typeid,
Datum *value,
* ----------
*/
static int
-exec_eval_integer(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+exec_eval_integer(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull)
{
Datum exprdatum;
* ----------
*/
static bool
-exec_eval_boolean(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+exec_eval_boolean(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull)
{
Datum exprdatum;
* ----------
*/
static Datum
-exec_eval_expr(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+exec_eval_expr(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull,
Oid *rettype)
{
* ----------
*/
static int
-exec_run_select(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr, long maxtuples, Portal *portalP)
+exec_run_select(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr, long maxtuples, Portal *portalP)
{
int i;
Datum *values;
* ----------
*/
static Datum
-exec_eval_simple_expr(PLpgSQL_execstate * estate,
- PLpgSQL_expr * expr,
+exec_eval_simple_expr(PLpgSQL_execstate *estate,
+ PLpgSQL_expr *expr,
bool *isNull,
Oid *rettype)
{
/*
* Param list can live in econtext's temporary memory context.
*
- * XXX think about avoiding repeated palloc's for param lists? Beware however
- * that this routine is re-entrant: exec_eval_datum() can call it back for
- * subscript evaluation, and so there can be a need to have more than one
- * active param list.
+ * XXX think about avoiding repeated palloc's for param lists? Beware
+ * however that this routine is re-entrant: exec_eval_datum() can call it
+ * back for subscript evaluation, and so there can be a need to have more
+ * than one active param list.
*/
paramLI = (ParamListInfo)
MemoryContextAlloc(econtext->ecxt_per_tuple_memory,
* ----------
*/
static void
-exec_move_row(PLpgSQL_execstate * estate,
- PLpgSQL_rec * rec,
- PLpgSQL_row * row,
+exec_move_row(PLpgSQL_execstate *estate,
+ PLpgSQL_rec *rec,
+ PLpgSQL_row *row,
HeapTuple tup, TupleDesc tupdesc)
{
/*
* Row is a bit more complicated in that we assign the individual
* attributes of the tuple to the variables the row points to.
*
- * NOTE: this code used to demand row->nfields == tup->t_data->t_natts, but
- * that's wrong. The tuple might have more fields than we expected if
+ * NOTE: this code used to demand row->nfields == tup->t_data->t_natts,
+ * but that's wrong. The tuple might have more fields than we expected if
* it's from an inheritance-child table of the current table, or it might
* have fewer if the table has had columns added by ALTER TABLE. Ignore
* extra columns and assume NULL for missing columns, the same as
* heap_getattr would do. We also have to skip over dropped columns in
* either the source or destination.
*
- * If we have no tuple data at all, we'll assign NULL to all columns of the
- * row variable.
+ * If we have no tuple data at all, we'll assign NULL to all columns of
+ * the row variable.
*/
if (row != NULL)
{
* ----------
*/
static HeapTuple
-make_tuple_from_row(PLpgSQL_execstate * estate,
- PLpgSQL_row * row,
+make_tuple_from_row(PLpgSQL_execstate *estate,
+ PLpgSQL_row *row,
TupleDesc tupdesc)
{
int natts = tupdesc->natts;
* ----------
*/
static void
-exec_simple_check_plan(PLpgSQL_expr * expr)
+exec_simple_check_plan(PLpgSQL_expr *expr)
{
_SPI_plan *spi_plan = (_SPI_plan *) expr->plan;
Plan *plan;
* ----------
*/
static void
-exec_set_found(PLpgSQL_execstate * estate, bool state)
+exec_set_found(PLpgSQL_execstate *estate, bool state)
{
PLpgSQL_var *var;
}
static void
-free_var(PLpgSQL_var * var)
+free_var(PLpgSQL_var *var)
{
if (var->freeval)
{
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.46 2005/10/15 02:49:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.47 2005/11/22 18:17:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
* ----------
*/
void
-plpgsql_dstring_init(PLpgSQL_dstring * ds)
+plpgsql_dstring_init(PLpgSQL_dstring *ds)
{
ds->value = palloc(ds->alloc = 512);
ds->used = 1;
* ----------
*/
void
-plpgsql_dstring_free(PLpgSQL_dstring * ds)
+plpgsql_dstring_free(PLpgSQL_dstring *ds)
{
pfree(ds->value);
}
static void
-plpgsql_dstring_expand(PLpgSQL_dstring * ds, int needed)
+plpgsql_dstring_expand(PLpgSQL_dstring *ds, int needed)
{
/* Don't allow truncating the string */
Assert(needed > ds->alloc);
* ----------
*/
void
-plpgsql_dstring_append(PLpgSQL_dstring * ds, const char *str)
+plpgsql_dstring_append(PLpgSQL_dstring *ds, const char *str)
{
int len = strlen(str);
int needed = ds->used + len;
* ----------
*/
void
-plpgsql_dstring_append_char(PLpgSQL_dstring * ds, char c)
+plpgsql_dstring_append_char(PLpgSQL_dstring *ds, char c)
{
if (ds->used == ds->alloc)
plpgsql_dstring_expand(ds, ds->used + 1);
* ----------
*/
char *
-plpgsql_dstring_get(PLpgSQL_dstring * ds)
+plpgsql_dstring_get(PLpgSQL_dstring *ds)
{
return ds->value;
}
* Statement type as a string, for use in error messages etc.
*/
const char *
-plpgsql_stmt_typename(PLpgSQL_stmt * stmt)
+plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
{
switch (stmt->cmd_type)
{
static int dump_indent;
static void dump_ind();
-static void dump_stmt(PLpgSQL_stmt * stmt);
-static void dump_block(PLpgSQL_stmt_block * block);
-static void dump_assign(PLpgSQL_stmt_assign * stmt);
-static void dump_if(PLpgSQL_stmt_if * stmt);
-static void dump_loop(PLpgSQL_stmt_loop * stmt);
-static void dump_while(PLpgSQL_stmt_while * stmt);
-static void dump_fori(PLpgSQL_stmt_fori * stmt);
-static void dump_fors(PLpgSQL_stmt_fors * stmt);
-static void dump_select(PLpgSQL_stmt_select * stmt);
-static void dump_exit(PLpgSQL_stmt_exit * stmt);
-static void dump_return(PLpgSQL_stmt_return * stmt);
-static void dump_return_next(PLpgSQL_stmt_return_next * stmt);
-static void dump_raise(PLpgSQL_stmt_raise * stmt);
-static void dump_execsql(PLpgSQL_stmt_execsql * stmt);
-static void dump_dynexecute(PLpgSQL_stmt_dynexecute * stmt);
-static void dump_dynfors(PLpgSQL_stmt_dynfors * stmt);
-static void dump_getdiag(PLpgSQL_stmt_getdiag * stmt);
-static void dump_open(PLpgSQL_stmt_open * stmt);
-static void dump_fetch(PLpgSQL_stmt_fetch * stmt);
-static void dump_close(PLpgSQL_stmt_close * stmt);
-static void dump_perform(PLpgSQL_stmt_perform * stmt);
-static void dump_expr(PLpgSQL_expr * expr);
+static void dump_stmt(PLpgSQL_stmt *stmt);
+static void dump_block(PLpgSQL_stmt_block *block);
+static void dump_assign(PLpgSQL_stmt_assign *stmt);
+static void dump_if(PLpgSQL_stmt_if *stmt);
+static void dump_loop(PLpgSQL_stmt_loop *stmt);
+static void dump_while(PLpgSQL_stmt_while *stmt);
+static void dump_fori(PLpgSQL_stmt_fori *stmt);
+static void dump_fors(PLpgSQL_stmt_fors *stmt);
+static void dump_select(PLpgSQL_stmt_select *stmt);
+static void dump_exit(PLpgSQL_stmt_exit *stmt);
+static void dump_return(PLpgSQL_stmt_return *stmt);
+static void dump_return_next(PLpgSQL_stmt_return_next *stmt);
+static void dump_raise(PLpgSQL_stmt_raise *stmt);
+static void dump_execsql(PLpgSQL_stmt_execsql *stmt);
+static void dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt);
+static void dump_dynfors(PLpgSQL_stmt_dynfors *stmt);
+static void dump_getdiag(PLpgSQL_stmt_getdiag *stmt);
+static void dump_open(PLpgSQL_stmt_open *stmt);
+static void dump_fetch(PLpgSQL_stmt_fetch *stmt);
+static void dump_close(PLpgSQL_stmt_close *stmt);
+static void dump_perform(PLpgSQL_stmt_perform *stmt);
+static void dump_expr(PLpgSQL_expr *expr);
static void
}
static void
-dump_stmt(PLpgSQL_stmt * stmt)
+dump_stmt(PLpgSQL_stmt *stmt)
{
printf("%3d:", stmt->lineno);
switch (stmt->cmd_type)
}
static void
-dump_block(PLpgSQL_stmt_block * block)
+dump_block(PLpgSQL_stmt_block *block)
{
char *name;
}
static void
-dump_assign(PLpgSQL_stmt_assign * stmt)
+dump_assign(PLpgSQL_stmt_assign *stmt)
{
dump_ind();
printf("ASSIGN var %d := ", stmt->varno);
}
static void
-dump_if(PLpgSQL_stmt_if * stmt)
+dump_if(PLpgSQL_stmt_if *stmt)
{
dump_ind();
printf("IF ");
}
static void
-dump_loop(PLpgSQL_stmt_loop * stmt)
+dump_loop(PLpgSQL_stmt_loop *stmt)
{
dump_ind();
printf("LOOP\n");
}
static void
-dump_while(PLpgSQL_stmt_while * stmt)
+dump_while(PLpgSQL_stmt_while *stmt)
{
dump_ind();
printf("WHILE ");
}
static void
-dump_fori(PLpgSQL_stmt_fori * stmt)
+dump_fori(PLpgSQL_stmt_fori *stmt)
{
dump_ind();
printf("FORI %s %s\n", stmt->var->refname, (stmt->reverse) ? "REVERSE" : "NORMAL");
}
static void
-dump_fors(PLpgSQL_stmt_fors * stmt)
+dump_fors(PLpgSQL_stmt_fors *stmt)
{
dump_ind();
printf("FORS %s ", (stmt->rec != NULL) ? stmt->rec->refname : stmt->row->refname);
}
static void
-dump_select(PLpgSQL_stmt_select * stmt)
+dump_select(PLpgSQL_stmt_select *stmt)
{
dump_ind();
printf("SELECT ");
}
static void
-dump_open(PLpgSQL_stmt_open * stmt)
+dump_open(PLpgSQL_stmt_open *stmt)
{
dump_ind();
printf("OPEN curvar=%d\n", stmt->curvar);
}
static void
-dump_fetch(PLpgSQL_stmt_fetch * stmt)
+dump_fetch(PLpgSQL_stmt_fetch *stmt)
{
dump_ind();
printf("FETCH curvar=%d\n", stmt->curvar);
}
static void
-dump_close(PLpgSQL_stmt_close * stmt)
+dump_close(PLpgSQL_stmt_close *stmt)
{
dump_ind();
printf("CLOSE curvar=%d\n", stmt->curvar);
}
static void
-dump_perform(PLpgSQL_stmt_perform * stmt)
+dump_perform(PLpgSQL_stmt_perform *stmt)
{
dump_ind();
printf("PERFORM expr = ");
}
static void
-dump_exit(PLpgSQL_stmt_exit * stmt)
+dump_exit(PLpgSQL_stmt_exit *stmt)
{
dump_ind();
printf("%s label='%s'",
}
static void
-dump_return(PLpgSQL_stmt_return * stmt)
+dump_return(PLpgSQL_stmt_return *stmt)
{
dump_ind();
printf("RETURN ");
}
static void
-dump_return_next(PLpgSQL_stmt_return_next * stmt)
+dump_return_next(PLpgSQL_stmt_return_next *stmt)
{
dump_ind();
printf("RETURN NEXT ");
}
static void
-dump_raise(PLpgSQL_stmt_raise * stmt)
+dump_raise(PLpgSQL_stmt_raise *stmt)
{
ListCell *lc;
int i = 0;
}
static void
-dump_execsql(PLpgSQL_stmt_execsql * stmt)
+dump_execsql(PLpgSQL_stmt_execsql *stmt)
{
dump_ind();
printf("EXECSQL ");
}
static void
-dump_dynexecute(PLpgSQL_stmt_dynexecute * stmt)
+dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
{
dump_ind();
printf("EXECUTE ");
}
static void
-dump_dynfors(PLpgSQL_stmt_dynfors * stmt)
+dump_dynfors(PLpgSQL_stmt_dynfors *stmt)
{
dump_ind();
printf("FORS %s EXECUTE ", (stmt->rec != NULL) ? stmt->rec->refname : stmt->row->refname);
}
static void
-dump_getdiag(PLpgSQL_stmt_getdiag * stmt)
+dump_getdiag(PLpgSQL_stmt_getdiag *stmt)
{
ListCell *lc;
}
static void
-dump_expr(PLpgSQL_expr * expr)
+dump_expr(PLpgSQL_expr *expr)
{
int i;
}
void
-plpgsql_dumptree(PLpgSQL_function * func)
+plpgsql_dumptree(PLpgSQL_function *func)
{
int i;
PLpgSQL_datum *d;
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.65 2005/10/15 02:49:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.66 2005/11/22 18:17:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
int alloc;
int used; /* Including NUL terminator */
char *value;
-} PLpgSQL_dstring;
+} PLpgSQL_dstring;
typedef struct
Oid typioparam;
FmgrInfo typinput; /* lookup info for typinput function */
int32 atttypmod; /* typmod (taken from someplace else) */
-} PLpgSQL_type;
+} PLpgSQL_type;
/*
{ /* Generic datum array item */
int dtype;
int dno;
-} PLpgSQL_datum;
+} PLpgSQL_datum;
/*
* The variants PLpgSQL_var, PLpgSQL_row, and PLpgSQL_rec share these
int dno;
char *refname;
int lineno;
-} PLpgSQL_variable;
+} PLpgSQL_variable;
typedef struct PLpgSQL_expr
{ /* SQL Query to plan and execute */
/* params to pass to expr */
int nparams;
int params[1]; /* VARIABLE SIZE ARRAY ... must be last */
-} PLpgSQL_expr;
+} PLpgSQL_expr;
typedef struct
Datum value;
bool isnull;
bool freeval;
-} PLpgSQL_var;
+} PLpgSQL_var;
typedef struct
int nfields;
char **fieldnames;
int *varnos;
-} PLpgSQL_row;
+} PLpgSQL_row;
typedef struct
TupleDesc tupdesc;
bool freetup;
bool freetupdesc;
-} PLpgSQL_rec;
+} PLpgSQL_rec;
typedef struct
int rfno;
char *fieldname;
int recparentno; /* dno of parent record */
-} PLpgSQL_recfield;
+} PLpgSQL_recfield;
typedef struct
int dno;
PLpgSQL_expr *subscript;
int arrayparentno; /* dno of parent array variable */
-} PLpgSQL_arrayelem;
+} PLpgSQL_arrayelem;
typedef struct
int dtype;
int dno;
PLpgSQL_expr *argnum;
-} PLpgSQL_trigarg;
+} PLpgSQL_trigarg;
typedef struct
int itemtype;
int itemno;
char name[1];
-} PLpgSQL_nsitem;
+} PLpgSQL_nsitem;
/* XXX: consider adapting this to use List */
int items_used;
PLpgSQL_nsitem **items;
struct PLpgSQL_ns *upper;
-} PLpgSQL_ns;
+} PLpgSQL_ns;
typedef struct
{ /* Generic execution node */
int cmd_type;
int lineno;
-} PLpgSQL_stmt;
+} PLpgSQL_stmt;
typedef struct PLpgSQL_condition
int sqlerrstate; /* SQLSTATE code */
char *condname; /* condition name (for debugging) */
struct PLpgSQL_condition *next;
-} PLpgSQL_condition;
+} PLpgSQL_condition;
typedef struct
{
int sqlstate_varno;
int sqlerrm_varno;
List *exc_list; /* List of WHEN clauses */
-} PLpgSQL_exception_block;
+} PLpgSQL_exception_block;
typedef struct
{ /* One EXCEPTION ... WHEN clause */
int lineno;
PLpgSQL_condition *conditions;
List *action; /* List of statements */
-} PLpgSQL_exception;
+} PLpgSQL_exception;
typedef struct
int n_initvars;
int *initvarnos;
PLpgSQL_exception_block *exceptions;
-} PLpgSQL_stmt_block;
+} PLpgSQL_stmt_block;
typedef struct
int lineno;
int varno;
PLpgSQL_expr *expr;
-} PLpgSQL_stmt_assign;
+} PLpgSQL_stmt_assign;
typedef struct
{ /* PERFORM statement */
int cmd_type;
int lineno;
PLpgSQL_expr *expr;
-} PLpgSQL_stmt_perform;
+} PLpgSQL_stmt_perform;
typedef struct
{ /* Get Diagnostics item */
int kind; /* id for diagnostic value desired */
int target; /* where to assign it */
-} PLpgSQL_diag_item;
+} PLpgSQL_diag_item;
typedef struct
{ /* Get Diagnostics statement */
int cmd_type;
int lineno;
List *diag_items; /* List of PLpgSQL_diag_item */
-} PLpgSQL_stmt_getdiag;
+} PLpgSQL_stmt_getdiag;
typedef struct
PLpgSQL_expr *cond;
List *true_body; /* List of statements */
List *false_body; /* List of statements */
-} PLpgSQL_stmt_if;
+} PLpgSQL_stmt_if;
typedef struct
int lineno;
char *label;
List *body; /* List of statements */
-} PLpgSQL_stmt_loop;
+} PLpgSQL_stmt_loop;
typedef struct
char *label;
PLpgSQL_expr *cond;
List *body; /* List of statements */
-} PLpgSQL_stmt_while;
+} PLpgSQL_stmt_while;
typedef struct
PLpgSQL_expr *upper;
int reverse;
List *body; /* List of statements */
-} PLpgSQL_stmt_fori;
+} PLpgSQL_stmt_fori;
typedef struct
PLpgSQL_row *row;
PLpgSQL_expr *query;
List *body; /* List of statements */
-} PLpgSQL_stmt_fors;
+} PLpgSQL_stmt_fors;
typedef struct
PLpgSQL_row *row;
PLpgSQL_expr *query;
List *body; /* List of statements */
-} PLpgSQL_stmt_dynfors;
+} PLpgSQL_stmt_dynfors;
typedef struct
PLpgSQL_rec *rec;
PLpgSQL_row *row;
PLpgSQL_expr *query;
-} PLpgSQL_stmt_select;
+} PLpgSQL_stmt_select;
typedef struct
PLpgSQL_expr *argquery;
PLpgSQL_expr *query;
PLpgSQL_expr *dynquery;
-} PLpgSQL_stmt_open;
+} PLpgSQL_stmt_open;
typedef struct
PLpgSQL_rec *rec;
PLpgSQL_row *row;
int curvar;
-} PLpgSQL_stmt_fetch;
+} PLpgSQL_stmt_fetch;
typedef struct
int cmd_type;
int lineno;
int curvar;
-} PLpgSQL_stmt_close;
+} PLpgSQL_stmt_close;
typedef struct
bool is_exit; /* Is this an exit or a continue? */
char *label;
PLpgSQL_expr *cond;
-} PLpgSQL_stmt_exit;
+} PLpgSQL_stmt_exit;
typedef struct
int lineno;
PLpgSQL_expr *expr;
int retvarno;
-} PLpgSQL_stmt_return;
+} PLpgSQL_stmt_return;
typedef struct
{ /* RETURN NEXT statement */
int lineno;
PLpgSQL_expr *expr;
int retvarno;
-} PLpgSQL_stmt_return_next;
+} PLpgSQL_stmt_return_next;
typedef struct
{ /* RAISE statement */
int elog_level;
char *message;
List *params; /* list of expressions */
-} PLpgSQL_stmt_raise;
+} PLpgSQL_stmt_raise;
typedef struct
int cmd_type;
int lineno;
PLpgSQL_expr *sqlstmt;
-} PLpgSQL_stmt_execsql;
+} PLpgSQL_stmt_execsql;
typedef struct
PLpgSQL_rec *rec; /* INTO record or row variable */
PLpgSQL_row *row;
PLpgSQL_expr *query;
-} PLpgSQL_stmt_dynexecute;
+} PLpgSQL_stmt_dynexecute;
typedef struct PLpgSQL_func_hashkey
* PLpgSQL functions. Be careful that extra positions are zeroed!
*/
Oid argtypes[FUNC_MAX_ARGS];
-} PLpgSQL_func_hashkey;
+} PLpgSQL_func_hashkey;
typedef struct PLpgSQL_function
int ndatums;
PLpgSQL_datum **datums;
PLpgSQL_stmt_block *action;
-} PLpgSQL_function;
+} PLpgSQL_function;
typedef struct
PLpgSQL_function *err_func; /* current func */
PLpgSQL_stmt *err_stmt; /* current stmt */
const char *err_text; /* additional state info */
-} PLpgSQL_execstate;
+} PLpgSQL_execstate;
/**********************************************************************
extern PLpgSQL_type *plpgsql_parse_datatype(const char *string);
extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod);
extern PLpgSQL_variable *plpgsql_build_variable(const char *refname, int lineno,
- PLpgSQL_type * dtype,
+ PLpgSQL_type *dtype,
bool add2namespace);
extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
-extern void plpgsql_adddatum(PLpgSQL_datum * new);
+extern void plpgsql_adddatum(PLpgSQL_datum *new);
extern int plpgsql_add_initdatums(int **varnos);
extern void plpgsql_HashTableInit(void);
extern void plpgsql_compile_error_callback(void *arg);
* Functions in pl_exec.c
* ----------
*/
-extern Datum plpgsql_exec_function(PLpgSQL_function * func,
+extern Datum plpgsql_exec_function(PLpgSQL_function *func,
FunctionCallInfo fcinfo);
-extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function * func,
+extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function *func,
TriggerData *trigdata);
extern void plpgsql_xact_cb(XactEvent event, void *arg);
* Functions for the dynamic string handling in pl_funcs.c
* ----------
*/
-extern void plpgsql_dstring_init(PLpgSQL_dstring * ds);
-extern void plpgsql_dstring_free(PLpgSQL_dstring * ds);
-extern void plpgsql_dstring_append(PLpgSQL_dstring * ds, const char *str);
-extern void plpgsql_dstring_append_char(PLpgSQL_dstring * ds, char c);
-extern char *plpgsql_dstring_get(PLpgSQL_dstring * ds);
+extern void plpgsql_dstring_init(PLpgSQL_dstring *ds);
+extern void plpgsql_dstring_free(PLpgSQL_dstring *ds);
+extern void plpgsql_dstring_append(PLpgSQL_dstring *ds, const char *str);
+extern void plpgsql_dstring_append_char(PLpgSQL_dstring *ds, char c);
+extern char *plpgsql_dstring_get(PLpgSQL_dstring *ds);
/* ----------
* Functions for the namestack handling in pl_funcs.c
* ----------
*/
extern void plpgsql_convert_ident(const char *s, char **output, int numidents);
-extern const char *plpgsql_stmt_typename(PLpgSQL_stmt * stmt);
-extern void plpgsql_dumptree(PLpgSQL_function * func);
+extern const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt);
+extern void plpgsql_dumptree(PLpgSQL_function *func);
/* ----------
* Externs in gram.y and scan.l
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.98 2005/10/15 02:49:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.99 2005/11/22 18:17:34 momjian Exp $
*
**********************************************************************/
int nargs;
FmgrInfo arg_out_func[FUNC_MAX_ARGS];
bool arg_is_rowtype[FUNC_MAX_ARGS];
-} pltcl_proc_desc;
+} pltcl_proc_desc;
/**********************************************************************
Oid *argtypes;
FmgrInfo *arginfuncs;
Oid *argtypioparams;
-} pltcl_query_desc;
+} pltcl_query_desc;
/**********************************************************************
* Forward declarations
**********************************************************************/
static void pltcl_init_all(void);
-static void pltcl_init_interp(Tcl_Interp * interp);
+static void pltcl_init_interp(Tcl_Interp *interp);
-static void pltcl_init_load_unknown(Tcl_Interp * interp);
+static void pltcl_init_load_unknown(Tcl_Interp *interp);
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
static pltcl_proc_desc *compile_pltcl_function(Oid fn_oid, Oid tgreloid);
-static int pltcl_elog(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_quote(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_argisnull(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_returnnull(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_SPI_execute(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_SPI_execute(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_process_SPI_result(Tcl_Interp * interp,
+static int pltcl_process_SPI_result(Tcl_Interp *interp,
CONST84 char *arrayname,
CONST84 char *loop_body,
int spi_rc,
SPITupleTable *tuptable,
int ntuples);
-static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp * interp,
+static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[]);
-static void pltcl_set_tuple_values(Tcl_Interp * interp, CONST84 char *arrayname,
+static void pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
int tupno, HeapTuple tuple, TupleDesc tupdesc);
static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
- Tcl_DString * retval);
+ Tcl_DString *retval);
/*
* pltcl_init_interp() - initialize a Tcl interpreter
**********************************************************************/
static void
-pltcl_init_interp(Tcl_Interp * interp)
+pltcl_init_interp(Tcl_Interp *interp)
{
/************************************************************
* Install the commands for SPI support in the interpreter
* table pltcl_modules (if it exists)
**********************************************************************/
static void
-pltcl_init_load_unknown(Tcl_Interp * interp)
+pltcl_init_load_unknown(Tcl_Interp *interp)
{
int spi_rc;
int tcl_rc;
* pltcl_elog() - elog() support for PLTcl
**********************************************************************/
static int
-pltcl_elog(ClientData cdata, Tcl_Interp * interp,
+pltcl_elog(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
volatile int level;
* be used in SPI_execute query strings
**********************************************************************/
static int
-pltcl_quote(ClientData cdata, Tcl_Interp * interp,
+pltcl_quote(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
char *tmp;
* pltcl_argisnull() - determine if a specific argument is NULL
**********************************************************************/
static int
-pltcl_argisnull(ClientData cdata, Tcl_Interp * interp,
+pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
int argno;
* pltcl_returnnull() - Cause a NULL return from a function
**********************************************************************/
static int
-pltcl_returnnull(ClientData cdata, Tcl_Interp * interp,
+pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
}
static void
-pltcl_subtrans_abort(Tcl_Interp * interp,
+pltcl_subtrans_abort(Tcl_Interp *interp,
MemoryContext oldcontext, ResourceOwner oldowner)
{
ErrorData *edata;
* for the Tcl interpreter
**********************************************************************/
static int
-pltcl_SPI_execute(ClientData cdata, Tcl_Interp * interp,
+pltcl_SPI_execute(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
int my_rc;
* Shared code between pltcl_SPI_execute and pltcl_SPI_execute_plan
*/
static int
-pltcl_process_SPI_result(Tcl_Interp * interp,
+pltcl_process_SPI_result(Tcl_Interp *interp,
CONST84 char *arrayname,
CONST84 char *loop_body,
int spi_rc,
* and not save the plan currently.
**********************************************************************/
static int
-pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
+pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
int nargs;
* pltcl_SPI_execute_plan() - Execute a prepared plan
**********************************************************************/
static int
-pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp * interp,
+pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
int my_rc;
* be used after insert queries
**********************************************************************/
static int
-pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp * interp,
+pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
int argc, CONST84 char *argv[])
{
char buf[64];
* of a given tuple
**********************************************************************/
static void
-pltcl_set_tuple_values(Tcl_Interp * interp, CONST84 char *arrayname,
+pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
int tupno, HeapTuple tuple, TupleDesc tupdesc)
{
int i;
**********************************************************************/
static void
pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
- Tcl_DString * retval)
+ Tcl_DString *retval)
{
int i;
char *outputstr;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.39 2005/10/15 02:49:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.40 2005/11/22 18:17:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Ensure that the file exists and is a regular file.
*
- * XXX if you have a broken system where stat() looks at the symlink instead
- * of the underlying file, you lose.
+ * XXX if you have a broken system where stat() looks at the symlink
+ * instead of the underlying file, you lose.
*/
if (stat(path, &buf) < 0)
return -1;
* points, for example). After following the final symlink, we use
* getcwd() to figure out where the heck we're at.
*
- * One might think we could skip all this if path doesn't point to a symlink
- * to start with, but that's wrong. We also want to get rid of any
- * directory symlinks that are present in the given path. We expect
+ * One might think we could skip all this if path doesn't point to a
+ * symlink to start with, but that's wrong. We also want to get rid of
+ * any directory symlinks that are present in the given path. We expect
* getcwd() to give us an accurate, symlink-free path.
*/
if (!getcwd(orig_wd, MAXPGPATH))
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.61 2005/10/15 02:49:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.62 2005/11/22 18:17:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Remove any trailing uses of "." and process ".." ourselves
*
- * Note that "/../.." should reduce to just "/", while "../.." has to be kept
- * as-is. In the latter case we put back mistakenly trimmed ".."
+ * Note that "/../.." should reduce to just "/", while "../.." has to be
+ * kept as-is. In the latter case we put back mistakenly trimmed ".."
* components below. Also note that we want a Windows drive spec to be
* visible to trim_directory(), but it's not part of the logic that's
* looking at the name components; hence distinction between path and
* digit is > 7 (or 8), the number is too big, and we will return a range
* error.
*
- * Set any if any `digits' consumed; make it negative to indicate overflow.
+ * Set any if any `digits' consumed; make it negative to indicate
+ * overflow.
*/
cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX;
cutlim = cutoff % (unsigned long) base;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.5 2005/10/15 02:49:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.6 2005/11/22 18:17:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* presented string. This method fails on such platforms. Hopefully all
* such platforms have unsetenv() and thus won't be using this hack.
*
- * Note that repeatedly setting and unsetting a var using this code will leak
- * memory.
+ * Note that repeatedly setting and unsetting a var using this code will
+ * leak memory.
*/
envstr = (char *) malloc(strlen(name) + 2);
* b = (5 bytes) \000\001\002\003\004
*
* tuple 0: got
- * i = (4 bytes) 2
- * t = (8 bytes) 'ho there'
- * b = (5 bytes) \004\003\002\001\000
+ * i = (4 bytes) 2
+ * t = (8 bytes) 'ho there'
+ * b = (5 bytes) \004\003\002\001\000
*/
#include <stdio.h>
#include <stdlib.h>
* out-of-line parameters, as well as binary transmission of data.
*
* This first example transmits the parameters as text, but receives the
- * results in binary format. By using out-of-line parameters we can
- * avoid a lot of tedious mucking about with quoting and escaping, even
- * though the data is text. Notice how we don't have to do anything
- * special with the quote mark in the parameter value.
+ * results in binary format. By using out-of-line parameters we can avoid
+ * a lot of tedious mucking about with quoting and escaping, even though
+ * the data is text. Notice how we don't have to do anything special with
+ * the quote mark in the parameter value.
*/
/* Here is our out-of-line parameter value */
PQclear(res);
/*
- * In this second example we transmit an integer parameter in binary
- * form, and again retrieve the results in binary form.
+ * In this second example we transmit an integer parameter in binary form,
+ * and again retrieve the results in binary form.
*
* Although we tell PQexecParams we are letting the backend deduce
* parameter type, we really force the decision by casting the parameter
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.38 2005/10/15 02:49:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.39 2005/11/22 18:17:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
"Australia/Perth"
}, /* (GMT+08:00) Perth */
/* {"W. Central Africa Standard Time", "W. Central Africa Daylight Time",
- * * * ""}, Could not find a match for this one. Excluded for now. *//* (
+ * * * * ""}, Could not find a match for this one. Excluded for now. *//* (
* G MT+01:00) West Central Africa */
{
"W. Europe Standard Time", "W. Europe Daylight Time",