Re: R: feature proposal ...

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
Cc: Paolo Magnoli <pmagnoli(at)systemevolution(dot)it>, pgsql-hackers(at)postgresql(dot)org, eg(at)cybertec(dot)at
Subject: Re: R: feature proposal ...
Date: 2005-09-21 15:47:42
Message-ID: 4331809E.40504@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hans-Jürgen Schönig wrote:

> no because a new is not a heap ...

Why not use a function with a temporary table?

That way you can pass a table parameter that
is the temporary table with a select statement
that you can populate the temp table with.

Sincerely,

Joshua D. Drake

>
> em=# create view x as select * from pg_class;
> CREATE VIEW
>
> em=# copy x to '/tmp/x';
> ERROR: cannot copy from view "x"
>
> best regards,
>
> hans
>
>
>
> Paolo Magnoli wrote:
>
>> Can't you just use a view?
>>
>> -----Messaggio originale-----
>> Da: pgsql-hackers-owner(at)postgresql(dot)org
>> [mailto:pgsql-hackers-owner(at)postgresql(dot)org]Per conto di Hans-Jürgen
>> Schönig
>> Inviato: mercoledì 21 settembre 2005 15.30
>> A: pgsql-hackers(at)postgresql(dot)org; eg(at)cybertec(dot)at
>> Oggetto: [HACKERS] feature proposal ...
>>
>>
>> hackers,
>>
>> currently we have to hack tons of export scripts for various customers.
>> the problem is: if tables can be exported straight forward COPY will
>> give you all you need but when data has to be transformed while
>> exporting things start becoming a bit more complex. usually people want
>> to have CSV file (excel-ify data) which is supported by COPY.
>>
>> the problem is: COPY can write data returned by a SELECT statement to a
>> file. our idea is to implement precisely that.
>>
>> example:
>>
>> COPY TO file_name USING some_select_statement;
>>
>> the advantage would be that COPY would then be able to export data and
>> transform it on the fly. this would save many people a lot of work
>> because complex data extractors could in many cases be replaced by
>> simple SQL scripts.
>>
>> how we plan to implement that:
>> currently copy simply opens a table and loops through the tuples (see
>> command/copy.c starting at line 1115).
>> to implement the desired feature we just had to add some SPI code to the
>> scenery (SPI will also return HeapTuples so it should fit in there).
>>
>> Any comments?
>>
>> Best regards,
>>
>> Hans
>>
>>
>> --
>> Cybertec Geschwinde & Schönig GmbH
>> Schöngrabern 134; A-2020 Hollabrunn
>> Tel: +43/1/205 10 35 / 340
>> www.postgresql.at, www.cybertec.at
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 6: explain analyze is your friend
>>
>
>

--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2005-09-21 15:55:29 Re: R: feature proposal ...
Previous Message Tom Lane 2005-09-21 15:31:42 Re: R: feature proposal ...