Re: How can I make postgre execute file with SQL code, on windows platform
| From: | chris smith | Date: | Sun, 26 Feb 2006 00:08:28 +0000 |
| Subject: | Re: How can I make postgre execute file with SQL code, on windows platform | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231080@lists.php.net to get a copy of this message | ||
On 2/26/06, Bogdan Ribic <ribicb@yahoo.com> wrote:
> Hi all,
>
> I need to synchronize two postgresql servers, but synchronization is
> one-directional (ie, data from one computer needs to be copied to
> another). Basically, I want the target computer to drop the schema
> "public" and then re-create it from my dump made on the source machine.
> Is there an easy way to do it from PHP, perhaps using some postgre
> utility via system() call ?
err
pg_connect($connection_string);
pg_query("drop schema public");
...
import data
...
or am I missing something here?
You might be better of not doing this with php.
Create the dump on the first machine.
Copy the dump (scp, rsync, copy via samba-mounted drive, whatever)
import it
It depends what your end goal is.