Re: on_error table, saving error info to a table
| От | jian he | 
|---|---|
| Тема | Re: on_error table, saving error info to a table | 
| Дата | |
| Msg-id | CACJufxFVNyrzMxoDqLpmPgQPAco7v_KRUP+Z8L7JBVYCZ-NZ0Q@mail.gmail.com обсуждение исходный текст  | 
		
| Ответ на | Re: on_error table, saving error info to a table (jian he <jian.universality@gmail.com>) | 
| Ответы | 
                	
            		Re: on_error table, saving error info to a table
            		
            		 | 
		
| Список | pgsql-hackers | 
hi.
The previous discussion mentioned using built-in typed tables for the
error saving table.
It's doable.
first create an build-in composite type in system_functions.sql:
CREATE TYPE copy_error_saving AS(
    userid    oid,
    copy_tbl  oid,
    filename  text COLLATE "C",
    lineno    bigint,
    line      text COLLATE "C",
    colname   text COLLATE "C",
    raw_field_value text COLLATE "C",
    err_message     text COLLATE "C",
    err_detail      text COLLATE "C",
    errorcode       text COLLATE "C"
);
then we can use it to create a table like:
CREATE TABLE error_saving_table OF copy_error_saving;
The downside of this:
If the pg_catalog composite (type copy_error_saving) were to change,
it could lead to potential compatibility issues.
We need to be confident that copy_error_saving definitions are
unlikely to occur in the future.
For the above type copy_error_saving, I am wondering, do we aslo need
add a timestamptz field like "starttime" to indicate COPY beginning time.
anyway, please take a look at the attached patch.
It introduces a built-in composite type, allowing users to simply use
CREATE TABLE x OF copy_error_saving
to create a table for storing COPY FROM error-related information.
		
	Вложения
В списке pgsql-hackers по дате отправления: