Re: COPY to/from non-local file

From: Jaime Silvela <JSilvela(at)Bear(dot)com>
To: pgsql-general(at)postgresql(dot)org, enrico(dot)sirola(at)gmail(dot)com
Subject: Re: COPY to/from non-local file
Date: 2007-06-27 20:05:59
Message-ID: 4682C327.5060404@bear.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Well, for Ruby there are two Postgres drivers, a native compiled one I
run in Linux, and a pure Ruby one that I use in Windows. The PGconn
object in the Windows version doesn't seem to offer the methods putline,
readline or endcopy. The Linux version does, but since I do development
in both Linux and Windows, this is
not a solution.

It would have been great to have a COPY to/from string functionality.
I'm sure there's a rationale for not having that. Would it be foolish to
try to implement that? In my opinion, it would be cleaner design than
having to mess with getline/putline or file transmission.

Thanks also Enrico, your idea is good.

Martijn van Oosterhout wrote:
> On Wed, Jun 27, 2007 at 02:54:05PM -0400, Jaime Silvela wrote:
>
>> The problem is that the getline/readline interface, which does exist for
>> Ruby, doesn't seem to work so well, and anyway operates line by line; I
>> would have preferred to just hand a file descriptor and be done with it.
>>
>
> Hrm, in what sense doesn't it work well? Line-by-line means
> record-by-record. And writing a function to take an fd and do the work
> would be straightforward, or do you mean something else?
>
> Do you have any suggestions for improvement?
>
> Have a nice day,
>

***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.

Bear Stearns does not provide tax, legal or accounting advice. You
should consult your own tax, legal and accounting advisors before
engaging in any transaction. In order for Bear Stearns to comply with
Internal Revenue Service Circular 230 (if applicable), you are notified
that any discussion of U.S. federal tax issues contained or referred to
herein is not intended or written to be used, and cannot be used, for
the purpose of: (A) avoiding penalties that may be imposed under the
Internal Revenue Code; nor (B) promoting, marketing or recommending to
another party any transaction or matter addressed herein.
***********************************************************************

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-06-27 20:21:37 Re: AutoVacuum Behaviour Question
Previous Message CG 2007-06-27 19:31:09 Re: How do you handle shared memory corruption issues? (contrib/xml2)