|
3 | 3 | * out of its tuple
|
4 | 4 | *
|
5 | 5 | * IDENTIFICATION
|
6 |
| - * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.40 2000/02/1503:37:56 thomas Exp $ |
| 6 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.41 2000/02/1508:24:12 tgl Exp $ |
7 | 7 | *
|
8 | 8 | * This software is copyrighted by Jan Wieck - Hamburg.
|
9 | 9 | *
|
@@ -992,17 +992,21 @@ get_select_query_def(Query *query, deparse_context *context)
|
992 | 992 | quote_identifier(rte->relname),
|
993 | 993 | inherit_marker(rte));
|
994 | 994 | if (strcmp(rte->relname,rte->ref->relname)!=0)
|
995 |
| -{ |
996 |
| -List*col; |
997 | 995 | appendStringInfo(buf," %s",
|
998 | 996 | quote_identifier(rte->ref->relname));
|
| 997 | +if (rte->ref->attrs!=NIL) |
| 998 | +{ |
| 999 | +List*col; |
| 1000 | + |
999 | 1001 | appendStringInfo(buf," (");
|
1000 |
| -foreach(col,rte->ref->attrs) |
| 1002 | +foreach(col,rte->ref->attrs) |
1001 | 1003 | {
|
1002 |
| -if (col!=lfirst(rte->ref->attrs)) |
| 1004 | +if (col!=rte->ref->attrs) |
1003 | 1005 | appendStringInfo(buf,", ");
|
1004 |
| -appendStringInfo(buf,"%s",strVal(col)); |
| 1006 | +appendStringInfo(buf,"%s", |
| 1007 | +quote_identifier(strVal(lfirst(col)))); |
1005 | 1008 | }
|
| 1009 | +appendStringInfo(buf,")"); |
1006 | 1010 | }
|
1007 | 1011 | }
|
1008 | 1012 | }
|
|