[ header ]
[ quote [ as ] '<replaceable class="parameter">character</replaceable>' ]
[ escape [ as ] '<replaceable class="parameter">character</replaceable>' ]
- [ force quote <replaceable class="parameter">column_list</replaceable> ]
+ [ force quote <replaceable class="parameter">column_list</replaceable> | * ]
[ force not null <replaceable class="parameter">column_list</replaceable> ] ]</literal>
</term>
List *attnamelist = stmt->attlist;
List *force_quote = NIL;
List *force_notnull = NIL;
+ bool force_quote_all = false;
AclMode required_access = (is_from ? ACL_INSERT : ACL_SELECT);
AclMode relPerms;
AclMode remainingPerms;
TupleDesc tupDesc;
int num_phys_attrs;
uint64 processed;
- bool force_quote_all = false;
-
+
/* Allocate workspace and zero all fields */
cstate = (CopyStateData *) palloc0(sizeof(CopyStateData));
}
else if (strcmp(defel->defname, "force_quote") == 0)
{
- if (force_quote)
+ if (force_quote || force_quote_all)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
-
- if (IsA(defel->arg, A_Star))
+ if (defel->arg && IsA(defel->arg, A_Star))
force_quote_all = true;
else
force_quote = (List *) defel->arg;
errmsg("COPY escape must be a single one-byte character")));
/* Check force_quote */
- if (!cstate->csv_mode && force_quote != NIL)
+ if (!cstate->csv_mode && (force_quote != NIL || force_quote_all))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY force quote available only in CSV mode")));
- if (force_quote != NIL && is_from)
+ if ((force_quote != NIL || force_quote_all) && is_from)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY force quote only available using COPY TO")));
* \copy tablename [(columnlist)] from|to filename
* [ with ] [ binary ] [ oids ] [ delimiter [as] char ] [ null [as] string ]
* [ csv [ header ] [ quote [ AS ] string ] escape [as] string
- * [ force not null column [, ...] | force quote column [, ...] ] ]
+ * [ force not null column [, ...] | force quote column [, ...] | * ] ]
*
* \copy ( select stmt ) to filename
* [ with ] [ binary ] [ delimiter [as] char ] [ null [as] string ]
* [ csv [ header ] [ quote [ AS ] string ] escape [as] string
- * [ force quote column [, ...] ] ]
+ * [ force quote column [, ...] | * ] ]
*
* Force quote only applies for copy to; force not null only applies for
* copy from.