Re: exposing COPY API

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: exposing COPY API
Дата
Msg-id 4D4B653F.1020201@dunslane.net
обсуждение исходный текст
Ответ на Re: exposing COPY API  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Ответы Re: exposing COPY API  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Список pgsql-hackers

>> Of course, I want this so I could construct a text array from the read in
>> data, but I could also imagine a foreign data wrapper wanting to mangle the
>> data before handing it to postgres, say by filling in a field or hashing it.
> Could you explain the actual use-cases and examples?  I think we need to have
> SQL-level extensibility if we provide such flexibility. I guess typical users
> don't want to write functions with C for each kind of input files.
>
> Note that pg_bulkload has a similar feature like as:
>    CREATE FUNCTION my_function(...) RETURNS record AS ...;
>    COPY tbl FROM 'file' WITH (make_record_from_line = my_function)


Umm, where? I can't find this in the documentation 
<http://pgbulkload.projects.postgresql.org/pg_bulkload.html> nor in the 
source code. And how would  module like that provide an extra copy option?

The object, as I have explained previously, is to have a FDW that 
returns a text array from a (possibly irregularly shaped) file.


So, given this file:

1,,2,3
4,5,6

select t[4] as a,t[2] as b from my_fdw_table;

would return

a | b
-----
3 |  | 5



cheers

andrew




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Itagaki Takahiro
Дата:
Сообщение: Re: exposing COPY API
Следующее
От: Greg Smith
Дата:
Сообщение: Re: keeping a timestamp of the last stats reset (for a db, table and function)