Re: COPY IN as SELECT target
От | Dimitri Fontaine |
---|---|
Тема | Re: COPY IN as SELECT target |
Дата | |
Msg-id | 5722892F-DBA6-4E5C-8844-C83E45375A94@hi-media.com обсуждение исходный текст |
Ответ на | Re: COPY IN as SELECT target (Josh Berkus <josh@agliodbs.com>) |
Список | pgsql-hackers |
Hi, Le 17 déc. 2009 à 19:39, Josh Berkus a écrit : > Mind you, returning (arbitrary expression) would be even better, but if > we can get returning TEXT[] for 8.5, I think it's worth doing on its own. Well, you already have it as soon as you have text[]: INSERT INTO destinationSELECT row[0], row[1], myfunction(row[0], row[1]), row[2]::int + 1 FROM (COPY RETURNING text[] FROM'/path/to/file.cvs' CVS HEADER) as file(row); Of course as Andrew said already what it needs that the syntax here does not cover is ragged file processing, that is acceptingfile content when all the rows will not have the same number of columns. But if you have ragged input reading and COPY as a relation in a query, then you're able to apply any expression you wantto in the query itself. Such as transforming the input slightly in order to conform to PostgreSQL datatype input syntaxes,e.g. Regards, -- dim Let's deprecate pgloader.
В списке pgsql-hackers по дате отправления: