1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

pgindent run for 9.0

This commit is contained in:
Bruce Momjian
2010-02-26 02:01:40 +00:00
parent 16040575a0
commit 65e806cba1
403 changed files with 6786 additions and 6530 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.156 2010/02/14 18:42:16 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.157 2010/02/26 02:01:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -78,7 +78,7 @@ static Acl *allocacl(int n);
static void check_acl(const Acl *acl);
static const char *aclparse(const char *s, AclItem *aip);
static bool aclitem_match(const AclItem *a1, const AclItem *a2);
static int aclitemComparator(const void *arg1, const void *arg2);
static int aclitemComparator(const void *arg1, const void *arg2);
static void check_circularity(const Acl *old_acl, const AclItem *mod_aip,
Oid ownerId);
static Acl *recursive_revoke(Acl *acl, Oid grantee, AclMode revoke_privs,
@ -470,7 +470,7 @@ aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId)
for (i = 0; i < num; i++, aip++)
{
Acl *tmp_acl;
Acl *tmp_acl;
tmp_acl = aclupdate(result_acl, aip, ACL_MODECHG_ADD,
ownerId, DROP_RESTRICT);
@ -1669,17 +1669,17 @@ convert_aclright_to_string(int aclright)
* returns the table
*
* {{ OID(joe), 0::OID, 'SELECT', false },
* { OID(joe), OID(foo), 'INSERT', true },
* { OID(joe), OID(foo), 'UPDATE', false }}
* { OID(joe), OID(foo), 'INSERT', true },
* { OID(joe), OID(foo), 'UPDATE', false }}
*----------
*/
Datum
aclexplode(PG_FUNCTION_ARGS)
{
Acl *acl = PG_GETARG_ACL_P(0);
FuncCallContext *funcctx;
FuncCallContext *funcctx;
int *idx;
AclItem *aidat;
AclItem *aidat;
if (SRF_IS_FIRSTCALL())
{
@ -1692,8 +1692,8 @@ aclexplode(PG_FUNCTION_ARGS)
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
/*
* build tupdesc for result tuples (matches out parameters in
* pg_proc entry)
* build tupdesc for result tuples (matches out parameters in pg_proc
* entry)
*/
tupdesc = CreateTemplateTupleDesc(4, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "grantor",
@ -1731,7 +1731,7 @@ aclexplode(PG_FUNCTION_ARGS)
{
idx[1] = 0;
idx[0]++;
if (idx[0] >= ACL_NUM(acl)) /* done */
if (idx[0] >= ACL_NUM(acl)) /* done */
break;
}
aidata = &aidat[idx[0]];
@ -2003,8 +2003,8 @@ has_sequence_privilege_name_name(PG_FUNCTION_ARGS)
if (get_rel_relkind(sequenceoid) != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
text_to_cstring(sequencename))));
errmsg("\"%s\" is not a sequence",
text_to_cstring(sequencename))));
aclresult = pg_class_aclcheck(sequenceoid, roleid, mode);
@ -2033,8 +2033,8 @@ has_sequence_privilege_name(PG_FUNCTION_ARGS)
if (get_rel_relkind(sequenceoid) != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
text_to_cstring(sequencename))));
errmsg("\"%s\" is not a sequence",
text_to_cstring(sequencename))));
aclresult = pg_class_aclcheck(sequenceoid, roleid, mode);
@ -2065,8 +2065,8 @@ has_sequence_privilege_name_id(PG_FUNCTION_ARGS)
else if (relkind != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
get_rel_name(sequenceoid))));
errmsg("\"%s\" is not a sequence",
get_rel_name(sequenceoid))));
aclresult = pg_class_aclcheck(sequenceoid, roleid, mode);
@ -2097,8 +2097,8 @@ has_sequence_privilege_id(PG_FUNCTION_ARGS)
else if (relkind != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
get_rel_name(sequenceoid))));
errmsg("\"%s\" is not a sequence",
get_rel_name(sequenceoid))));
aclresult = pg_class_aclcheck(sequenceoid, roleid, mode);
@ -2125,8 +2125,8 @@ has_sequence_privilege_id_name(PG_FUNCTION_ARGS)
if (get_rel_relkind(sequenceoid) != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
text_to_cstring(sequencename))));
errmsg("\"%s\" is not a sequence",
text_to_cstring(sequencename))));
aclresult = pg_class_aclcheck(sequenceoid, roleid, mode);
@ -2155,8 +2155,8 @@ has_sequence_privilege_id_id(PG_FUNCTION_ARGS)
else if (relkind != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a sequence",
get_rel_name(sequenceoid))));
errmsg("\"%s\" is not a sequence",
get_rel_name(sequenceoid))));
aclresult = pg_class_aclcheck(sequenceoid, roleid, mode);
@ -2171,10 +2171,10 @@ static AclMode
convert_sequence_priv_string(text *priv_type_text)
{
static const priv_map sequence_priv_map[] = {
{ "USAGE", ACL_USAGE },
{ "SELECT", ACL_SELECT },
{ "UPDATE", ACL_UPDATE },
{ NULL, 0 }
{"USAGE", ACL_USAGE},
{"SELECT", ACL_SELECT},
{"UPDATE", ACL_UPDATE},
{NULL, 0}
};
return convert_any_priv_string(priv_type_text, sequence_priv_map);

View File

@ -6,7 +6,7 @@
* Copyright (c) 2003-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.34 2010/02/08 20:39:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.35 2010/02/26 02:01:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -531,9 +531,9 @@ array_agg_finalfn(PG_FUNCTION_ARGS)
/*
* Make the result. We cannot release the ArrayBuildState because
* sometimes aggregate final functions are re-executed. Rather, it
* is nodeAgg.c's responsibility to reset the aggcontext when it's
* safe to do so.
* sometimes aggregate final functions are re-executed. Rather, it is
* nodeAgg.c's responsibility to reset the aggcontext when it's safe to do
* so.
*/
result = makeMdArrayResult(state, 1, dims, lbs,
CurrentMemoryContext,

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.163 2010/01/02 16:57:53 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.164 2010/02/26 02:01:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -328,10 +328,11 @@ array_in(PG_FUNCTION_ARGS)
SET_VARSIZE(retval, nbytes);
retval->ndim = ndim;
retval->dataoffset = dataoffset;
/*
* This comes from the array's pg_type.typelem (which points to the
* base data type's pg_type.oid) and stores system oids in user tables.
* This oid must be preserved by binary upgrades.
* This comes from the array's pg_type.typelem (which points to the base
* data type's pg_type.oid) and stores system oids in user tables. This
* oid must be preserved by binary upgrades.
*/
retval->elemtype = element_type;
memcpy(ARR_DIMS(retval), dim, ndim * sizeof(int));
@ -1212,7 +1213,7 @@ array_recv(PG_FUNCTION_ARGS)
for (i = 0; i < ndim; i++)
{
int ub;
int ub;
dim[i] = pq_getmsgint(buf, 4);
lBound[i] = pq_getmsgint(buf, 4);
@ -4194,12 +4195,12 @@ accumArrayResult(ArrayBuildState *astate,
}
/*
* Ensure pass-by-ref stuff is copied into mcontext; and detoast it too
* if it's varlena. (You might think that detoasting is not needed here
* Ensure pass-by-ref stuff is copied into mcontext; and detoast it too if
* it's varlena. (You might think that detoasting is not needed here
* because construct_md_array can detoast the array elements later.
* However, we must not let construct_md_array modify the ArrayBuildState
* because that would mean array_agg_finalfn damages its input, which
* is verboten. Also, this way frequently saves one copying step.)
* because that would mean array_agg_finalfn damages its input, which is
* verboten. Also, this way frequently saves one copying step.)
*/
if (!disnull && !astate->typbyval)
{

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.151 2010/02/18 04:31:16 itagaki Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.152 2010/02/26 02:01:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -203,7 +203,7 @@ Datum
date_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
DateADT result;
DateADT result;
result = (DateADT) pq_getmsgint(buf, sizeof(DateADT));

View File

@ -5,7 +5,7 @@
* Copyright (c) 2002-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.30 2010/02/14 18:42:16 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.31 2010/02/26 02:01:07 momjian Exp $
*
*/
@ -185,7 +185,7 @@ calculate_tablespace_size(Oid tblspcOid)
snprintf(tblspcPath, MAXPGPATH, "global");
else
snprintf(tblspcPath, MAXPGPATH, "pg_tblspc/%u/%s", tblspcOid,
TABLESPACE_VERSION_DIRECTORY);
TABLESPACE_VERSION_DIRECTORY);
dirdesc = AllocateDir(tblspcPath);
@ -318,10 +318,10 @@ pg_relation_size(PG_FUNCTION_ARGS)
static int64
calculate_toast_table_size(Oid toastrelid)
{
int64 size = 0;
Relation toastRel;
Relation toastIdxRel;
ForkNumber forkNum;
int64 size = 0;
Relation toastRel;
Relation toastIdxRel;
ForkNumber forkNum;
toastRel = relation_open(toastrelid, AccessShareLock);
@ -351,9 +351,9 @@ calculate_toast_table_size(Oid toastrelid)
static int64
calculate_table_size(Oid relOid)
{
int64 size = 0;
Relation rel;
ForkNumber forkNum;
int64 size = 0;
Relation rel;
ForkNumber forkNum;
rel = relation_open(relOid, AccessShareLock);
@ -382,8 +382,8 @@ calculate_table_size(Oid relOid)
static int64
calculate_indexes_size(Oid relOid)
{
int64 size = 0;
Relation rel;
int64 size = 0;
Relation rel;
rel = relation_open(relOid, AccessShareLock);
@ -392,14 +392,14 @@ calculate_indexes_size(Oid relOid)
*/
if (rel->rd_rel->relhasindex)
{
List *index_oids = RelationGetIndexList(rel);
ListCell *cell;
List *index_oids = RelationGetIndexList(rel);
ListCell *cell;
foreach(cell, index_oids)
{
Oid idxOid = lfirst_oid(cell);
Relation idxRel;
ForkNumber forkNum;
ForkNumber forkNum;
idxRel = relation_open(idxOid, AccessShareLock);
@ -443,9 +443,8 @@ calculate_total_relation_size(Oid Relid)
int64 size;
/*
* Aggregate the table size, this includes size of
* the heap, toast and toast index with free space
* and visibility map
* Aggregate the table size, this includes size of the heap, toast and
* toast index with free space and visibility map
*/
size = calculate_table_size(Relid);
@ -515,7 +514,7 @@ pg_size_pretty(PG_FUNCTION_ARGS)
* This is expected to be used in queries like
* SELECT pg_relation_filenode(oid) FROM pg_class;
* That leads to a couple of choices. We work from the pg_class row alone
* rather than actually opening each relation, for efficiency. We don't
* rather than actually opening each relation, for efficiency. We don't
* fail if we can't find the relation --- some rows might be visible in
* the query's MVCC snapshot but already dead according to SnapshotNow.
* (Note: we could avoid using the catcache, but there's little point
@ -545,7 +544,7 @@ pg_relation_filenode(PG_FUNCTION_ARGS)
/* okay, these have storage */
if (relform->relfilenode)
result = relform->relfilenode;
else /* Consult the relation mapper */
else /* Consult the relation mapper */
result = RelationMapOidToFilenode(relid,
relform->relisshared);
break;
@ -602,9 +601,9 @@ pg_relation_filepath(PG_FUNCTION_ARGS)
rnode.dbNode = MyDatabaseId;
if (relform->relfilenode)
rnode.relNode = relform->relfilenode;
else /* Consult the relation mapper */
else /* Consult the relation mapper */
rnode.relNode = RelationMapOidToFilenode(relid,
relform->relisshared);
relform->relisshared);
break;
default:

View File

@ -25,7 +25,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/domains.c,v 1.10 2010/01/02 16:57:53 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/domains.c,v 1.11 2010/02/26 02:01:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -305,7 +305,7 @@ domain_recv(PG_FUNCTION_ARGS)
/*
* domain_check - check that a datum satisfies the constraints of a
* domain. extra and mcxt can be passed if they are available from,
* domain. extra and mcxt can be passed if they are available from,
* say, a FmgrInfo structure, or they can be NULL, in which case the
* setup is repeated for each call.
*/

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.10 2010/02/14 18:42:16 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.11 2010/02/26 02:01:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -56,8 +56,8 @@ enum_in(PG_FUNCTION_ARGS)
name)));
/*
* This comes from pg_enum.oid and stores system oids in user tables.
* This oid must be preserved by binary upgrades.
* This comes from pg_enum.oid and stores system oids in user tables. This
* oid must be preserved by binary upgrades.
*/
enumoid = HeapTupleGetOid(tup);

View File

@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.167 2010/02/25 18:36:14 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.168 2010/02/26 02:01:08 momjian Exp $
*
*
* Portions Copyright (c) 1999-2010, PostgreSQL Global Development Group
@ -1053,165 +1053,165 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
*/
PG_TRY();
{
if (IS_EEEE(num) && n->key->id != NUM_E)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"EEEE\" must be the last pattern used")));
if (IS_EEEE(num) && n->key->id != NUM_E)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"EEEE\" must be the last pattern used")));
switch (n->key->id)
{
case NUM_9:
if (IS_BRACKET(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"9\" must be ahead of \"PR\"")));
if (IS_MULTI(num))
{
++num->multi;
switch (n->key->id)
{
case NUM_9:
if (IS_BRACKET(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"9\" must be ahead of \"PR\"")));
if (IS_MULTI(num))
{
++num->multi;
break;
}
if (IS_DECIMAL(num))
++num->post;
else
++num->pre;
break;
}
if (IS_DECIMAL(num))
++num->post;
else
++num->pre;
break;
case NUM_0:
if (IS_BRACKET(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"0\" must be ahead of \"PR\"")));
if (!IS_ZERO(num) && !IS_DECIMAL(num))
{
num->flag |= NUM_F_ZERO;
num->zero_start = num->pre + 1;
}
if (!IS_DECIMAL(num))
++num->pre;
else
++num->post;
case NUM_0:
if (IS_BRACKET(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"0\" must be ahead of \"PR\"")));
if (!IS_ZERO(num) && !IS_DECIMAL(num))
{
num->flag |= NUM_F_ZERO;
num->zero_start = num->pre + 1;
}
if (!IS_DECIMAL(num))
++num->pre;
else
++num->post;
num->zero_end = num->pre + num->post;
break;
num->zero_end = num->pre + num->post;
break;
case NUM_B:
if (num->pre == 0 && num->post == 0 && (!IS_ZERO(num)))
num->flag |= NUM_F_BLANK;
break;
case NUM_B:
if (num->pre == 0 && num->post == 0 && (!IS_ZERO(num)))
num->flag |= NUM_F_BLANK;
break;
case NUM_D:
num->flag |= NUM_F_LDECIMAL;
num->need_locale = TRUE;
case NUM_DEC:
if (IS_DECIMAL(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple decimal points")));
if (IS_MULTI(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"V\" and decimal point together")));
num->flag |= NUM_F_DECIMAL;
break;
case NUM_FM:
num->flag |= NUM_F_FILLMODE;
break;
case NUM_S:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" twice")));
if (IS_PLUS(num) || IS_MINUS(num) || IS_BRACKET(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"PL\"/\"MI\"/\"SG\"/\"PR\" together")));
if (!IS_DECIMAL(num))
{
num->lsign = NUM_LSIGN_PRE;
num->pre_lsign_num = num->pre;
case NUM_D:
num->flag |= NUM_F_LDECIMAL;
num->need_locale = TRUE;
num->flag |= NUM_F_LSIGN;
}
else if (num->lsign == NUM_LSIGN_NONE)
{
num->lsign = NUM_LSIGN_POST;
num->need_locale = TRUE;
num->flag |= NUM_F_LSIGN;
}
break;
case NUM_MI:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"MI\" together")));
num->flag |= NUM_F_MINUS;
if (IS_DECIMAL(num))
num->flag |= NUM_F_MINUS_POST;
break;
case NUM_PL:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"PL\" together")));
num->flag |= NUM_F_PLUS;
if (IS_DECIMAL(num))
num->flag |= NUM_F_PLUS_POST;
break;
case NUM_SG:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"SG\" together")));
num->flag |= NUM_F_MINUS;
num->flag |= NUM_F_PLUS;
break;
case NUM_PR:
if (IS_LSIGN(num) || IS_PLUS(num) || IS_MINUS(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"PR\" and \"S\"/\"PL\"/\"MI\"/\"SG\" together")));
num->flag |= NUM_F_BRACKET;
break;
case NUM_rn:
case NUM_RN:
num->flag |= NUM_F_ROMAN;
break;
case NUM_L:
case NUM_G:
num->need_locale = TRUE;
break;
case NUM_V:
if (IS_DECIMAL(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
case NUM_DEC:
if (IS_DECIMAL(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple decimal points")));
if (IS_MULTI(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"V\" and decimal point together")));
num->flag |= NUM_F_MULTI;
break;
num->flag |= NUM_F_DECIMAL;
break;
case NUM_E:
if (IS_EEEE(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"EEEE\" twice")));
if (IS_BLANK(num) || IS_FILLMODE(num) || IS_LSIGN(num) ||
IS_BRACKET(num) || IS_MINUS(num) || IS_PLUS(num) ||
IS_ROMAN(num) || IS_MULTI(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"EEEE\" is incompatible with other formats"),
errdetail("\"EEEE\" may only be used together with digit and decimal point patterns.")));
num->flag |= NUM_F_EEEE;
break;
}
case NUM_FM:
num->flag |= NUM_F_FILLMODE;
break;
case NUM_S:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" twice")));
if (IS_PLUS(num) || IS_MINUS(num) || IS_BRACKET(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"PL\"/\"MI\"/\"SG\"/\"PR\" together")));
if (!IS_DECIMAL(num))
{
num->lsign = NUM_LSIGN_PRE;
num->pre_lsign_num = num->pre;
num->need_locale = TRUE;
num->flag |= NUM_F_LSIGN;
}
else if (num->lsign == NUM_LSIGN_NONE)
{
num->lsign = NUM_LSIGN_POST;
num->need_locale = TRUE;
num->flag |= NUM_F_LSIGN;
}
break;
case NUM_MI:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"MI\" together")));
num->flag |= NUM_F_MINUS;
if (IS_DECIMAL(num))
num->flag |= NUM_F_MINUS_POST;
break;
case NUM_PL:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"PL\" together")));
num->flag |= NUM_F_PLUS;
if (IS_DECIMAL(num))
num->flag |= NUM_F_PLUS_POST;
break;
case NUM_SG:
if (IS_LSIGN(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"S\" and \"SG\" together")));
num->flag |= NUM_F_MINUS;
num->flag |= NUM_F_PLUS;
break;
case NUM_PR:
if (IS_LSIGN(num) || IS_PLUS(num) || IS_MINUS(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"PR\" and \"S\"/\"PL\"/\"MI\"/\"SG\" together")));
num->flag |= NUM_F_BRACKET;
break;
case NUM_rn:
case NUM_RN:
num->flag |= NUM_F_ROMAN;
break;
case NUM_L:
case NUM_G:
num->need_locale = TRUE;
break;
case NUM_V:
if (IS_DECIMAL(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"V\" and decimal point together")));
num->flag |= NUM_F_MULTI;
break;
case NUM_E:
if (IS_EEEE(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use \"EEEE\" twice")));
if (IS_BLANK(num) || IS_FILLMODE(num) || IS_LSIGN(num) ||
IS_BRACKET(num) || IS_MINUS(num) || IS_PLUS(num) ||
IS_ROMAN(num) || IS_MULTI(num))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("\"EEEE\" is incompatible with other formats"),
errdetail("\"EEEE\" may only be used together with digit and decimal point patterns.")));
num->flag |= NUM_F_EEEE;
break;
}
}
PG_CATCH();
{
@ -2088,7 +2088,11 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out)
break;
case DCH_HH:
case DCH_HH12:
/* display time as shown on a 12-hour clock, even for intervals */
/*
* display time as shown on a 12-hour clock, even for
* intervals
*/
sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : 2,
tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? 12 :
tm->tm_hour % (HOURS_PER_DAY / 2));
@ -4652,8 +4656,8 @@ numeric_to_char(PG_FUNCTION_ARGS)
if (strcmp(orgnum, "NaN") == 0)
{
/*
* Allow 6 characters for the leading sign, the decimal point, "e",
* the exponent's sign and two exponent digits.
* Allow 6 characters for the leading sign, the decimal point,
* "e", the exponent's sign and two exponent digits.
*/
numstr = (char *) palloc(Num.pre + Num.post + 7);
fill_str(numstr, '#', Num.pre + Num.post + 6);
@ -4757,7 +4761,7 @@ int4_to_char(PG_FUNCTION_ARGS)
else if (IS_EEEE(&Num))
{
/* we can do it easily because float8 won't lose any precision */
float8 val = (float8) value;
float8 val = (float8) value;
orgnum = (char *) palloc(MAXDOUBLEWIDTH + 1);
snprintf(orgnum, MAXDOUBLEWIDTH + 1, "%+.*e", Num.post, val);
@ -4852,7 +4856,7 @@ int8_to_char(PG_FUNCTION_ARGS)
else if (IS_EEEE(&Num))
{
/* to avoid loss of precision, must go via numeric not float8 */
Numeric val;
Numeric val;
val = DatumGetNumeric(DirectFunctionCall1(int8_numeric,
Int64GetDatum(value)));
@ -4956,8 +4960,8 @@ float4_to_char(PG_FUNCTION_ARGS)
if (isnan(value) || is_infinite(value))
{
/*
* Allow 6 characters for the leading sign, the decimal point, "e",
* the exponent's sign and two exponent digits.
* Allow 6 characters for the leading sign, the decimal point,
* "e", the exponent's sign and two exponent digits.
*/
numstr = (char *) palloc(Num.pre + Num.post + 7);
fill_str(numstr, '#', Num.pre + Num.post + 6);
@ -5060,8 +5064,8 @@ float8_to_char(PG_FUNCTION_ARGS)
if (isnan(value) || is_infinite(value))
{
/*
* Allow 6 characters for the leading sign, the decimal point, "e",
* the exponent's sign and two exponent digits.
* Allow 6 characters for the leading sign, the decimal point,
* "e", the exponent's sign and two exponent digits.
*/
numstr = (char *) palloc(Num.pre + Num.post + 7);
fill_str(numstr, '#', Num.pre + Num.post + 6);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.107 2010/01/14 16:31:09 teodor Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.108 2010/02/26 02:01:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -67,7 +67,7 @@ static double dist_pl_internal(Point *pt, LINE *line);
static double dist_ps_internal(Point *pt, LSEG *lseg);
static Point *line_interpt_internal(LINE *l1, LINE *l2);
static bool lseg_inside_poly(Point *a, Point *b, POLYGON *poly, int start);
static Point* lseg_interpt_internal(LSEG *l1, LSEG *l2);
static Point *lseg_interpt_internal(LSEG *l1, LSEG *l2);
/*
@ -2354,7 +2354,7 @@ lseg_center(PG_FUNCTION_ARGS)
PG_RETURN_POINT_P(result);
}
static Point*
static Point *
lseg_interpt_internal(LSEG *l1, LSEG *l2)
{
Point *result;
@ -2411,7 +2411,7 @@ lseg_interpt(PG_FUNCTION_ARGS)
LSEG *l1 = PG_GETARG_LSEG_P(0);
LSEG *l2 = PG_GETARG_LSEG_P(1);
Point *result;
result = lseg_interpt_internal(l1, l2);
if (!PointerIsValid(result))
PG_RETURN_NULL();
@ -2466,8 +2466,8 @@ dist_ps_internal(Point *pt, LSEG *lseg)
Point *ip;
/*
* Construct a line perpendicular to the input segment
* and through the input point
* Construct a line perpendicular to the input segment and through the
* input point
*/
if (lseg->p[1].x == lseg->p[0].x)
m = 0;
@ -3203,7 +3203,7 @@ on_pb(PG_FUNCTION_ARGS)
}
Datum
box_contain_pt(PG_FUNCTION_ARGS)
box_contain_pt(PG_FUNCTION_ARGS)
{
BOX *box = PG_GETARG_BOX_P(0);
Point *pt = PG_GETARG_POINT_P(1);
@ -3768,7 +3768,7 @@ poly_same(PG_FUNCTION_ARGS)
}
/*-----------------------------------------------------------------
* Determine if polygon A overlaps polygon B
* Determine if polygon A overlaps polygon B
*-----------------------------------------------------------------*/
Datum
poly_overlap(PG_FUNCTION_ARGS)
@ -3778,51 +3778,51 @@ poly_overlap(PG_FUNCTION_ARGS)
bool result;
/* Quick check by bounding box */
result = (polya->npts > 0 && polyb->npts > 0 &&
box_ov(&polya->boundbox, &polyb->boundbox)) ? true : false;
result = (polya->npts > 0 && polyb->npts > 0 &&
box_ov(&polya->boundbox, &polyb->boundbox)) ? true : false;
/*
* Brute-force algorithm - try to find intersected edges,
* if so then polygons are overlapped else check is one
* polygon inside other or not by testing single point
* of them.
* Brute-force algorithm - try to find intersected edges, if so then
* polygons are overlapped else check is one polygon inside other or not
* by testing single point of them.
*/
if (result)
{
int ia, ib;
LSEG sa, sb;
int ia,
ib;
LSEG sa,
sb;
/* Init first of polya's edge with last point */
sa.p[0] = polya->p[polya->npts - 1];
result = false;
for(ia=0; ia<polya->npts && result == false; ia++)
for (ia = 0; ia < polya->npts && result == false; ia++)
{
/* Second point of polya's edge is a current one */
/* Second point of polya's edge is a current one */
sa.p[1] = polya->p[ia];
/* Init first of polyb's edge with last point */
sb.p[0] = polyb->p[polyb->npts - 1];
for(ib=0; ib<polyb->npts && result == false; ib++)
for (ib = 0; ib < polyb->npts && result == false; ib++)
{
sb.p[1] = polyb->p[ib];
result = lseg_intersect_internal(&sa, &sb);
sb.p[0] = sb.p[1];
}
/*
* move current endpoint to the first point
* of next edge
/*
* move current endpoint to the first point of next edge
*/
sa.p[0] = sa.p[1];
}
if (result==false)
if (result == false)
{
result = ( point_inside(polya->p, polyb->npts, polyb->p)
||
point_inside(polyb->p, polya->npts, polya->p) );
result = (point_inside(polya->p, polyb->npts, polyb->p)
||
point_inside(polyb->p, polya->npts, polya->p));
}
}
@ -3838,93 +3838,93 @@ poly_overlap(PG_FUNCTION_ARGS)
/*
* Tests special kind of segment for in/out of polygon.
* Special kind means:
* - point a should be on segment s
* - segment (a,b) should not be contained by s
* - point a should be on segment s
* - segment (a,b) should not be contained by s
* Returns true if:
* - segment (a,b) is collinear to s and (a,b) is in polygon
* - segment (a,b) s not collinear to s. Note: that doesn't
* mean that segment is in polygon!
*/
* - segment (a,b) is collinear to s and (a,b) is in polygon
* - segment (a,b) s not collinear to s. Note: that doesn't
* mean that segment is in polygon!
*/
static bool
touched_lseg_inside_poly(Point *a, Point *b, LSEG *s, POLYGON *poly, int start)
{
/* point a is on s, b is not */
LSEG t;
LSEG t;
t.p[0] = *a;
t.p[1] = *b;
#define POINTEQ(pt1, pt2) (FPeq((pt1)->x, (pt2)->x) && FPeq((pt1)->y, (pt2)->y))
if ( POINTEQ(a, s->p) )
#define POINTEQ(pt1, pt2) (FPeq((pt1)->x, (pt2)->x) && FPeq((pt1)->y, (pt2)->y))
if (POINTEQ(a, s->p))
{
if ( on_ps_internal(s->p+1, &t) )
return lseg_inside_poly(b, s->p+1, poly, start);
if (on_ps_internal(s->p + 1, &t))
return lseg_inside_poly(b, s->p + 1, poly, start);
}
else if (POINTEQ(a, s->p+1))
else if (POINTEQ(a, s->p + 1))
{
if ( on_ps_internal(s->p, &t) )
if (on_ps_internal(s->p, &t))
return lseg_inside_poly(b, s->p, poly, start);
}
else if ( on_ps_internal(s->p, &t) )
else if (on_ps_internal(s->p, &t))
{
return lseg_inside_poly(b, s->p, poly, start);
}
else if ( on_ps_internal(s->p+1, &t) )
else if (on_ps_internal(s->p + 1, &t))
{
return lseg_inside_poly(b, s->p+1, poly, start);
return lseg_inside_poly(b, s->p + 1, poly, start);
}
return true; /* may be not true, but that will check later */
return true; /* may be not true, but that will check later */
}
/*
* Returns true if segment (a,b) is in polygon, option
* start is used for optimization - function checks
* start is used for optimization - function checks
* polygon's edges started from start
*/
static bool
lseg_inside_poly(Point *a, Point *b, POLYGON *poly, int start)
{
LSEG s,
t;
int i;
bool res = true,
intersection = false;
LSEG s,
t;
int i;
bool res = true,
intersection = false;
t.p[0] = *a;
t.p[1] = *b;
s.p[0] = poly->p[( start == 0) ? (poly->npts - 1) : (start - 1)];
s.p[0] = poly->p[(start == 0) ? (poly->npts - 1) : (start - 1)];
for(i=start; i<poly->npts && res == true; i++)
for (i = start; i < poly->npts && res == true; i++)
{
Point *interpt;
Point *interpt;
s.p[1] = poly->p[i];
if ( on_ps_internal(t.p, &s) )
if (on_ps_internal(t.p, &s))
{
if ( on_ps_internal(t.p+1, &s) )
return true; /* t is contained by s */
if (on_ps_internal(t.p + 1, &s))
return true; /* t is contained by s */
/* Y-cross */
res = touched_lseg_inside_poly(t.p, t.p+1, &s, poly, i+1);
}
else if ( on_ps_internal(t.p+1, &s) )
res = touched_lseg_inside_poly(t.p, t.p + 1, &s, poly, i + 1);
}
else if (on_ps_internal(t.p + 1, &s))
{
/* Y-cross */
res = touched_lseg_inside_poly(t.p+1, t.p, &s, poly, i+1);
res = touched_lseg_inside_poly(t.p + 1, t.p, &s, poly, i + 1);
}
else if ( (interpt = lseg_interpt_internal(&t, &s)) != NULL )
else if ((interpt = lseg_interpt_internal(&t, &s)) != NULL)
{
/*
* segments are X-crossing, go to check each subsegment
*/
intersection = true;
res = lseg_inside_poly(t.p, interpt, poly, i+1);
res = lseg_inside_poly(t.p, interpt, poly, i + 1);
if (res)
res = lseg_inside_poly(t.p+1, interpt, poly, i+1);
res = lseg_inside_poly(t.p + 1, interpt, poly, i + 1);
pfree(interpt);
}
@ -3933,17 +3933,16 @@ lseg_inside_poly(Point *a, Point *b, POLYGON *poly, int start)
if (res && !intersection)
{
Point p;
Point p;
/*
* if X-intersection wasn't found then check central point
* of tested segment. In opposite case we already check all
* subsegments
* if X-intersection wasn't found then check central point of tested
* segment. In opposite case we already check all subsegments
*/
p.x = (t.p[0].x + t.p[1].x) / 2.0;
p.x = (t.p[0].x + t.p[1].x) / 2.0;
p.y = (t.p[0].y + t.p[1].y) / 2.0;
res = point_inside(&p, poly->npts, poly->p);
res = point_inside(&p, poly->npts, poly->p);
}
return res;
@ -3963,20 +3962,20 @@ poly_contain(PG_FUNCTION_ARGS)
* Quick check to see if bounding box is contained.
*/
if (polya->npts > 0 && polyb->npts > 0 &&
DatumGetBool(DirectFunctionCall2(box_contain,
BoxPGetDatum(&polya->boundbox),
BoxPGetDatum(&polyb->boundbox))))
DatumGetBool(DirectFunctionCall2(box_contain,
BoxPGetDatum(&polya->boundbox),
BoxPGetDatum(&polyb->boundbox))))
{
int i;
LSEG s;
int i;
LSEG s;
s.p[0] = polyb->p[polyb->npts - 1];
result = true;
for(i=0; i<polyb->npts && result == true; i++)
for (i = 0; i < polyb->npts && result == true; i++)
{
s.p[1] = polyb->p[i];
result = lseg_inside_poly(s.p, s.p+1, polya, 0);
result = lseg_inside_poly(s.p, s.p + 1, polya, 0);
s.p[0] = s.p[1];
}
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.88 2010/01/02 16:57:54 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.89 2010/02/26 02:01:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -149,7 +149,7 @@ int2vectorin(PG_FUNCTION_ARGS)
while (*intString && isspace((unsigned char) *intString))
intString++;
if (*intString == '\0')
break;
break;
result->values[n] = pg_atoi(intString, sizeof(int16), ' ');
while (*intString && !isspace((unsigned char) *intString))
intString++;

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.78 2010/02/08 20:39:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.79 2010/02/26 02:01:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -654,9 +654,9 @@ int8inc(PG_FUNCTION_ARGS)
/*
* When int8 is pass-by-reference, we provide this special case to avoid
* palloc overhead for COUNT(): when called as an aggregate, we know that
* the argument is modifiable local storage, so just update it
* in-place. (If int8 is pass-by-value, then of course this is useless as
* well as incorrect, so just ifdef it out.)
* the argument is modifiable local storage, so just update it in-place.
* (If int8 is pass-by-value, then of course this is useless as well as
* incorrect, so just ifdef it out.)
*/
#ifndef USE_FLOAT8_BYVAL /* controls int8 too */
if (AggCheckCallContext(fcinfo, NULL))

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.74 2010/01/12 02:42:52 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.75 2010/02/26 02:01:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -187,7 +187,7 @@ pg_tablespace_databases(PG_FUNCTION_ARGS)
* size = tablespace dirname length + dir sep char + oid + terminator
*/
fctx->location = (char *) palloc(9 + 1 + OIDCHARS + 1 +
strlen(TABLESPACE_VERSION_DIRECTORY) + 1);
strlen(TABLESPACE_VERSION_DIRECTORY) + 1);
if (tablespaceOid == GLOBALTABLESPACE_OID)
{
fctx->dirdesc = NULL;

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.163 2010/01/02 16:57:54 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.164 2010/02/26 02:01:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -786,7 +786,7 @@ tintervalrecv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
TimeInterval tinterval;
int32 status;
int32 status;
tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
@ -796,7 +796,7 @@ tintervalrecv(PG_FUNCTION_ARGS)
if (tinterval->data[0] == INVALID_ABSTIME ||
tinterval->data[1] == INVALID_ABSTIME)
status = T_INTERVAL_INVAL; /* undefined */
status = T_INTERVAL_INVAL; /* undefined */
else
status = T_INTERVAL_VALID;

View File

@ -14,7 +14,7 @@
* Copyright (c) 1998-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.122 2010/02/08 20:39:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.123 2010/02/26 02:01:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -3403,7 +3403,7 @@ static char *
get_str_from_var_sci(NumericVar *var, int rscale)
{
int32 exponent;
NumericVar denominator;
NumericVar denominator;
NumericVar significand;
int denom_scale;
size_t len;
@ -3466,9 +3466,9 @@ get_str_from_var_sci(NumericVar *var, int rscale)
/*
* Allocate space for the result.
*
* In addition to the significand, we need room for the exponent decoration
* ("e"), the sign of the exponent, up to 10 digits for the exponent
* itself, and of course the null terminator.
* In addition to the significand, we need room for the exponent
* decoration ("e"), the sign of the exponent, up to 10 digits for the
* exponent itself, and of course the null terminator.
*/
len = strlen(sig_out) + 13;
str = palloc(len);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.59 2010/01/28 14:25:41 mha Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.60 2010/02/26 02:01:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1116,7 +1116,7 @@ pg_stat_reset(PG_FUNCTION_ARGS)
Datum
pg_stat_reset_shared(PG_FUNCTION_ARGS)
{
char *target = text_to_cstring(PG_GETARG_TEXT_PP(0));
char *target = text_to_cstring(PG_GETARG_TEXT_PP(0));
pgstat_reset_shared_counters(target);
@ -1127,7 +1127,7 @@ pg_stat_reset_shared(PG_FUNCTION_ARGS)
Datum
pg_stat_reset_single_table_counters(PG_FUNCTION_ARGS)
{
Oid taboid = PG_GETARG_OID(0);
Oid taboid = PG_GETARG_OID(0);
pgstat_reset_single_counter(taboid, RESET_TABLE);
@ -1137,7 +1137,7 @@ pg_stat_reset_single_table_counters(PG_FUNCTION_ARGS)
Datum
pg_stat_reset_single_function_counters(PG_FUNCTION_ARGS)
{
Oid funcoid = PG_GETARG_OID(0);
Oid funcoid = PG_GETARG_OID(0);
pgstat_reset_single_counter(funcoid, RESET_FUNCTION);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.27 2010/01/02 16:57:55 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.28 2010/02/26 02:01:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -97,10 +97,11 @@ record_in(PG_FUNCTION_ARGS)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("input of anonymous composite types is not implemented")));
tupTypmod = -1; /* for all non-anonymous types */
/*
* This comes from the composite type's pg_type.oid and
* stores system oids in user tables, specifically DatumTupleFields.
* This oid must be preserved by binary upgrades.
* This comes from the composite type's pg_type.oid and stores system oids
* in user tables, specifically DatumTupleFields. This oid must be
* preserved by binary upgrades.
*/
tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);
ncolumns = tupdesc->natts;

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.324 2010/02/18 22:43:31 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.325 2010/02/26 02:01:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -221,7 +221,7 @@ static Node *processIndirection(Node *node, deparse_context *context,
static void printSubscripts(ArrayRef *aref, deparse_context *context);
static char *generate_relation_name(Oid relid, List *namespaces);
static char *generate_function_name(Oid funcid, int nargs, List *argnames,
Oid *argtypes, bool *is_variadic);
Oid *argtypes, bool *is_variadic);
static char *generate_operator_name(Oid operid, Oid arg1, Oid arg2);
static text *string_to_text(char *str);
static char *flatten_reloptions(Oid relid);
@ -549,12 +549,12 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
/* tgattr is first var-width field, so OK to access directly */
if (trigrec->tgattr.dim1 > 0)
{
int i;
int i;
appendStringInfoString(&buf, " OF ");
for (i = 0; i < trigrec->tgattr.dim1; i++)
{
char *attname;
char *attname;
if (i > 0)
appendStringInfoString(&buf, ", ");
@ -579,7 +579,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
{
if (OidIsValid(trigrec->tgconstrrelid))
appendStringInfo(&buf, "FROM %s ",
generate_relation_name(trigrec->tgconstrrelid, NIL));
generate_relation_name(trigrec->tgconstrrelid, NIL));
if (!trigrec->tgdeferrable)
appendStringInfo(&buf, "NOT ");
appendStringInfo(&buf, "DEFERRABLE INITIALLY ");
@ -599,11 +599,11 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
tgrel->rd_att, &isnull);
if (!isnull)
{
Node *qual;
deparse_context context;
deparse_namespace dpns;
RangeTblEntry *oldrte;
RangeTblEntry *newrte;
Node *qual;
deparse_context context;
deparse_namespace dpns;
RangeTblEntry *oldrte;
RangeTblEntry *newrte;
appendStringInfoString(&buf, "WHEN (");
@ -848,7 +848,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
quote_identifier(NameStr(idxrelrec->relname)),
generate_relation_name(indrelid, NIL),
quote_identifier(NameStr(amrec->amname)));
else /* currently, must be EXCLUDE constraint */
else /* currently, must be EXCLUDE constraint */
appendStringInfo(&buf, "EXCLUDE USING %s (",
quote_identifier(NameStr(amrec->amname)));
}
@ -1262,23 +1262,24 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
break;
}
case CONSTRAINT_TRIGGER:
/*
* There isn't an ALTER TABLE syntax for creating a user-defined
* constraint trigger, but it seems better to print something
* than throw an error; if we throw error then this function
* couldn't safely be applied to all rows of pg_constraint.
* constraint trigger, but it seems better to print something than
* throw an error; if we throw error then this function couldn't
* safely be applied to all rows of pg_constraint.
*/
appendStringInfo(&buf, "TRIGGER");
break;
case CONSTRAINT_EXCLUSION:
{
Oid indexOid = conForm->conindid;
Datum val;
bool isnull;
Datum *elems;
int nElems;
int i;
Oid *operators;
Oid indexOid = conForm->conindid;
Datum val;
bool isnull;
Datum *elems;
int nElems;
int i;
Oid *operators;
/* Extract operator OIDs from the pg_constraint tuple */
val = SysCacheGetAttr(CONSTROID, tup,
@ -3497,10 +3498,10 @@ push_plan(deparse_namespace *dpns, Plan *subplan)
/*
* We special-case Append to pretend that the first child plan is the
* OUTER referent; we have to interpret OUTER Vars in the Append's tlist
* according to one of the children, and the first one is the most
* natural choice. Likewise special-case ModifyTable to pretend that the
* first child plan is the OUTER referent; this is to support RETURNING
* lists containing references to non-target relations.
* according to one of the children, and the first one is the most natural
* choice. Likewise special-case ModifyTable to pretend that the first
* child plan is the OUTER referent; this is to support RETURNING lists
* containing references to non-target relations.
*/
if (IsA(subplan, Append))
dpns->outer_plan = (Plan *) linitial(((Append *) subplan)->appendplans);
@ -4470,10 +4471,10 @@ get_rule_expr(Node *node, deparse_context *context,
/*
* If the argument is a CaseTestExpr, we must be inside a
* FieldStore, ie, we are assigning to an element of an
* array within a composite column. Since we already punted
* on displaying the FieldStore's target information, just
* punt here too, and display only the assignment source
* FieldStore, ie, we are assigning to an element of an array
* within a composite column. Since we already punted on
* displaying the FieldStore's target information, just punt
* here too, and display only the assignment source
* expression.
*/
if (IsA(aref->refexpr, CaseTestExpr))
@ -4498,23 +4499,23 @@ get_rule_expr(Node *node, deparse_context *context,
appendStringInfoChar(buf, ')');
/*
* If there's a refassgnexpr, we want to print the node in
* the format "array[subscripts] := refassgnexpr". This is
* not legal SQL, so decompilation of INSERT or UPDATE
* statements should always use processIndirection as part
* of the statement-level syntax. We should only see this
* when EXPLAIN tries to print the targetlist of a plan
* resulting from such a statement.
* If there's a refassgnexpr, we want to print the node in the
* format "array[subscripts] := refassgnexpr". This is not
* legal SQL, so decompilation of INSERT or UPDATE statements
* should always use processIndirection as part of the
* statement-level syntax. We should only see this when
* EXPLAIN tries to print the targetlist of a plan resulting
* from such a statement.
*/
if (aref->refassgnexpr)
{
Node *refassgnexpr;
Node *refassgnexpr;
/*
* Use processIndirection to print this node's
* subscripts as well as any additional field selections
* or subscripting in immediate descendants. It returns
* the RHS expr that is actually being "assigned".
* Use processIndirection to print this node's subscripts
* as well as any additional field selections or
* subscripting in immediate descendants. It returns the
* RHS expr that is actually being "assigned".
*/
refassgnexpr = processIndirection(node, context, true);
appendStringInfoString(buf, " := ");
@ -4724,14 +4725,14 @@ get_rule_expr(Node *node, deparse_context *context,
* There is no good way to represent a FieldStore as real SQL,
* so decompilation of INSERT or UPDATE statements should
* always use processIndirection as part of the
* statement-level syntax. We should only get here when
* statement-level syntax. We should only get here when
* EXPLAIN tries to print the targetlist of a plan resulting
* from such a statement. The plan case is even harder than
* ordinary rules would be, because the planner tries to
* collapse multiple assignments to the same field or subfield
* into one FieldStore; so we can see a list of target fields
* not just one, and the arguments could be FieldStores
* themselves. We don't bother to try to print the target
* themselves. We don't bother to try to print the target
* field names; we just print the source arguments, with a
* ROW() around them if there's more than one. This isn't
* terribly complete, but it's probably good enough for
@ -5474,7 +5475,7 @@ get_func_expr(FuncExpr *expr, deparse_context *context,
argnames = NIL;
foreach(l, expr->args)
{
Node *arg = (Node *) lfirst(l);
Node *arg = (Node *) lfirst(l);
if (IsA(arg, NamedArgExpr))
argnames = lappend(argnames, ((NamedArgExpr *) arg)->name);
@ -5506,7 +5507,7 @@ get_agg_expr(Aggref *aggref, deparse_context *context)
{
StringInfo buf = context->buf;
Oid argtypes[FUNC_MAX_ARGS];
List *arglist;
List *arglist;
int nargs;
ListCell *l;
@ -5516,12 +5517,12 @@ get_agg_expr(Aggref *aggref, deparse_context *context)
foreach(l, aggref->args)
{
TargetEntry *tle = (TargetEntry *) lfirst(l);
Node *arg = (Node *) tle->expr;
Node *arg = (Node *) tle->expr;
Assert(!IsA(arg, NamedArgExpr));
if (tle->resjunk)
continue;
if (nargs >= FUNC_MAX_ARGS) /* paranoia */
if (nargs >= FUNC_MAX_ARGS) /* paranoia */
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
errmsg("too many arguments")));
@ -5565,7 +5566,7 @@ get_windowfunc_expr(WindowFunc *wfunc, deparse_context *context)
nargs = 0;
foreach(l, wfunc->args)
{
Node *arg = (Node *) lfirst(l);
Node *arg = (Node *) lfirst(l);
Assert(!IsA(arg, NamedArgExpr));
argtypes[nargs] = exprType(arg);
@ -6368,8 +6369,8 @@ processIndirection(Node *node, deparse_context *context, bool printit)
format_type_be(fstore->resulttype));
/*
* Print the field name. There should only be one target field
* in stored rules. There could be more than that in executable
* Print the field name. There should only be one target field in
* stored rules. There could be more than that in executable
* target lists, but this function cannot be used for that case.
*/
Assert(list_length(fstore->fieldnums) == 1);
@ -6598,7 +6599,7 @@ generate_relation_name(Oid relid, List *namespaces)
* generate_function_name
* Compute the name to display for a function specified by OID,
* given that it is being called with the specified actual arg names and
* types. (Those matter because of ambiguous-function resolution rules.)
* types. (Those matter because of ambiguous-function resolution rules.)
*
* The result includes all necessary quoting and schema-prefixing. We can
* also pass back an indication of whether the function is variadic.
@ -6628,7 +6629,7 @@ generate_function_name(Oid funcid, int nargs, List *argnames,
/*
* The idea here is to schema-qualify only if the parser would fail to
* resolve the correct function given the unqualified func name with the
* specified argtypes. If the function is variadic, we should presume
* specified argtypes. If the function is variadic, we should presume
* that VARIADIC will be included in the call.
*/
p_result = func_get_detail(list_make1(makeString(proname)),

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.269 2010/02/14 18:42:16 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.270 2010/02/26 02:01:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -167,9 +167,9 @@ static double convert_timevalue_to_scalar(Datum value, Oid typid);
static bool get_variable_range(PlannerInfo *root, VariableStatData *vardata,
Oid sortop, Datum *min, Datum *max);
static bool get_actual_variable_range(PlannerInfo *root,
VariableStatData *vardata,
Oid sortop,
Datum *min, Datum *max);
VariableStatData *vardata,
Oid sortop,
Datum *min, Datum *max);
static Selectivity prefix_selectivity(PlannerInfo *root,
VariableStatData *vardata,
Oid vartype, Oid opfamily, Const *prefixcon);
@ -749,13 +749,13 @@ ineq_histogram_selectivity(PlannerInfo *root,
* results ... but probably not any more garbage-y than you would
* from the old linear search.)
*
* If the binary search accesses the first or last histogram entry,
* we try to replace that endpoint with the true column min or max
* as found by get_actual_variable_range(). This ameliorates
* misestimates when the min or max is moving as a result of
* changes since the last ANALYZE. Note that this could result
* in effectively including MCVs into the histogram that weren't
* there before, but we don't try to correct for that.
* If the binary search accesses the first or last histogram
* entry, we try to replace that endpoint with the true column min
* or max as found by get_actual_variable_range(). This
* ameliorates misestimates when the min or max is moving as a
* result of changes since the last ANALYZE. Note that this could
* result in effectively including MCVs into the histogram that
* weren't there before, but we don't try to correct for that.
*/
double histfrac;
int lobound = 0; /* first possible slot to search */
@ -3727,8 +3727,7 @@ convert_string_datum(Datum value, Oid typid)
/*
*
* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?
* FeedbackID=99694
*/
* FeedbackID=99694 */
{
char x[1];
@ -4118,8 +4117,8 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
else if (rte->rtekind == RTE_RELATION)
{
vardata->statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(rte->relid),
Int16GetDatum(var->varattno),
ObjectIdGetDatum(rte->relid),
Int16GetDatum(var->varattno),
BoolGetDatum(rte->inh));
vardata->freefunc = ReleaseSysCache;
}
@ -4259,8 +4258,8 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
vardata->statsTuple =
SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(index->indexoid),
Int16GetDatum(pos + 1),
BoolGetDatum(false));
Int16GetDatum(pos + 1),
BoolGetDatum(false));
vardata->freefunc = ReleaseSysCache;
}
if (vardata->statsTuple)
@ -4407,11 +4406,11 @@ get_variable_range(PlannerInfo *root, VariableStatData *vardata, Oid sortop,
int i;
/*
* XXX It's very tempting to try to use the actual column min and max,
* if we can get them relatively-cheaply with an index probe. However,
* since this function is called many times during join planning,
* that could have unpleasant effects on planning speed. Need more
* investigation before enabling this.
* XXX It's very tempting to try to use the actual column min and max, if
* we can get them relatively-cheaply with an index probe. However, since
* this function is called many times during join planning, that could
* have unpleasant effects on planning speed. Need more investigation
* before enabling this.
*/
#ifdef NOT_USED
if (get_actual_variable_range(root, vardata, sortop, min, max))
@ -4550,8 +4549,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
continue;
/*
* Ignore partial indexes --- we only want stats that cover the
* entire relation.
* Ignore partial indexes --- we only want stats that cover the entire
* relation.
*/
if (index->indpred != NIL)
continue;
@ -4577,8 +4576,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
continue;
/*
* Found a suitable index to extract data from. We'll need an
* EState and a bunch of other infrastructure.
* Found a suitable index to extract data from. We'll need an EState
* and a bunch of other infrastructure.
*/
{
EState *estate;
@ -4622,7 +4621,7 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
/* set up an IS NOT NULL scan key so that we ignore nulls */
ScanKeyEntryInitialize(&scankeys[0],
SK_ISNULL | SK_SEARCHNOTNULL,
1, /* index col to scan */
1, /* index col to scan */
InvalidStrategy, /* no strategy */
InvalidOid, /* no strategy subtype */
InvalidOid, /* no reg proc for this */
@ -4641,7 +4640,7 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
indexscandir)) != NULL)
{
/* Extract the index column values from the heap tuple */
ExecStoreTuple(tup, slot, InvalidBuffer, false);
ExecStoreTuple(tup, slot, InvalidBuffer, false);
FormIndexDatum(indexInfo, slot, estate,
values, isnull);
@ -4672,7 +4671,7 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
-indexscandir)) != NULL)
{
/* Extract the index column values from the heap tuple */
ExecStoreTuple(tup, slot, InvalidBuffer, false);
ExecStoreTuple(tup, slot, InvalidBuffer, false);
FormIndexDatum(indexInfo, slot, estate,
values, isnull);
@ -4872,8 +4871,8 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive,
/*
* Check for ARE director prefix. It's worth our trouble to recognize
* this because similar_escape() used to use it, and some other code
* might still use it, to force ARE mode.
* this because similar_escape() used to use it, and some other code might
* still use it, to force ARE mode.
*/
pos = 0;
if (strncmp(patt, "***:", 4) == 0)
@ -5808,7 +5807,7 @@ genericcostestimate(PlannerInfo *root,
* since that's internal to the indexscan.)
*/
*indexTotalCost = (pages_fetched * spc_random_page_cost)
/ num_outer_scans;
/ num_outer_scans;
}
else
{

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.205 2010/01/02 16:57:55 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.206 2010/02/26 02:01:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -2780,11 +2780,11 @@ interval_mi(PG_FUNCTION_ARGS)
}
/*
* There is no interval_abs(): it is unclear what value to return:
* http://archives.postgresql.org/pgsql-general/2009-10/msg01031.php
* http://archives.postgresql.org/pgsql-general/2009-11/msg00041.php
* There is no interval_abs(): it is unclear what value to return:
* http://archives.postgresql.org/pgsql-general/2009-10/msg01031.php
* http://archives.postgresql.org/pgsql-general/2009-11/msg00041.php
*/
Datum
interval_mul(PG_FUNCTION_ARGS)
{

View File

@ -14,7 +14,7 @@
* Author: Jan Wieck, Afilias USA INC.
* 64-bit txids: Marko Kreen, Skype Technologies
*
* $PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.12 2010/02/20 21:24:02 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.13 2010/02/26 02:01:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -330,11 +330,10 @@ txid_current(PG_FUNCTION_ARGS)
TxidEpoch state;
/*
* Must prevent during recovery because if an xid is
* not assigned we try to assign one, which would fail.
* Programs already rely on this function to always
* return a valid current xid, so we should not change
* this to return NULL or similar invalid xid.
* Must prevent during recovery because if an xid is not assigned we try
* to assign one, which would fail. Programs already rely on this function
* to always return a valid current xid, so we should not change this to
* return NULL or similar invalid xid.
*/
PreventCommandDuringRecovery("txid_current()");

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.64 2010/01/25 20:55:32 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.65 2010/02/26 02:01:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -25,7 +25,7 @@
static VarBit *bit_catenate(VarBit *arg1, VarBit *arg2);
static VarBit *bitsubstring(VarBit *arg, int32 s, int32 l,
bool length_not_specified);
bool length_not_specified);
static VarBit *bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl);
@ -980,9 +980,10 @@ bitsubstring(VarBit *arg, int32 s, int32 l, bool length_not_specified)
else
{
e = s + l;
/*
* A negative value for L is the only way for the end position
* to be before the start. SQL99 says to throw an error.
* A negative value for L is the only way for the end position to be
* before the start. SQL99 says to throw an error.
*/
if (e < s)
ereport(ERROR,
@ -1055,8 +1056,8 @@ bitoverlay(PG_FUNCTION_ARGS)
{
VarBit *t1 = PG_GETARG_VARBIT_P(0);
VarBit *t2 = PG_GETARG_VARBIT_P(1);
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl = PG_GETARG_INT32(3); /* substring length */
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl = PG_GETARG_INT32(3); /* substring length */
PG_RETURN_VARBIT_P(bit_overlay(t1, t2, sp, sl));
}
@ -1066,10 +1067,10 @@ bitoverlay_no_len(PG_FUNCTION_ARGS)
{
VarBit *t1 = PG_GETARG_VARBIT_P(0);
VarBit *t2 = PG_GETARG_VARBIT_P(1);
int sp = PG_GETARG_INT32(2); /* substring start position */
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl;
sl = VARBITLEN(t2); /* defaults to length(t2) */
sl = VARBITLEN(t2); /* defaults to length(t2) */
PG_RETURN_VARBIT_P(bit_overlay(t1, t2, sp, sl));
}
@ -1082,9 +1083,9 @@ bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl)
int sp_pl_sl;
/*
* Check for possible integer-overflow cases. For negative sp,
* throw a "substring length" error because that's what should be
* expected according to the spec's definition of OVERLAY().
* Check for possible integer-overflow cases. For negative sp, throw a
* "substring length" error because that's what should be expected
* according to the spec's definition of OVERLAY().
*/
if (sp <= 0)
ereport(ERROR,
@ -1096,7 +1097,7 @@ bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl)
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range")));
s1 = bitsubstring(t1, 1, sp-1, false);
s1 = bitsubstring(t1, 1, sp - 1, false);
s2 = bitsubstring(t1, sp_pl_sl, -1, true);
result = bit_catenate(s1, t2);
result = bit_catenate(result, s2);
@ -1446,7 +1447,7 @@ bitfromint4(PG_FUNCTION_ARGS)
/* store first fractional byte */
if (destbitsleft > srcbitsleft)
{
int val = (int) (a >> (destbitsleft - 8));
int val = (int) (a >> (destbitsleft - 8));
/* Force sign-fill in case the compiler implements >> as zero-fill */
if (a < 0)
@ -1526,7 +1527,7 @@ bitfromint8(PG_FUNCTION_ARGS)
/* store first fractional byte */
if (destbitsleft > srcbitsleft)
{
int val = (int) (a >> (destbitsleft - 8));
int val = (int) (a >> (destbitsleft - 8));
/* Force sign-fill in case the compiler implements >> as zero-fill */
if (a < 0)
@ -1708,6 +1709,7 @@ bitsetbit(PG_FUNCTION_ARGS)
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
errmsg("bit index %d out of valid range (0..%d)",
n, bitlen - 1)));
/*
* sanity check!
*/

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.176 2010/02/08 20:39:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.177 2010/02/26 02:01:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -30,7 +30,7 @@
/* GUC variable */
int bytea_output = BYTEA_OUTPUT_HEX;
int bytea_output = BYTEA_OUTPUT_HEX;
typedef struct varlena unknown;
@ -205,12 +205,12 @@ byteain(PG_FUNCTION_ARGS)
/* Recognize hex input */
if (inputText[0] == '\\' && inputText[1] == 'x')
{
size_t len = strlen(inputText);
size_t len = strlen(inputText);
bc = (len - 2)/2 + VARHDRSZ; /* maximum possible length */
bc = (len - 2) / 2 + VARHDRSZ; /* maximum possible length */
result = palloc(bc);
bc = hex_decode(inputText + 2, len - 2, VARDATA(result));
SET_VARSIZE(result, bc + VARHDRSZ); /* actual length */
SET_VARSIZE(result, bc + VARHDRSZ); /* actual length */
PG_RETURN_BYTEA_P(result);
}
@ -306,47 +306,47 @@ byteaout(PG_FUNCTION_ARGS)
}
else if (bytea_output == BYTEA_OUTPUT_ESCAPE)
{
/* Print traditional escaped format */
char *vp;
int len;
int i;
/* Print traditional escaped format */
char *vp;
int len;
int i;
len = 1; /* empty string has 1 char */
vp = VARDATA_ANY(vlena);
for (i = VARSIZE_ANY_EXHDR(vlena); i != 0; i--, vp++)
{
if (*vp == '\\')
len += 2;
else if ((unsigned char) *vp < 0x20 || (unsigned char) *vp > 0x7e)
len += 4;
else
len++;
}
rp = result = (char *) palloc(len);
vp = VARDATA_ANY(vlena);
for (i = VARSIZE_ANY_EXHDR(vlena); i != 0; i--, vp++)
{
if (*vp == '\\')
len = 1; /* empty string has 1 char */
vp = VARDATA_ANY(vlena);
for (i = VARSIZE_ANY_EXHDR(vlena); i != 0; i--, vp++)
{
*rp++ = '\\';
*rp++ = '\\';
if (*vp == '\\')
len += 2;
else if ((unsigned char) *vp < 0x20 || (unsigned char) *vp > 0x7e)
len += 4;
else
len++;
}
else if ((unsigned char) *vp < 0x20 || (unsigned char) *vp > 0x7e)
rp = result = (char *) palloc(len);
vp = VARDATA_ANY(vlena);
for (i = VARSIZE_ANY_EXHDR(vlena); i != 0; i--, vp++)
{
int val; /* holds unprintable chars */
if (*vp == '\\')
{
*rp++ = '\\';
*rp++ = '\\';
}
else if ((unsigned char) *vp < 0x20 || (unsigned char) *vp > 0x7e)
{
int val; /* holds unprintable chars */
val = *vp;
rp[0] = '\\';
rp[3] = DIG(val & 07);
val >>= 3;
rp[2] = DIG(val & 07);
val >>= 3;
rp[1] = DIG(val & 03);
rp += 4;
val = *vp;
rp[0] = '\\';
rp[3] = DIG(val & 07);
val >>= 3;
rp[2] = DIG(val & 07);
val >>= 3;
rp[1] = DIG(val & 03);
rp += 4;
}
else
*rp++ = *vp;
}
else
*rp++ = *vp;
}
}
else
{
@ -900,8 +900,8 @@ textoverlay(PG_FUNCTION_ARGS)
{
text *t1 = PG_GETARG_TEXT_PP(0);
text *t2 = PG_GETARG_TEXT_PP(1);
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl = PG_GETARG_INT32(3); /* substring length */
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl = PG_GETARG_INT32(3); /* substring length */
PG_RETURN_TEXT_P(text_overlay(t1, t2, sp, sl));
}
@ -911,10 +911,10 @@ textoverlay_no_len(PG_FUNCTION_ARGS)
{
text *t1 = PG_GETARG_TEXT_PP(0);
text *t2 = PG_GETARG_TEXT_PP(1);
int sp = PG_GETARG_INT32(2); /* substring start position */
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl;
sl = text_length(PointerGetDatum(t2)); /* defaults to length(t2) */
sl = text_length(PointerGetDatum(t2)); /* defaults to length(t2) */
PG_RETURN_TEXT_P(text_overlay(t1, t2, sp, sl));
}
@ -927,9 +927,9 @@ text_overlay(text *t1, text *t2, int sp, int sl)
int sp_pl_sl;
/*
* Check for possible integer-overflow cases. For negative sp,
* throw a "substring length" error because that's what should be
* expected according to the spec's definition of OVERLAY().
* Check for possible integer-overflow cases. For negative sp, throw a
* "substring length" error because that's what should be expected
* according to the spec's definition of OVERLAY().
*/
if (sp <= 0)
ereport(ERROR,
@ -941,7 +941,7 @@ text_overlay(text *t1, text *t2, int sp, int sl)
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range")));
s1 = text_substring(PointerGetDatum(t1), 1, sp-1, false);
s1 = text_substring(PointerGetDatum(t1), 1, sp - 1, false);
s2 = text_substring(PointerGetDatum(t1), sp_pl_sl, -1, true);
result = text_catenate(s1, t2);
result = text_catenate(result, s2);
@ -1823,8 +1823,8 @@ bytea_substring(Datum str,
if (length_not_specified)
{
/*
* Not passed a length - DatumGetByteaPSlice() grabs everything to
* the end of the string if we pass it a negative value for length.
* Not passed a length - DatumGetByteaPSlice() grabs everything to the
* end of the string if we pass it a negative value for length.
*/
L1 = -1;
}
@ -1855,8 +1855,8 @@ bytea_substring(Datum str,
/*
* If the start position is past the end of the string, SQL99 says to
* return a zero-length string -- DatumGetByteaPSlice() will do that
* for us. Convert to zero-based starting position
* return a zero-length string -- DatumGetByteaPSlice() will do that for
* us. Convert to zero-based starting position
*/
return DatumGetByteaPSlice(str, S1 - 1, L1);
}
@ -1873,8 +1873,8 @@ byteaoverlay(PG_FUNCTION_ARGS)
{
bytea *t1 = PG_GETARG_BYTEA_PP(0);
bytea *t2 = PG_GETARG_BYTEA_PP(1);
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl = PG_GETARG_INT32(3); /* substring length */
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl = PG_GETARG_INT32(3); /* substring length */
PG_RETURN_BYTEA_P(bytea_overlay(t1, t2, sp, sl));
}
@ -1884,10 +1884,10 @@ byteaoverlay_no_len(PG_FUNCTION_ARGS)
{
bytea *t1 = PG_GETARG_BYTEA_PP(0);
bytea *t2 = PG_GETARG_BYTEA_PP(1);
int sp = PG_GETARG_INT32(2); /* substring start position */
int sp = PG_GETARG_INT32(2); /* substring start position */
int sl;
sl = VARSIZE_ANY_EXHDR(t2); /* defaults to length(t2) */
sl = VARSIZE_ANY_EXHDR(t2); /* defaults to length(t2) */
PG_RETURN_BYTEA_P(bytea_overlay(t1, t2, sp, sl));
}
@ -1900,9 +1900,9 @@ bytea_overlay(bytea *t1, bytea *t2, int sp, int sl)
int sp_pl_sl;
/*
* Check for possible integer-overflow cases. For negative sp,
* throw a "substring length" error because that's what should be
* expected according to the spec's definition of OVERLAY().
* Check for possible integer-overflow cases. For negative sp, throw a
* "substring length" error because that's what should be expected
* according to the spec's definition of OVERLAY().
*/
if (sp <= 0)
ereport(ERROR,
@ -1914,7 +1914,7 @@ bytea_overlay(bytea *t1, bytea *t2, int sp, int sl)
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range")));
s1 = bytea_substring(PointerGetDatum(t1), 1, sp-1, false);
s1 = bytea_substring(PointerGetDatum(t1), 1, sp - 1, false);
s2 = bytea_substring(PointerGetDatum(t1), sp_pl_sl, -1, true);
result = bytea_catenate(s1, t2);
result = bytea_catenate(result, s2);
@ -3331,9 +3331,9 @@ pg_column_size(PG_FUNCTION_ARGS)
static StringInfo
makeStringAggState(FunctionCallInfo fcinfo)
{
StringInfo state;
MemoryContext aggcontext;
MemoryContext oldcontext;
StringInfo state;
MemoryContext aggcontext;
MemoryContext oldcontext;
if (!AggCheckCallContext(fcinfo, &aggcontext))
{
@ -3355,7 +3355,7 @@ makeStringAggState(FunctionCallInfo fcinfo)
Datum
string_agg_transfn(PG_FUNCTION_ARGS)
{
StringInfo state;
StringInfo state;
state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);
@ -3364,20 +3364,20 @@ string_agg_transfn(PG_FUNCTION_ARGS)
{
if (state == NULL)
state = makeStringAggState(fcinfo);
appendStringInfoText(state, PG_GETARG_TEXT_PP(1)); /* value */
appendStringInfoText(state, PG_GETARG_TEXT_PP(1)); /* value */
}
/*
* The transition type for string_agg() is declared to be "internal", which
* is a pass-by-value type the same size as a pointer.
* The transition type for string_agg() is declared to be "internal",
* which is a pass-by-value type the same size as a pointer.
*/
PG_RETURN_POINTER(state);
}
Datum
Datum
string_agg_delim_transfn(PG_FUNCTION_ARGS)
{
StringInfo state;
StringInfo state;
state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);
@ -3390,12 +3390,12 @@ string_agg_delim_transfn(PG_FUNCTION_ARGS)
else if (!PG_ARGISNULL(2))
appendStringInfoText(state, PG_GETARG_TEXT_PP(2)); /* delimiter */
appendStringInfoText(state, PG_GETARG_TEXT_PP(1)); /* value */
appendStringInfoText(state, PG_GETARG_TEXT_PP(1)); /* value */
}
/*
* The transition type for string_agg() is declared to be "internal", which
* is a pass-by-value type the same size as a pointer.
* The transition type for string_agg() is declared to be "internal",
* which is a pass-by-value type the same size as a pointer.
*/
PG_RETURN_POINTER(state);
}
@ -3403,7 +3403,7 @@ string_agg_delim_transfn(PG_FUNCTION_ARGS)
Datum
string_agg_finalfn(PG_FUNCTION_ARGS)
{
StringInfo state;
StringInfo state;
/* cannot be called directly because of internal-type argument */
Assert(AggCheckCallContext(fcinfo, NULL));