How to call a file from a PlPgsql trigger?

Started by Andre Lopesalmost 16 years ago6 messagesgeneral
Jump to latest
#1Andre Lopes
lopes80andre@gmail.com

Hi,

I have an account in a shared hosting account and I can't install any 3rd
party software.

I need to send data from a PostgreSQL database to a MySQL database. I was
thinking of using a trigger. The trigger calling a PHP file to help me
passing the data to the MySQL database.

It is possible to call a file from a PlPgsql trigger? If yes, how to?

This is the best way to do this task?

PS: Sorry for my english.

Best Regards,
André

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Andre Lopes (#1)
Re: How to call a file from a PlPgsql trigger?

Hello

2010/4/19 Andre Lopes <lopes80andre@gmail.com>:

Hi,

I have an account in a shared hosting account and I can't install any 3rd
party software.

I need to send data from a PostgreSQL database to a MySQL database. I was
thinking of using a trigger. The trigger calling a PHP file to help me
passing the data to the MySQL database.

use plperlu instead. You can put connect and transfer of data directly
to trigger

regards
Pavel Stehule

http://www.postgres.cz/index.php/PL/Perlu_-_Untrusted_Perl_%28en%29

Show quoted text

It is possible to call a file from a PlPgsql trigger? If yes, how to?

This is the best way to do this task?

PS: Sorry for my english.

Best Regards,
André

#3Andre Lopes
lopes80andre@gmail.com
In reply to: Pavel Stehule (#2)
Re: How to call a file from a PlPgsql trigger?

Hi,

Thanks for the reply.

I can't install languages. The database is in a shared hosting.

There are other solutions?

Best Regards,

On Mon, Apr 19, 2010 at 10:00 AM, Pavel Stehule <pavel.stehule@gmail.com>wrote:

Show quoted text

Hello

2010/4/19 Andre Lopes <lopes80andre@gmail.com>:

Hi,

I have an account in a shared hosting account and I can't install any 3rd
party software.

I need to send data from a PostgreSQL database to a MySQL database. I was
thinking of using a trigger. The trigger calling a PHP file to help me
passing the data to the MySQL database.

use plperlu instead. You can put connect and transfer of data directly
to trigger

regards
Pavel Stehule

http://www.postgres.cz/index.php/PL/Perlu_-_Untrusted_Perl_%28en%29

It is possible to call a file from a PlPgsql trigger? If yes, how to?

This is the best way to do this task?

PS: Sorry for my english.

Best Regards,
André

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Andre Lopes (#3)
Re: How to call a file from a PlPgsql trigger?

2010/4/19 Andre Lopes <lopes80andre@gmail.com>:

Hi,

Thanks for the reply.

I can't install languages. The database is in a shared hosting.

There are other solutions?

yes. you can store values to some stack table (via trigger) and later
move content of this table to mysql from application. But you can't
execute file from stored procedure as unprivileged user.

Pavel

Show quoted text

Best Regards,

On Mon, Apr 19, 2010 at 10:00 AM, Pavel Stehule <pavel.stehule@gmail.com>
wrote:

Hello

2010/4/19 Andre Lopes <lopes80andre@gmail.com>:

Hi,

I have an account in a shared hosting account and I can't install any
3rd
party software.

I need to send data from a PostgreSQL database to a MySQL database. I
was
thinking of using a trigger. The trigger calling a PHP file to help me
passing the data to the MySQL database.

use plperlu instead. You can put connect and transfer of data directly
to trigger

regards
Pavel Stehule

http://www.postgres.cz/index.php/PL/Perlu_-_Untrusted_Perl_%28en%29

It is possible to call a file from a PlPgsql trigger? If yes, how to?

This is the best way to do this task?

PS: Sorry for my english.

Best Regards,
André

#5Andre Lopes
lopes80andre@gmail.com
In reply to: Pavel Stehule (#4)
Re: How to call a file from a PlPgsql trigger?

Ok,

So the best option is to send the data to a table and then with an cronjob I
verify if it is data to send to the MySQL database.

Best Regards,
André.

On Mon, Apr 19, 2010 at 10:09 AM, Pavel Stehule <pavel.stehule@gmail.com>wrote:

Show quoted text

2010/4/19 Andre Lopes <lopes80andre@gmail.com>:

Hi,

Thanks for the reply.

I can't install languages. The database is in a shared hosting.

There are other solutions?

yes. you can store values to some stack table (via trigger) and later
move content of this table to mysql from application. But you can't
execute file from stored procedure as unprivileged user.

Pavel

Best Regards,

On Mon, Apr 19, 2010 at 10:00 AM, Pavel Stehule <pavel.stehule@gmail.com

wrote:

Hello

2010/4/19 Andre Lopes <lopes80andre@gmail.com>:

Hi,

I have an account in a shared hosting account and I can't install any
3rd
party software.

I need to send data from a PostgreSQL database to a MySQL database. I
was
thinking of using a trigger. The trigger calling a PHP file to help me
passing the data to the MySQL database.

use plperlu instead. You can put connect and transfer of data directly
to trigger

regards
Pavel Stehule

http://www.postgres.cz/index.php/PL/Perlu_-_Untrusted_Perl_%28en%29

It is possible to call a file from a PlPgsql trigger? If yes, how to?

This is the best way to do this task?

PS: Sorry for my english.

Best Regards,
André

#6Merlin Moncure
mmoncure@gmail.com
In reply to: Andre Lopes (#5)
Re: How to call a file from a PlPgsql trigger?

On Mon, Apr 19, 2010 at 5:13 AM, Andre Lopes <lopes80andre@gmail.com> wrote:

Ok,

So the best option is to send the data to a table and then with an cronjob I
verify if it is data to send to the MySQL database.

correct. this is the classic way of doing this type of work.

merlin