8000 Allow ignoring some errors during COPY FROM · ololobus/postgres@5899272 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5899272

Browse files
committed
Allow ignoring some errors during COPY FROM
Report line number on each ERROR/WARNING Catch errors at InputFunctionCall inside NextCopyFrom Tabs vs spaces consistency Fixed possible Segmentation fault during malformed lines processing Propagate catched SQL error code to warning IGNORE_ERRORS COPY SQL option added (only new syntax supported) Regression test updated to handle new COPY functionality Fixed parser and rebase typo
1 parent e4128ee commit 5899272

File tree

8 files changed

+330
-165
lines changed

8 files changed

+330
-165
lines changed

contrib/file_fdw/file_fdw.c

< 10000 span class="prc-TooltipV2-Tooltip-cYMVY" data-direction="s" role="tooltip" aria-hidden="true" id=":Rhmtlab:">Expand all lines: contrib/file_fdw/file_fdw.c
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ fileIterateForeignScan(ForeignScanState *node)
689689
{
690690
FileFdwExecutionState *festate = (FileFdwExecutionState *) node->fdw_state;
691691
TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
692-
bool found;
692+
int found;
693693
ErrorContextCallback errcallback;
694694

695695
/* Set up callback to identify error line number. */
@@ -1080,7 +1080,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
10801080
TupleDesc tupDesc;
10811081
Datum *values;
10821082
bool *nulls;
1083-
bool found;
1083+
int found;
10841084
char *filename;
10851085
bool is_program;
10861086
List *options;

doc/src/sgml/ref/copy.sgml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
4444
FORCE_NOT_NULL ( <replaceable class="parameter">column_name</replaceable> [, ...] )
4545
FORCE_NULL ( <replaceable class="parameter">column_name</replaceable> [, ...] )
4646
ENCODING '<replaceable class="parameter">encoding_name</replaceable>'
47+
IGNORE_ERRORS [ <replaceable class="parameter">boolean</replaceable> ]
4748
</synopsis>
4849
</refsynopsisdiv>
4950

@@ -248,6 +249,17 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
248249
</listitem>
249250
</varlistentry>
250251

252+
<varlistentry>
253+
<term><literal>IGNORE_ERRORS</literal></term>
254+
<listitem>
255+
<para>
256+
Specifies ignoring errors in the input data. If TRUE, then all
257+
errors due to the extra or missing columns and inappropriate type
258+
format will be ignored with WARNING.
259+
</para>
260+
</listitem>
261+
</varlistentry>
262+
251263
<varlistentry>
252264
<term><literal>NULL</literal></term>
253265
<listitem>

0 commit comments

Comments
 (0)
0