|
|
@ -3,7 +3,7 @@ |
|
|
|
* back to source text |
|
|
|
* back to source text |
|
|
|
* |
|
|
|
* |
|
|
|
* IDENTIFICATION |
|
|
|
* IDENTIFICATION |
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.161 2003/12/28 21:57:37 tgl Exp $ |
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.162 2004/01/31 05:09:40 neilc Exp $ |
|
|
|
* |
|
|
|
* |
|
|
|
* This software is copyrighted by Jan Wieck - Hamburg. |
|
|
|
* This software is copyrighted by Jan Wieck - Hamburg. |
|
|
|
* |
|
|
|
* |
|
|
@ -752,7 +752,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, int prettyFlags) |
|
|
|
|
|
|
|
|
|
|
|
attname = get_relid_attribute_name(indrelid, attnum); |
|
|
|
attname = get_relid_attribute_name(indrelid, attnum); |
|
|
|
if (!colno || colno == keyno + 1) |
|
|
|
if (!colno || colno == keyno + 1) |
|
|
|
appendStringInfo(&buf, "%s", quote_identifier(attname)); |
|
|
|
appendStringInfoString(&buf, quote_identifier(attname)); |
|
|
|
keycoltype = get_atttype(indrelid, attnum); |
|
|
|
keycoltype = get_atttype(indrelid, attnum); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -772,7 +772,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, int prettyFlags) |
|
|
|
/* Need parens if it's not a bare function call */ |
|
|
|
/* Need parens if it's not a bare function call */ |
|
|
|
if (indexkey && IsA(indexkey, FuncExpr) && |
|
|
|
if (indexkey && IsA(indexkey, FuncExpr) && |
|
|
|
((FuncExpr *) indexkey)->funcformat == COERCE_EXPLICIT_CALL) |
|
|
|
((FuncExpr *) indexkey)->funcformat == COERCE_EXPLICIT_CALL) |
|
|
|
appendStringInfo(&buf, "%s", str); |
|
|
|
appendStringInfoString(&buf, str); |
|
|
|
else |
|
|
|
else |
|
|
|
appendStringInfo(&buf, "(%s)", str); |
|
|
|
appendStringInfo(&buf, "(%s)", str); |
|
|
|
} |
|
|
|
} |
|
|
@ -947,7 +947,7 @@ pg_get_constraintdef_worker(Oid constraintId, int prettyFlags) |
|
|
|
string = ""; /* keep compiler quiet */ |
|
|
|
string = ""; /* keep compiler quiet */ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
appendStringInfo(&buf, "%s", string); |
|
|
|
appendStringInfoString(&buf, string); |
|
|
|
|
|
|
|
|
|
|
|
/* Add ON UPDATE and ON DELETE clauses, if needed */ |
|
|
|
/* Add ON UPDATE and ON DELETE clauses, if needed */ |
|
|
|
switch (conForm->confupdtype) |
|
|
|
switch (conForm->confupdtype) |
|
|
@ -1126,11 +1126,9 @@ decompile_column_index_array(Datum column_index_array, Oid relId, |
|
|
|
colName = get_relid_attribute_name(relId, DatumGetInt16(keys[j])); |
|
|
|
colName = get_relid_attribute_name(relId, DatumGetInt16(keys[j])); |
|
|
|
|
|
|
|
|
|
|
|
if (j == 0) |
|
|
|
if (j == 0) |
|
|
|
appendStringInfo(buf, "%s", |
|
|
|
appendStringInfoString(buf, quote_identifier(colName)); |
|
|
|
quote_identifier(colName)); |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
appendStringInfo(buf, ", %s", |
|
|
|
appendStringInfo(buf, ", %s", quote_identifier(colName)); |
|
|
|
quote_identifier(colName)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2134,9 +2132,9 @@ get_insert_query_def(Query *query, deparse_context *context) |
|
|
|
|
|
|
|
|
|
|
|
appendStringInfo(buf, sep); |
|
|
|
appendStringInfo(buf, sep); |
|
|
|
sep = ", "; |
|
|
|
sep = ", "; |
|
|
|
appendStringInfo(buf, "%s", |
|
|
|
appendStringInfoString(buf, |
|
|
|
quote_identifier(get_relid_attribute_name(rte->relid, |
|
|
|
quote_identifier(get_relid_attribute_name(rte->relid, |
|
|
|
tle->resdom->resno))); |
|
|
|
tle->resdom->resno))); |
|
|
|
} |
|
|
|
} |
|
|
|
appendStringInfo(buf, ") "); |
|
|
|
appendStringInfo(buf, ") "); |
|
|
|
|
|
|
|
|
|
|
@ -2753,7 +2751,7 @@ get_rule_expr(Node *node, deparse_context *context, |
|
|
|
quote_identifier(refname)); |
|
|
|
quote_identifier(refname)); |
|
|
|
} |
|
|
|
} |
|
|
|
if (attname) |
|
|
|
if (attname) |
|
|
|
appendStringInfo(buf, "%s", quote_identifier(attname)); |
|
|
|
appendStringInfoString(buf, quote_identifier(attname)); |
|
|
|
else |
|
|
|
else |
|
|
|
appendStringInfo(buf, "*"); |
|
|
|
appendStringInfo(buf, "*"); |
|
|
|
} |
|
|
|
} |
|
|
@ -3763,8 +3761,8 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (col != rte->alias->colnames) |
|
|
|
if (col != rte->alias->colnames) |
|
|
|
appendStringInfo(buf, ", "); |
|
|
|
appendStringInfo(buf, ", "); |
|
|
|
appendStringInfo(buf, "%s", |
|
|
|
appendStringInfoString(buf, |
|
|
|
quote_identifier(strVal(lfirst(col)))); |
|
|
|
quote_identifier(strVal(lfirst(col)))); |
|
|
|
} |
|
|
|
} |
|
|
|
appendStringInfoChar(buf, ')'); |
|
|
|
appendStringInfoChar(buf, ')'); |
|
|
|
} |
|
|
|
} |
|
|
@ -3902,8 +3900,8 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (col != j->using) |
|
|
|
if (col != j->using) |
|
|
|
appendStringInfo(buf, ", "); |
|
|
|
appendStringInfo(buf, ", "); |
|
|
|
appendStringInfo(buf, "%s", |
|
|
|
appendStringInfoString(buf, |
|
|
|
quote_identifier(strVal(lfirst(col)))); |
|
|
|
quote_identifier(strVal(lfirst(col)))); |
|
|
|
} |
|
|
|
} |
|
|
|
appendStringInfoChar(buf, ')'); |
|
|
|
appendStringInfoChar(buf, ')'); |
|
|
|
} |
|
|
|
} |
|
|
@ -3934,7 +3932,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (col != j->alias->colnames) |
|
|
|
if (col != j->alias->colnames) |
|
|
|
appendStringInfo(buf, ", "); |
|
|
|
appendStringInfo(buf, ", "); |
|
|
|
appendStringInfo(buf, "%s", |
|
|
|
appendStringInfoString(buf, |
|
|
|
quote_identifier(strVal(lfirst(col)))); |
|
|
|
quote_identifier(strVal(lfirst(col)))); |
|
|
|
} |
|
|
|
} |
|
|
|
appendStringInfoChar(buf, ')'); |
|
|
|
appendStringInfoChar(buf, ')'); |
|
|
@ -4164,7 +4162,7 @@ quote_qualified_identifier(const char *namespace, |
|
|
|
initStringInfo(&buf); |
|
|
|
initStringInfo(&buf); |
|
|
|
if (namespace) |
|
|
|
if (namespace) |
|
|
|
appendStringInfo(&buf, "%s.", quote_identifier(namespace)); |
|
|
|
appendStringInfo(&buf, "%s.", quote_identifier(namespace)); |
|
|
|
appendStringInfo(&buf, "%s", quote_identifier(ident)); |
|
|
|
appendStringInfoString(&buf, quote_identifier(ident)); |
|
|
|
return buf.data; |
|
|
|
return buf.data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -4316,7 +4314,7 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2) |
|
|
|
appendStringInfo(&buf, "OPERATOR(%s.", quote_identifier(nspname)); |
|
|
|
appendStringInfo(&buf, "OPERATOR(%s.", quote_identifier(nspname)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
appendStringInfo(&buf, "%s", oprname); |
|
|
|
appendStringInfoString(&buf, oprname); |
|
|
|
|
|
|
|
|
|
|
|
if (nspname) |
|
|
|
if (nspname) |
|
|
|
appendStringInfoChar(&buf, ')'); |
|
|
|
appendStringInfoChar(&buf, ')'); |
|
|
@ -4338,7 +4336,7 @@ print_operator_name(StringInfo buf, List *opname) |
|
|
|
int nnames = length(opname); |
|
|
|
int nnames = length(opname); |
|
|
|
|
|
|
|
|
|
|
|
if (nnames == 1) |
|
|
|
if (nnames == 1) |
|
|
|
appendStringInfo(buf, "%s", strVal(lfirst(opname))); |
|
|
|
appendStringInfoString(buf, strVal(lfirst(opname))); |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
appendStringInfo(buf, "OPERATOR("); |
|
|
|
appendStringInfo(buf, "OPERATOR("); |
|
|
|