Skip site navigation (1) Skip section navigation (2)

Re: data copy script

From: Ron St-Pierre <rstpierre(at)syscor(dot)com>
To: KeithW(at)narrowpathinc(dot)com,pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: data copy script
Date: 2004-10-12 20:21:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Keith Worthington wrote:

>Hi All,
>I need to write a shell script that can be run by cron to automatically load
>data into a PostgreSQL database.  I have been experimenting with the copy
>command in psql and I have a few questions.
>How can I run a copy command from a script?
You can either run the command directly from postgres' cron:
   0       22      *       *       *       /usr/local/pgsql/bin/pgsql -p 
5432 -d imperial -c" COPY dataTable FROM 'fileName' WITH NULL AS '';"
or place the script inside of a file and have cron call it using 
something like:
   0       22      *       *       *       sh 


>What is the usage for the copy command when getting data from stdin?
>Kind Regards,
>99main Internet Services
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>      message can get through to the mailing list cleanly

In response to

pgsql-novice by date

Next:From: AntoineDate: 2004-10-12 20:26:20
Subject: Re: possible to access a Linux box db from a Windows box
Previous:From: Daniel LerchDate: 2004-10-12 20:09:56
Subject: Re: possible to access a Linux box db from a Windows box

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group