[lug] question on Relational database record loading

Lee Woodworth blug-mail at duboulder.com
Thu Jun 1 21:41:25 MDT 2006


Bear Giles wrote:
> Gordon Golding wrote:
> 
>> Does Postgres have any sort of facility for easy record loading?
>>  
>>
> It has a 'LOAD' function.  You usually put that into the file and then
> execute it with 'psql -f data.sql'.  Try 'help load' at the psql prompt.
I think you mean the COPY command. For Postgresql 8.1.2
\h LOAD displays:
   Command:     LOAD
   Description: load or reload a shared library file
   Syntax:
   LOAD 'filename'

While \h COPY displays:
   COPY tablename [ ( column [, ...] ) ]
       FROM { 'filename' | STDIN }
       [ [ WITH ]
             [ BINARY ]
             [ OIDS ]
             [ DELIMITER [ AS ] 'delimiter' ]
             [ NULL [ AS ] 'null string' ]
             [ CSV [ HEADER ]
                   [ QUOTE [ AS ] 'quote' ]
                   [ ESCAPE [ AS ] 'escape' ]
                   [ FORCE NOT NULL column [, ...] ]


Haven't personally used the COPY command, so can't
really help with the particulars.



More information about the LUG mailing list