dump a perl array into a psql DB via 'copy'; help?

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Wed Dec 15 17:55:38 UTC 2004


Yanni Chiu wrote:
> Madison Kelly wrote:
> 
>>... This way I would
>>avoid a second disk IO hit by avoiding the need to have 'psql' read the
>>file.
> 
> 
> If you can process the files serially, or if you have enough memory,
> you could write your files to an in-memory tmp partition (I've forgotten
> the correct term for it), to avoid a disk write. I just looked at
> manpages for swapon, mount, fstab, but could not find what I'm thinking
> of, so I hope its not just a SunOS/Solaris thing.
> 
> 
>>   My question is how can I get the same function as 'psql dbname -f
>>data.txt' except telling 'psql' to get the values from the array instead?
> 
> 
> My Perl is rusty, but wouldn't piping into the psql stdin work, i.e.:
> 
>     open(PSQL, "| psql $dbname")
> 
> HTH.
> --yanni

That worked perfectly, I should have thought of that myself. :p

Thank you very much!

Madison
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list