|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.312 2009/06/11 14:48:55 momjian Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.313 2009/07/25 00:07:11 adunstan Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -730,6 +730,9 @@ DoCopy(const CopyStmt *stmt, const char *queryString) |
730 | 730 | int num_phys_attrs; |
731 | 731 | uint64 processed; |
732 | 732 |
|
| 733 | + /* a dummy list that represents 'all-columns' */ |
| 734 | + List all_columns = { T_List }; |
| 735 | + |
733 | 736 | /* Allocate workspace and zero all fields */ |
734 | 737 | cstate = (CopyStateData *) palloc0(sizeof(CopyStateData)); |
735 | 738 |
|
@@ -808,7 +811,11 @@ DoCopy(const CopyStmt *stmt, const char *queryString) |
808 | 811 | ereport(ERROR, |
809 | 812 | (errcode(ERRCODE_SYNTAX_ERROR), |
810 | 813 | errmsg("conflicting or redundant options"))); |
811 | | - force_quote = (List *) defel->arg; |
| 814 | + |
| 815 | + if (IsA(defel->arg, A_Star)) |
| 816 | + force_quote = &all_columns; |
| 817 | + else |
| 818 | + force_quote = (List *) defel->arg; |
812 | 819 | } |
813 | 820 | else if (strcmp(defel->defname, "force_notnull") == 0) |
814 | 821 | { |
@@ -1092,7 +1099,14 @@ DoCopy(const CopyStmt *stmt, const char *queryString) |
1092 | 1099 |
|
1093 | 1100 | /* Convert FORCE QUOTE name list to per-column flags, check validity */ |
1094 | 1101 | cstate->force_quote_flags = (bool *) palloc0(num_phys_attrs * sizeof(bool)); |
1095 | | - if (force_quote) |
| 1102 | + if (force_quote == &all_columns) |
| 1103 | + { |
| 1104 | + int i; |
| 1105 | + |
| 1106 | + for (i = 0; i < num_phys_attrs; i++) |
| 1107 | + cstate->force_quote_flags[i] = true; |
| 1108 | + } |
| 1109 | + else if (force_quote) |
1096 | 1110 | { |
1097 | 1111 | List *attnums; |
1098 | 1112 | ListCell *cur; |
|
0 commit comments