mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
pgindent run for 8.3.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.369 2007/10/25 13:48:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.370 2007/11/15 21:14:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -61,7 +61,7 @@ static List *transformReturningList(ParseState *pstate, List *returningList);
|
||||
static Query *transformDeclareCursorStmt(ParseState *pstate,
|
||||
DeclareCursorStmt *stmt);
|
||||
static Query *transformExplainStmt(ParseState *pstate,
|
||||
ExplainStmt *stmt);
|
||||
ExplainStmt *stmt);
|
||||
static void transformLockingClause(Query *qry, LockingClause *lc);
|
||||
static bool check_parameter_resolution_walker(Node *node,
|
||||
check_parameter_resolution_context *context);
|
||||
@@ -77,7 +77,7 @@ static bool check_parameter_resolution_walker(Node *node,
|
||||
* Optionally, information about $n parameter types can be supplied.
|
||||
* References to $n indexes not defined by paramTypes[] are disallowed.
|
||||
*
|
||||
* The result is a Query node. Optimizable statements require considerable
|
||||
* The result is a Query node. Optimizable statements require considerable
|
||||
* transformation, while utility-type statements are simply hung off
|
||||
* a dummy CMD_UTILITY Query node.
|
||||
*/
|
||||
@@ -1565,7 +1565,7 @@ transformReturningList(ParseState *pstate, List *returningList)
|
||||
if (list_length(pstate->p_rtable) != length_rtable)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("RETURNING cannot contain references to other relations")));
|
||||
errmsg("RETURNING cannot contain references to other relations")));
|
||||
|
||||
/* mark column origins */
|
||||
markTargetListOrigins(pstate, rlist);
|
||||
@@ -1620,21 +1620,21 @@ transformDeclareCursorStmt(ParseState *pstate, DeclareCursorStmt *stmt)
|
||||
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_HOLD))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("DECLARE CURSOR WITH HOLD ... FOR UPDATE/SHARE is not supported"),
|
||||
errmsg("DECLARE CURSOR WITH HOLD ... FOR UPDATE/SHARE is not supported"),
|
||||
errdetail("Holdable cursors must be READ ONLY.")));
|
||||
|
||||
/* FOR UPDATE and SCROLL are not compatible */
|
||||
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_SCROLL))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("DECLARE SCROLL CURSOR ... FOR UPDATE/SHARE is not supported"),
|
||||
errmsg("DECLARE SCROLL CURSOR ... FOR UPDATE/SHARE is not supported"),
|
||||
errdetail("Scrollable cursors must be READ ONLY.")));
|
||||
|
||||
/* FOR UPDATE and INSENSITIVE are not compatible */
|
||||
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_INSENSITIVE))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("DECLARE INSENSITIVE CURSOR ... FOR UPDATE/SHARE is not supported"),
|
||||
errmsg("DECLARE INSENSITIVE CURSOR ... FOR UPDATE/SHARE is not supported"),
|
||||
errdetail("Insensitive cursors must be READ ONLY.")));
|
||||
|
||||
/* We won't need the raw querytree any more */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.192 2007/09/24 01:29:29 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.193 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -387,13 +387,14 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"when", WHEN, RESERVED_KEYWORD},
|
||||
{"where", WHERE, RESERVED_KEYWORD},
|
||||
{"whitespace", WHITESPACE_P, UNRESERVED_KEYWORD},
|
||||
|
||||
/*
|
||||
* XXX we mark WITH as reserved to force it to be quoted in dumps, even
|
||||
* though it is currently unreserved according to gram.y. This is because
|
||||
* we expect we'll have to make it reserved to implement SQL WITH clauses.
|
||||
* If that patch manages to do without reserving WITH, adjust this entry
|
||||
* at that time; in any case this should be back in sync with gram.y
|
||||
* after WITH clauses are implemented.
|
||||
* at that time; in any case this should be back in sync with gram.y after
|
||||
* WITH clauses are implemented.
|
||||
*/
|
||||
{"with", WITH, RESERVED_KEYWORD},
|
||||
{"without", WITHOUT, UNRESERVED_KEYWORD},
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.166 2007/06/23 22:12:51 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.167 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -152,8 +152,8 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
|
||||
* Open target rel and grab suitable lock (which we will hold till end of
|
||||
* transaction).
|
||||
*
|
||||
* free_parsestate() will eventually do the corresponding
|
||||
* heap_close(), but *not* release the lock.
|
||||
* free_parsestate() will eventually do the corresponding heap_close(),
|
||||
* but *not* release the lock.
|
||||
*/
|
||||
pstate->p_target_relation = heap_openrv(relation, RowExclusiveLock);
|
||||
|
||||
@@ -1665,21 +1665,22 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
|
||||
restype,
|
||||
restype,
|
||||
false);
|
||||
|
||||
/*
|
||||
* Verify it's a valid ordering operator, and determine
|
||||
* whether to consider it like ASC or DESC.
|
||||
* Verify it's a valid ordering operator, and determine whether to
|
||||
* consider it like ASC or DESC.
|
||||
*/
|
||||
if (!get_compare_function_for_ordering_op(sortop,
|
||||
&cmpfunc, &reverse))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("operator %s is not a valid ordering operator",
|
||||
strVal(llast(sortby_opname))),
|
||||
errmsg("operator %s is not a valid ordering operator",
|
||||
strVal(llast(sortby_opname))),
|
||||
errhint("Ordering operators must be \"<\" or \">\" members of btree operator families.")));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized sortby_dir: %d", sortby_dir);
|
||||
sortop = InvalidOid; /* keep compiler quiet */
|
||||
sortop = InvalidOid; /* keep compiler quiet */
|
||||
reverse = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.157 2007/09/06 17:31:58 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.158 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,10 +37,10 @@ static Node *coerce_type_typmod(Node *node,
|
||||
bool hideInputCoercion);
|
||||
static void hide_coercion_node(Node *node);
|
||||
static Node *build_coercion_expression(Node *node,
|
||||
CoercionPathType pathtype,
|
||||
Oid funcId,
|
||||
Oid targetTypeId, int32 targetTypMod,
|
||||
CoercionForm cformat, bool isExplicit);
|
||||
CoercionPathType pathtype,
|
||||
Oid funcId,
|
||||
Oid targetTypeId, int32 targetTypMod,
|
||||
CoercionForm cformat, bool isExplicit);
|
||||
static Node *coerce_record_to_complex(ParseState *pstate, Node *node,
|
||||
Oid targetTypeId,
|
||||
CoercionContext ccontext,
|
||||
@@ -142,7 +142,7 @@ coerce_type(ParseState *pstate, Node *node,
|
||||
*
|
||||
* Note: by returning the unmodified node here, we are saying that
|
||||
* it's OK to treat an UNKNOWN constant as a valid input for a
|
||||
* function accepting ANY, ANYELEMENT, or ANYNONARRAY. This should be
|
||||
* function accepting ANY, ANYELEMENT, or ANYNONARRAY. This should be
|
||||
* all right, since an UNKNOWN value is still a perfectly valid Datum.
|
||||
* However an UNKNOWN value is definitely *not* an array, and so we
|
||||
* mustn't accept it for ANYARRAY. (Instead, we will call anyarray_in
|
||||
@@ -271,12 +271,13 @@ coerce_type(ParseState *pstate, Node *node,
|
||||
}
|
||||
|
||||
param->paramtype = targetTypeId;
|
||||
|
||||
/*
|
||||
* Note: it is tempting here to set the Param's paramtypmod to
|
||||
* targetTypeMod, but that is probably unwise because we have no
|
||||
* infrastructure that enforces that the value delivered for a
|
||||
* Param will match any particular typmod. Leaving it -1 ensures
|
||||
* that a run-time length check/coercion will occur if needed.
|
||||
* infrastructure that enforces that the value delivered for a Param
|
||||
* will match any particular typmod. Leaving it -1 ensures that a
|
||||
* run-time length check/coercion will occur if needed.
|
||||
*/
|
||||
param->paramtypmod = -1;
|
||||
|
||||
@@ -720,10 +721,11 @@ build_coercion_expression(Node *node,
|
||||
acoerce->arg = (Expr *) node;
|
||||
acoerce->elemfuncid = funcId;
|
||||
acoerce->resulttype = targetTypeId;
|
||||
|
||||
/*
|
||||
* Label the output as having a particular typmod only if we are
|
||||
* really invoking a length-coercion function, ie one with more
|
||||
* than one argument.
|
||||
* really invoking a length-coercion function, ie one with more than
|
||||
* one argument.
|
||||
*/
|
||||
acoerce->resulttypmod = (nargs >= 2) ? targetTypMod : -1;
|
||||
acoerce->isExplicit = isExplicit;
|
||||
@@ -934,10 +936,10 @@ coerce_to_specific_type(ParseState *pstate, Node *node,
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
/* translator: first %s is name of a SQL construct, eg LIMIT */
|
||||
errmsg("argument of %s must be type %s, not type %s",
|
||||
constructName,
|
||||
format_type_be(targetTypeId),
|
||||
format_type_be(inputTypeId))));
|
||||
errmsg("argument of %s must be type %s, not type %s",
|
||||
constructName,
|
||||
format_type_be(targetTypeId),
|
||||
format_type_be(inputTypeId))));
|
||||
}
|
||||
|
||||
if (expression_returns_set(node))
|
||||
@@ -1304,7 +1306,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
|
||||
|
||||
/*
|
||||
* Fast Track: if none of the arguments are polymorphic, return the
|
||||
* unmodified rettype. We assume it can't be polymorphic either.
|
||||
* unmodified rettype. We assume it can't be polymorphic either.
|
||||
*/
|
||||
if (!have_generics)
|
||||
return rettype;
|
||||
@@ -1359,8 +1361,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
|
||||
if (type_is_array(elem_typeid))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
errmsg("type matched to anynonarray is an array type: %s",
|
||||
format_type_be(elem_typeid))));
|
||||
errmsg("type matched to anynonarray is an array type: %s",
|
||||
format_type_be(elem_typeid))));
|
||||
}
|
||||
|
||||
if (have_anyenum)
|
||||
@@ -1921,13 +1923,12 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
|
||||
/*
|
||||
* If we still haven't found a possibility, consider automatic casting
|
||||
* using I/O functions. We allow assignment casts to textual types
|
||||
* and explicit casts from textual types to be handled this way.
|
||||
* (The CoerceViaIO mechanism is a lot more general than that, but
|
||||
* this is all we want to allow in the absence of a pg_cast entry.)
|
||||
* It would probably be better to insist on explicit casts in both
|
||||
* directions, but this is a compromise to preserve something of the
|
||||
* pre-8.3 behavior that many types had implicit (yipes!) casts to
|
||||
* text.
|
||||
* and explicit casts from textual types to be handled this way. (The
|
||||
* CoerceViaIO mechanism is a lot more general than that, but this is
|
||||
* all we want to allow in the absence of a pg_cast entry.) It would
|
||||
* probably be better to insist on explicit casts in both directions,
|
||||
* but this is a compromise to preserve something of the pre-8.3
|
||||
* behavior that many types had implicit (yipes!) casts to text.
|
||||
*/
|
||||
if (result == COERCION_PATH_NONE)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.223 2007/11/11 19:22:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.224 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -56,10 +56,10 @@ static Node *transformArrayExpr(ParseState *pstate, ArrayExpr *a);
|
||||
static Node *transformRowExpr(ParseState *pstate, RowExpr *r);
|
||||
static Node *transformCoalesceExpr(ParseState *pstate, CoalesceExpr *c);
|
||||
static Node *transformMinMaxExpr(ParseState *pstate, MinMaxExpr *m);
|
||||
static Node *transformXmlExpr(ParseState *pstate, XmlExpr *x);
|
||||
static Node *transformXmlSerialize(ParseState *pstate, XmlSerialize *xs);
|
||||
static Node *transformXmlExpr(ParseState *pstate, XmlExpr * x);
|
||||
static Node *transformXmlSerialize(ParseState *pstate, XmlSerialize * xs);
|
||||
static Node *transformBooleanTest(ParseState *pstate, BooleanTest *b);
|
||||
static Node *transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr);
|
||||
static Node *transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr * cexpr);
|
||||
static Node *transformColumnRef(ParseState *pstate, ColumnRef *cref);
|
||||
static Node *transformWholeRowRef(ParseState *pstate, char *schemaname,
|
||||
char *relname, int location);
|
||||
@@ -545,7 +545,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
static Oid *
|
||||
find_param_type(ParseState *pstate, int paramno)
|
||||
{
|
||||
Oid *result;
|
||||
Oid *result;
|
||||
|
||||
/*
|
||||
* Find topmost ParseState, which is where paramtype info lives.
|
||||
@@ -612,7 +612,7 @@ exprIsNullConstant(Node *arg)
|
||||
{
|
||||
if (arg && IsA(arg, A_Const))
|
||||
{
|
||||
A_Const *con = (A_Const *) arg;
|
||||
A_Const *con = (A_Const *) arg;
|
||||
|
||||
if (con->val.type == T_Null &&
|
||||
con->typename == NULL)
|
||||
@@ -1411,10 +1411,10 @@ transformMinMaxExpr(ParseState *pstate, MinMaxExpr *m)
|
||||
}
|
||||
|
||||
static Node *
|
||||
transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
||||
transformXmlExpr(ParseState *pstate, XmlExpr * x)
|
||||
{
|
||||
XmlExpr *newx = makeNode(XmlExpr);
|
||||
ListCell *lc;
|
||||
XmlExpr *newx = makeNode(XmlExpr);
|
||||
ListCell *lc;
|
||||
int i;
|
||||
|
||||
newx->op = x->op;
|
||||
@@ -1424,7 +1424,7 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
||||
newx->name = NULL;
|
||||
|
||||
/*
|
||||
* gram.y built the named args as a list of ResTarget. Transform each,
|
||||
* gram.y built the named args as a list of ResTarget. Transform each,
|
||||
* and break the names out as a separate list.
|
||||
*/
|
||||
newx->named_args = NIL;
|
||||
@@ -1432,9 +1432,9 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
||||
|
||||
foreach(lc, x->named_args)
|
||||
{
|
||||
ResTarget *r = (ResTarget *) lfirst(lc);
|
||||
Node *expr;
|
||||
char *argname;
|
||||
ResTarget *r = (ResTarget *) lfirst(lc);
|
||||
Node *expr;
|
||||
char *argname;
|
||||
|
||||
Assert(IsA(r, ResTarget));
|
||||
|
||||
@@ -1450,7 +1450,7 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
x->op == IS_XMLELEMENT
|
||||
? errmsg("unnamed XML attribute value must be a column reference")
|
||||
? errmsg("unnamed XML attribute value must be a column reference")
|
||||
: errmsg("unnamed XML element value must be a column reference")));
|
||||
argname = NULL; /* keep compiler quiet */
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
||||
{
|
||||
foreach(lc, newx->arg_names)
|
||||
{
|
||||
ListCell *lc2;
|
||||
ListCell *lc2;
|
||||
|
||||
for_each_cell(lc2, lnext(lc))
|
||||
{
|
||||
@@ -1537,16 +1537,16 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
|
||||
}
|
||||
|
||||
static Node *
|
||||
transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
|
||||
transformXmlSerialize(ParseState *pstate, XmlSerialize * xs)
|
||||
{
|
||||
Oid targetType;
|
||||
int32 targetTypmod;
|
||||
XmlExpr *xexpr;
|
||||
XmlExpr *xexpr;
|
||||
|
||||
xexpr = makeNode(XmlExpr);
|
||||
xexpr->op = IS_XMLSERIALIZE;
|
||||
xexpr->args = list_make1(coerce_to_specific_type(pstate,
|
||||
transformExpr(pstate, xs->expr),
|
||||
transformExpr(pstate, xs->expr),
|
||||
XMLOID,
|
||||
"XMLSERIALIZE"));
|
||||
|
||||
@@ -1558,13 +1558,13 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
|
||||
xexpr->typmod = targetTypmod;
|
||||
|
||||
/*
|
||||
* The actual target type is determined this way. SQL allows char
|
||||
* and varchar as target types. We allow anything that can be
|
||||
* cast implicitly from text. This way, user-defined text-like
|
||||
* data types automatically fit in.
|
||||
* The actual target type is determined this way. SQL allows char and
|
||||
* varchar as target types. We allow anything that can be cast implicitly
|
||||
* from text. This way, user-defined text-like data types automatically
|
||||
* fit in.
|
||||
*/
|
||||
return (Node *) coerce_to_target_type(pstate, (Node *) xexpr, TEXTOID, targetType, targetTypmod,
|
||||
COERCION_IMPLICIT, COERCE_IMPLICIT_CAST);
|
||||
COERCION_IMPLICIT, COERCE_IMPLICIT_CAST);
|
||||
}
|
||||
|
||||
static Node *
|
||||
@@ -1608,9 +1608,9 @@ transformBooleanTest(ParseState *pstate, BooleanTest *b)
|
||||
}
|
||||
|
||||
static Node *
|
||||
transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr)
|
||||
transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr * cexpr)
|
||||
{
|
||||
int sublevels_up;
|
||||
int sublevels_up;
|
||||
|
||||
/* CURRENT OF can only appear at top level of UPDATE/DELETE */
|
||||
Assert(pstate->p_target_rangetblentry != NULL);
|
||||
@@ -1851,7 +1851,7 @@ exprType(Node *expr)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("could not find array type for data type %s",
|
||||
format_type_be(subplan->firstColType))));
|
||||
format_type_be(subplan->firstColType))));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2153,8 +2153,8 @@ exprIsLengthCoercion(Node *expr, int32 *coercedTypmod)
|
||||
*coercedTypmod = -1; /* default result on failure */
|
||||
|
||||
/*
|
||||
* Scalar-type length coercions are FuncExprs, array-type length
|
||||
* coercions are ArrayCoerceExprs
|
||||
* Scalar-type length coercions are FuncExprs, array-type length coercions
|
||||
* are ArrayCoerceExprs
|
||||
*/
|
||||
if (expr && IsA(expr, FuncExpr))
|
||||
{
|
||||
@@ -2336,9 +2336,9 @@ make_row_comparison_op(ParseState *pstate, List *opname,
|
||||
|
||||
/*
|
||||
* Now we must determine which row comparison semantics (= <> < <= > >=)
|
||||
* apply to this set of operators. We look for btree opfamilies containing
|
||||
* the operators, and see which interpretations (strategy numbers) exist
|
||||
* for each operator.
|
||||
* apply to this set of operators. We look for btree opfamilies
|
||||
* containing the operators, and see which interpretations (strategy
|
||||
* numbers) exist for each operator.
|
||||
*/
|
||||
opfamily_lists = (List **) palloc(nopers * sizeof(List *));
|
||||
opstrat_lists = (List **) palloc(nopers * sizeof(List *));
|
||||
@@ -2421,7 +2421,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
|
||||
}
|
||||
if (OidIsValid(opfamily))
|
||||
opfamilies = lappend_oid(opfamilies, opfamily);
|
||||
else /* should not happen */
|
||||
else /* should not happen */
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("could not determine interpretation of row comparison operator %s",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.198 2007/11/11 19:22:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.199 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -727,9 +727,9 @@ func_get_detail(List *funcname,
|
||||
* This interpretation needs to be given higher priority than
|
||||
* interpretations involving a type coercion followed by a function
|
||||
* call, otherwise we can produce surprising results. For example, we
|
||||
* want "text(varchar)" to be interpreted as a simple coercion, not
|
||||
* as "text(name(varchar))" which the code below this point is
|
||||
* entirely capable of selecting.
|
||||
* want "text(varchar)" to be interpreted as a simple coercion, not as
|
||||
* "text(name(varchar))" which the code below this point is entirely
|
||||
* capable of selecting.
|
||||
*
|
||||
* We also treat a coercion of a previously-unknown-type literal
|
||||
* constant to a specific type this way.
|
||||
@@ -738,8 +738,8 @@ func_get_detail(List *funcname,
|
||||
* cast implementation function to be named after the target type.
|
||||
* Thus the function will be found by normal lookup if appropriate.
|
||||
*
|
||||
* The reason we reject COERCION_PATH_ARRAYCOERCE is mainly that
|
||||
* you can't write "foo[] (something)" as a function call. In theory
|
||||
* The reason we reject COERCION_PATH_ARRAYCOERCE is mainly that you
|
||||
* can't write "foo[] (something)" as a function call. In theory
|
||||
* someone might want to invoke it as "_foo (something)" but we have
|
||||
* never supported that historically, so we can insist that people
|
||||
* write it as a normal cast instead. Lack of historical support is
|
||||
@@ -747,7 +747,7 @@ func_get_detail(List *funcname,
|
||||
*
|
||||
* NB: it's important that this code does not exceed 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
|
||||
* 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!
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.96 2007/11/11 19:22:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.97 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -887,8 +887,8 @@ make_scalar_array_op(ParseState *pstate, List *opname,
|
||||
|
||||
/*
|
||||
* enforce consistency with polymorphic argument and return types,
|
||||
* possibly adjusting return type or declared_arg_types (which will
|
||||
* be used as the cast destination by make_fn_arguments)
|
||||
* possibly adjusting return type or declared_arg_types (which will be
|
||||
* used as the cast destination by make_fn_arguments)
|
||||
*/
|
||||
rettype = enforce_generic_type_consistency(actual_arg_types,
|
||||
declared_arg_types,
|
||||
@@ -997,8 +997,8 @@ make_op_expr(ParseState *pstate, Operator op,
|
||||
|
||||
/*
|
||||
* enforce consistency with polymorphic argument and return types,
|
||||
* possibly adjusting return type or declared_arg_types (which will
|
||||
* be used as the cast destination by make_fn_arguments)
|
||||
* possibly adjusting return type or declared_arg_types (which will be
|
||||
* used as the cast destination by make_fn_arguments)
|
||||
*/
|
||||
rettype = enforce_generic_type_consistency(actual_arg_types,
|
||||
declared_arg_types,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.156 2007/09/27 17:42:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.157 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -827,8 +827,8 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
|
||||
*
|
||||
* Since the grammar only accepts bare '*' at top level of SELECT, we
|
||||
* need not handle the targetlist==false case here. However, we must
|
||||
* test for it because the grammar currently fails to distinguish
|
||||
* a quoted name "*" from a real asterisk.
|
||||
* test for it because the grammar currently fails to distinguish a
|
||||
* quoted name "*" from a real asterisk.
|
||||
*/
|
||||
if (!targetlist)
|
||||
elog(ERROR, "invalid use of *");
|
||||
@@ -1320,8 +1320,8 @@ FigureColnameInternal(Node *node, char **name)
|
||||
break;
|
||||
case T_XmlExpr:
|
||||
/* make SQL/XML functions act like a regular function */
|
||||
switch (((XmlExpr*) node)->op)
|
||||
{
|
||||
switch (((XmlExpr *) node)->op)
|
||||
{
|
||||
case IS_XMLCONCAT:
|
||||
*name = "xmlconcat";
|
||||
return 2;
|
||||
@@ -1346,7 +1346,7 @@ FigureColnameInternal(Node *node, char **name)
|
||||
case IS_DOCUMENT:
|
||||
/* nothing */
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case T_XmlSerialize:
|
||||
*name = "xmlserialize";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.92 2007/11/11 19:22:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.93 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
|
||||
static int32 typenameTypeMod(ParseState *pstate, const TypeName *typename,
|
||||
Type typ);
|
||||
Type typ);
|
||||
|
||||
|
||||
/*
|
||||
* LookupTypeName
|
||||
* Given a TypeName object, lookup the pg_type syscache entry of the type.
|
||||
* Returns NULL if no such type can be found. If the type is found,
|
||||
* Returns NULL if no such type can be found. If the type is found,
|
||||
* the typmod value represented in the TypeName struct is computed and
|
||||
* stored into *typmod_p.
|
||||
*
|
||||
@@ -46,7 +46,7 @@ static int32 typenameTypeMod(ParseState *pstate, const TypeName *typename,
|
||||
*
|
||||
* typmod_p can be passed as NULL if the caller does not care to know the
|
||||
* typmod value, but the typmod decoration (if any) will be validated anyway,
|
||||
* except in the case where the type is not found. Note that if the type is
|
||||
* except in the case where the type is not found. Note that if the type is
|
||||
* found but is a shell, and there is typmod decoration, an error will be
|
||||
* thrown --- this is intentional.
|
||||
*
|
||||
@@ -252,15 +252,15 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
|
||||
return typename->typemod;
|
||||
|
||||
/*
|
||||
* Else, type had better accept typmods. We give a special error
|
||||
* message for the shell-type case, since a shell couldn't possibly
|
||||
* have a typmodin function.
|
||||
* Else, type had better accept typmods. We give a special error message
|
||||
* for the shell-type case, since a shell couldn't possibly have a
|
||||
* typmodin function.
|
||||
*/
|
||||
if (!((Form_pg_type) GETSTRUCT(typ))->typisdefined)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("type modifier cannot be specified for shell type \"%s\"",
|
||||
TypeNameToString(typename)),
|
||||
errmsg("type modifier cannot be specified for shell type \"%s\"",
|
||||
TypeNameToString(typename)),
|
||||
parser_errposition(pstate, typename->location)));
|
||||
|
||||
typmodin = ((Form_pg_type) GETSTRUCT(typ))->typmodin;
|
||||
@@ -281,24 +281,24 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
|
||||
n = 0;
|
||||
foreach(l, typename->typmods)
|
||||
{
|
||||
Node *tm = (Node *) lfirst(l);
|
||||
char *cstr = NULL;
|
||||
Node *tm = (Node *) lfirst(l);
|
||||
char *cstr = NULL;
|
||||
|
||||
if (IsA(tm, A_Const))
|
||||
{
|
||||
A_Const *ac = (A_Const *) tm;
|
||||
A_Const *ac = (A_Const *) tm;
|
||||
|
||||
/*
|
||||
* The grammar hands back some integers with ::int4 attached,
|
||||
* so allow a cast decoration if it's an Integer value, but
|
||||
* not otherwise.
|
||||
* The grammar hands back some integers with ::int4 attached, so
|
||||
* allow a cast decoration if it's an Integer value, but not
|
||||
* otherwise.
|
||||
*/
|
||||
if (IsA(&ac->val, Integer))
|
||||
{
|
||||
cstr = (char *) palloc(32);
|
||||
snprintf(cstr, 32, "%ld", (long) ac->val.val.ival);
|
||||
}
|
||||
else if (ac->typename == NULL) /* no casts allowed */
|
||||
else if (ac->typename == NULL) /* no casts allowed */
|
||||
{
|
||||
/* otherwise we can just use the str field directly. */
|
||||
cstr = ac->val.val.str;
|
||||
@@ -306,7 +306,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
|
||||
}
|
||||
else if (IsA(tm, ColumnRef))
|
||||
{
|
||||
ColumnRef *cr = (ColumnRef *) tm;
|
||||
ColumnRef *cr = (ColumnRef *) tm;
|
||||
|
||||
if (list_length(cr->fields) == 1)
|
||||
cstr = strVal(linitial(cr->fields));
|
||||
@@ -314,7 +314,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
|
||||
if (!cstr)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("type modifiers must be simple constants or identifiers"),
|
||||
errmsg("type modifiers must be simple constants or identifiers"),
|
||||
parser_errposition(pstate, typename->location)));
|
||||
datums[n++] = CStringGetDatum(cstr);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.5 2007/11/11 19:22:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.6 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -98,13 +98,13 @@ static void transformTableConstraint(ParseState *pstate,
|
||||
Constraint *constraint);
|
||||
static void transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
|
||||
InhRelation *inhrelation);
|
||||
static IndexStmt *generateClonedIndexStmt(CreateStmtContext *cxt,
|
||||
Relation parent_index, AttrNumber *attmap);
|
||||
static IndexStmt *generateClonedIndexStmt(CreateStmtContext *cxt,
|
||||
Relation parent_index, AttrNumber *attmap);
|
||||
static List *get_opclass(Oid opclass, Oid actual_datatype);
|
||||
static void transformIndexConstraints(ParseState *pstate,
|
||||
CreateStmtContext *cxt);
|
||||
static IndexStmt *transformIndexConstraint(Constraint *constraint,
|
||||
CreateStmtContext *cxt);
|
||||
CreateStmtContext *cxt);
|
||||
static void transformFKConstraints(ParseState *pstate,
|
||||
CreateStmtContext *cxt,
|
||||
bool skipValidation,
|
||||
@@ -138,21 +138,21 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
|
||||
ListCell *elements;
|
||||
|
||||
/*
|
||||
* We must not scribble on the passed-in CreateStmt, so copy it. (This
|
||||
* is overkill, but easy.)
|
||||
* We must not scribble on the passed-in CreateStmt, so copy it. (This is
|
||||
* overkill, but easy.)
|
||||
*/
|
||||
stmt = (CreateStmt *) copyObject(stmt);
|
||||
|
||||
/*
|
||||
* If the target relation name isn't schema-qualified, make it so. This
|
||||
* prevents some corner cases in which added-on rewritten commands might
|
||||
* think they should apply to other relations that have the same name
|
||||
* and are earlier in the search path. "istemp" is equivalent to a
|
||||
* think they should apply to other relations that have the same name and
|
||||
* are earlier in the search path. "istemp" is equivalent to a
|
||||
* specification of pg_temp, so no need for anything extra in that case.
|
||||
*/
|
||||
if (stmt->relation->schemaname == NULL && !stmt->relation->istemp)
|
||||
{
|
||||
Oid namespaceid = RangeVarGetCreationNamespace(stmt->relation);
|
||||
Oid namespaceid = RangeVarGetCreationNamespace(stmt->relation);
|
||||
|
||||
stmt->relation->schemaname = get_namespace_name(namespaceid);
|
||||
}
|
||||
@@ -580,8 +580,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert the copied attributes into the cxt for the new table
|
||||
* definition.
|
||||
* Insert the copied attributes into the cxt for the new table definition.
|
||||
*/
|
||||
for (parent_attno = 1; parent_attno <= tupleDesc->natts;
|
||||
parent_attno++)
|
||||
@@ -650,8 +649,8 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy CHECK constraints if requested, being careful to adjust
|
||||
* attribute numbers
|
||||
* Copy CHECK constraints if requested, being careful to adjust attribute
|
||||
* numbers
|
||||
*/
|
||||
if (including_constraints && tupleDesc->constr)
|
||||
{
|
||||
@@ -687,9 +686,9 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
|
||||
|
||||
foreach(l, parent_indexes)
|
||||
{
|
||||
Oid parent_index_oid = lfirst_oid(l);
|
||||
Relation parent_index;
|
||||
IndexStmt *index_stmt;
|
||||
Oid parent_index_oid = lfirst_oid(l);
|
||||
Relation parent_index;
|
||||
IndexStmt *index_stmt;
|
||||
|
||||
parent_index = index_open(parent_index_oid, AccessShareLock);
|
||||
|
||||
@@ -723,25 +722,25 @@ static IndexStmt *
|
||||
generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
|
||||
AttrNumber *attmap)
|
||||
{
|
||||
HeapTuple ht_idx;
|
||||
HeapTuple ht_idxrel;
|
||||
HeapTuple ht_am;
|
||||
Form_pg_index idxrec;
|
||||
Form_pg_class idxrelrec;
|
||||
Form_pg_am amrec;
|
||||
List *indexprs = NIL;
|
||||
ListCell *indexpr_item;
|
||||
Oid indrelid;
|
||||
Oid source_relid;
|
||||
int keyno;
|
||||
Oid keycoltype;
|
||||
Datum indclassDatum;
|
||||
Datum indoptionDatum;
|
||||
bool isnull;
|
||||
oidvector *indclass;
|
||||
int2vector *indoption;
|
||||
IndexStmt *index;
|
||||
Datum reloptions;
|
||||
HeapTuple ht_idx;
|
||||
HeapTuple ht_idxrel;
|
||||
HeapTuple ht_am;
|
||||
Form_pg_index idxrec;
|
||||
Form_pg_class idxrelrec;
|
||||
Form_pg_am amrec;
|
||||
List *indexprs = NIL;
|
||||
ListCell *indexpr_item;
|
||||
Oid indrelid;
|
||||
Oid source_relid;
|
||||
int keyno;
|
||||
Oid keycoltype;
|
||||
Datum indclassDatum;
|
||||
Datum indoptionDatum;
|
||||
bool isnull;
|
||||
oidvector *indclass;
|
||||
int2vector *indoption;
|
||||
IndexStmt *index;
|
||||
Datum reloptions;
|
||||
|
||||
source_relid = RelationGetRelid(source_idx);
|
||||
|
||||
@@ -825,7 +824,7 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
|
||||
|
||||
for (keyno = 0; keyno < idxrec->indnatts; keyno++)
|
||||
{
|
||||
IndexElem *iparam;
|
||||
IndexElem *iparam;
|
||||
AttrNumber attnum = idxrec->indkey.values[keyno];
|
||||
int16 opt = indoption->values[keyno];
|
||||
|
||||
@@ -914,9 +913,9 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
|
||||
static List *
|
||||
get_opclass(Oid opclass, Oid actual_datatype)
|
||||
{
|
||||
HeapTuple ht_opc;
|
||||
Form_pg_opclass opc_rec;
|
||||
List *result = NIL;
|
||||
HeapTuple ht_opc;
|
||||
Form_pg_opclass opc_rec;
|
||||
List *result = NIL;
|
||||
|
||||
ht_opc = SearchSysCache(CLAOID,
|
||||
ObjectIdGetDatum(opclass),
|
||||
@@ -928,8 +927,8 @@ get_opclass(Oid opclass, Oid actual_datatype)
|
||||
if (!OidIsValid(actual_datatype) ||
|
||||
GetDefaultOpClass(actual_datatype, opc_rec->opcmethod) != opclass)
|
||||
{
|
||||
char *nsp_name = get_namespace_name(opc_rec->opcnamespace);
|
||||
char *opc_name = NameStr(opc_rec->opcname);
|
||||
char *nsp_name = get_namespace_name(opc_rec->opcnamespace);
|
||||
char *opc_name = NameStr(opc_rec->opcname);
|
||||
|
||||
result = list_make2(makeString(nsp_name), makeString(opc_name));
|
||||
}
|
||||
@@ -1038,9 +1037,9 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
|
||||
static IndexStmt *
|
||||
transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
{
|
||||
IndexStmt *index;
|
||||
ListCell *keys;
|
||||
IndexElem *iparam;
|
||||
IndexStmt *index;
|
||||
ListCell *keys;
|
||||
IndexElem *iparam;
|
||||
|
||||
Assert(constraint->contype == CONSTR_PRIMARY ||
|
||||
constraint->contype == CONSTR_UNIQUE);
|
||||
@@ -1054,8 +1053,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
if (cxt->pkey != NULL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
|
||||
errmsg("multiple primary keys for table \"%s\" are not allowed",
|
||||
cxt->relation->relname)));
|
||||
errmsg("multiple primary keys for table \"%s\" are not allowed",
|
||||
cxt->relation->relname)));
|
||||
cxt->pkey = index;
|
||||
|
||||
/*
|
||||
@@ -1068,7 +1067,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
if (constraint->name != NULL)
|
||||
index->idxname = pstrdup(constraint->name);
|
||||
else
|
||||
index->idxname = NULL; /* DefineIndex will choose name */
|
||||
index->idxname = NULL; /* DefineIndex will choose name */
|
||||
|
||||
index->relation = cxt->relation;
|
||||
index->accessMethod = DEFAULT_INDEX_TYPE;
|
||||
@@ -1079,10 +1078,10 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
index->concurrent = false;
|
||||
|
||||
/*
|
||||
* Make sure referenced keys exist. If we are making a PRIMARY KEY
|
||||
* index, also make sure they are NOT NULL, if possible. (Although we
|
||||
* could leave it to DefineIndex to mark the columns NOT NULL, it's
|
||||
* more efficient to get it right the first time.)
|
||||
* Make sure referenced keys exist. If we are making a PRIMARY KEY index,
|
||||
* also make sure they are NOT NULL, if possible. (Although we could leave
|
||||
* it to DefineIndex to mark the columns NOT NULL, it's more efficient to
|
||||
* get it right the first time.)
|
||||
*/
|
||||
foreach(keys, constraint->keys)
|
||||
{
|
||||
@@ -1110,9 +1109,9 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
else if (SystemAttributeByName(key, cxt->hasoids) != NULL)
|
||||
{
|
||||
/*
|
||||
* column will be a system column in the new table, so accept
|
||||
* it. System columns can't ever be null, so no need to worry
|
||||
* about PRIMARY/NOT NULL constraint.
|
||||
* column will be a system column in the new table, so accept it.
|
||||
* System columns can't ever be null, so no need to worry about
|
||||
* PRIMARY/NOT NULL constraint.
|
||||
*/
|
||||
found = true;
|
||||
}
|
||||
@@ -1132,8 +1131,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
if (rel->rd_rel->relkind != RELKIND_RELATION)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("inherited relation \"%s\" is not a table",
|
||||
inh->relname)));
|
||||
errmsg("inherited relation \"%s\" is not a table",
|
||||
inh->relname)));
|
||||
for (count = 0; count < rel->rd_att->natts; count++)
|
||||
{
|
||||
Form_pg_attribute inhattr = rel->rd_att->attrs[count];
|
||||
@@ -1146,10 +1145,10 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
found = true;
|
||||
|
||||
/*
|
||||
* We currently have no easy way to force an
|
||||
* inherited column to be NOT NULL at creation, if
|
||||
* its parent wasn't so already. We leave it to
|
||||
* DefineIndex to fix things up in this case.
|
||||
* We currently have no easy way to force an inherited
|
||||
* column to be NOT NULL at creation, if its parent
|
||||
* wasn't so already. We leave it to DefineIndex to
|
||||
* fix things up in this case.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
@@ -1162,9 +1161,9 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
|
||||
/*
|
||||
* In the ALTER TABLE case, don't complain about index keys not
|
||||
* created in the command; they may well exist already.
|
||||
* DefineIndex will complain about them if not, and will also take
|
||||
* care of marking them NOT NULL.
|
||||
* created in the command; they may well exist already. DefineIndex
|
||||
* will complain about them if not, and will also take care of marking
|
||||
* them NOT NULL.
|
||||
*/
|
||||
if (!found && !cxt->isalter)
|
||||
ereport(ERROR,
|
||||
@@ -1186,8 +1185,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DUPLICATE_COLUMN),
|
||||
errmsg("column \"%s\" appears twice in unique constraint",
|
||||
key)));
|
||||
errmsg("column \"%s\" appears twice in unique constraint",
|
||||
key)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1269,7 +1268,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
|
||||
* transformIndexStmt - parse analysis for CREATE INDEX
|
||||
*
|
||||
* Note: this is a no-op for an index not using either index expressions or
|
||||
* a predicate expression. There are several code paths that create indexes
|
||||
* a predicate expression. There are several code paths that create indexes
|
||||
* without bothering to call this, because they know they don't have any
|
||||
* such expressions to deal with.
|
||||
*/
|
||||
@@ -1282,28 +1281,28 @@ transformIndexStmt(IndexStmt *stmt, const char *queryString)
|
||||
ListCell *l;
|
||||
|
||||
/*
|
||||
* We must not scribble on the passed-in IndexStmt, so copy it. (This
|
||||
* is overkill, but easy.)
|
||||
* We must not scribble on the passed-in IndexStmt, so copy it. (This is
|
||||
* overkill, but easy.)
|
||||
*/
|
||||
stmt = (IndexStmt *) copyObject(stmt);
|
||||
|
||||
/*
|
||||
* Open the parent table with appropriate locking. We must do this
|
||||
* Open the parent table with appropriate locking. We must do this
|
||||
* because addRangeTableEntry() would acquire only AccessShareLock,
|
||||
* leaving DefineIndex() needing to do a lock upgrade with consequent
|
||||
* risk of deadlock. Make sure this stays in sync with the type of
|
||||
* lock DefineIndex() wants.
|
||||
* leaving DefineIndex() needing to do a lock upgrade with consequent risk
|
||||
* of deadlock. Make sure this stays in sync with the type of lock
|
||||
* DefineIndex() wants.
|
||||
*/
|
||||
rel = heap_openrv(stmt->relation,
|
||||
(stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock));
|
||||
(stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock));
|
||||
|
||||
/* Set up pstate */
|
||||
pstate = make_parsestate(NULL);
|
||||
pstate->p_sourcetext = queryString;
|
||||
|
||||
/*
|
||||
* Put the parent table into the rtable so that the expressions can
|
||||
* refer to its fields without qualification.
|
||||
* Put the parent table into the rtable so that the expressions can refer
|
||||
* to its fields without qualification.
|
||||
*/
|
||||
rte = addRangeTableEntry(pstate, stmt->relation, NULL, false, true);
|
||||
|
||||
@@ -1432,7 +1431,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
|
||||
|
||||
/* take care of the where clause */
|
||||
*whereClause = transformWhereClause(pstate,
|
||||
(Node *) copyObject(stmt->whereClause),
|
||||
(Node *) copyObject(stmt->whereClause),
|
||||
"WHERE");
|
||||
|
||||
if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */
|
||||
@@ -1458,7 +1457,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
|
||||
|
||||
nothing_qry->commandType = CMD_NOTHING;
|
||||
nothing_qry->rtable = pstate->p_rtable;
|
||||
nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
|
||||
nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
|
||||
|
||||
*actions = list_make1(nothing_qry);
|
||||
}
|
||||
@@ -1480,8 +1479,8 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
|
||||
has_new;
|
||||
|
||||
/*
|
||||
* Since outer ParseState isn't parent of inner, have to pass
|
||||
* down the query text by hand.
|
||||
* Since outer ParseState isn't parent of inner, have to pass down
|
||||
* the query text by hand.
|
||||
*/
|
||||
sub_pstate->p_sourcetext = queryString;
|
||||
|
||||
@@ -1650,17 +1649,17 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString)
|
||||
AlterTableCmd *newcmd;
|
||||
|
||||
/*
|
||||
* We must not scribble on the passed-in AlterTableStmt, so copy it.
|
||||
* (This is overkill, but easy.)
|
||||
* We must not scribble on the passed-in AlterTableStmt, so copy it. (This
|
||||
* is overkill, but easy.)
|
||||
*/
|
||||
stmt = (AlterTableStmt *) copyObject(stmt);
|
||||
|
||||
/*
|
||||
* Acquire exclusive lock on the target relation, which will be held
|
||||
* until end of transaction. This ensures any decisions we make here
|
||||
* based on the state of the relation will still be good at execution.
|
||||
* We must get exclusive lock now because execution will; taking a lower
|
||||
* grade lock now and trying to upgrade later risks deadlock.
|
||||
* Acquire exclusive lock on the target relation, which will be held until
|
||||
* end of transaction. This ensures any decisions we make here based on
|
||||
* the state of the relation will still be good at execution. We must get
|
||||
* exclusive lock now because execution will; taking a lower grade lock
|
||||
* now and trying to upgrade later risks deadlock.
|
||||
*/
|
||||
rel = relation_openrv(stmt->relation, AccessExclusiveLock);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.71 2007/01/09 02:14:14 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.72 2007/11/15 21:14:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
List *parsetree; /* result of parsing is left here */
|
||||
|
||||
static bool have_lookahead; /* is lookahead info valid? */
|
||||
static int lookahead_token; /* one-token lookahead */
|
||||
static bool have_lookahead; /* is lookahead info valid? */
|
||||
static int lookahead_token; /* one-token lookahead */
|
||||
static YYSTYPE lookahead_yylval; /* yylval for lookahead token */
|
||||
static YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */
|
||||
|
||||
@@ -98,6 +98,7 @@ filtered_base_yylex(void)
|
||||
switch (cur_token)
|
||||
{
|
||||
case NULLS_P:
|
||||
|
||||
/*
|
||||
* NULLS FIRST and NULLS LAST must be reduced to one token
|
||||
*/
|
||||
@@ -126,6 +127,7 @@ filtered_base_yylex(void)
|
||||
break;
|
||||
|
||||
case WITH:
|
||||
|
||||
/*
|
||||
* WITH CASCADED, LOCAL, or CHECK must be reduced to one token
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user