Search Postgresql Archives

Re: Create a pg table from CSV with header rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 15, 2005 at 06:48:59PM -0400, Robert Fitzpatrick wrote:
> Anyone know a package that can do this? Perferrably a Unix/Linux
> package.

It would be trivial to write a script in a language like Perl to
read the first line of a file and generate a CREATE TABLE statement
from it, then issue a COPY command and send the rest of the file.
Determining the columns' data types would be a different matter:
if they weren't specified in the header then you'd have to guess
or perhaps make them all text.

-- 
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux