mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
file_fdw: Add on_error and log_verbosity options to file_fdw.
In v17, the on_error and log_verbosity options were introduced for the COPY command. This commit extends support for these options to file_fdw. Setting on_error = 'ignore' for a file_fdw foreign table allows users to query it without errors, even when the input file contains malformed rows, by skipping the problematic rows. Both on_error and log_verbosity options apply to SELECT and ANALYZE operations on file_fdw foreign tables. Author: Atsushi Torikoshi Reviewed-by: Masahiko Sawada, Fujii Masao Discussion: https://postgr.es/m/ab59dad10490ea3734cf022b16c24cfd@oss.nttdata.com
This commit is contained in:
@ -206,6 +206,25 @@ SELECT * FROM agg_csv c JOIN agg_text t ON (t.a = c.a) ORDER BY c.a;
|
||||
SELECT * FROM agg_bad; -- ERROR
|
||||
ERROR: invalid input syntax for type real: "aaa"
|
||||
CONTEXT: COPY agg_bad, line 3, column b: "aaa"
|
||||
-- on_error and log_verbosity tests
|
||||
ALTER FOREIGN TABLE agg_bad OPTIONS (ADD on_error 'ignore');
|
||||
SELECT * FROM agg_bad;
|
||||
NOTICE: 1 row was skipped due to data type incompatibility
|
||||
a | b
|
||||
-----+--------
|
||||
100 | 99.097
|
||||
42 | 324.78
|
||||
(2 rows)
|
||||
|
||||
ALTER FOREIGN TABLE agg_bad OPTIONS (ADD log_verbosity 'silent');
|
||||
SELECT * FROM agg_bad;
|
||||
a | b
|
||||
-----+--------
|
||||
100 | 99.097
|
||||
42 | 324.78
|
||||
(2 rows)
|
||||
|
||||
ANALYZE agg_bad;
|
||||
-- misc query tests
|
||||
\t on
|
||||
SELECT explain_filter('EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv');
|
||||
|
Reference in New Issue
Block a user