# In the database server postgres@srv1:~$ sudo apt install pgagent postgres=# create extension pgagent ; postgres=# create extension plpgsql; postgr@srv1:~$ pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres # PGPASSWOD parameter can be added if it asks for password. pgagent PGPASSWORD=’password’ hostaddr=127.0.0.1 dbname=postgres user=postgres # The following line can be added to the .pgpass file. 127.0.0.1:5432:*:postgres:şifreniz
It is an extension of pgadmin, which is the postgres client software. After installing with
apt from Postgresql repositories, an extension should also be created in databases.
In the client machine ;

Connect to postgresql database with pgadmin. The pgAgent Jobs tab will appear below
the Tablespaces tab.
Example
psql -d testdb # If already exist drop table test ; CREATE TABLE test (id serial, isim text); # Record to be entered in pgagent job INSERT INTO test (isim) SELECT ‘Mehmed’ FROM generate_series(1, 5);
By connecting to testdb, a test table is created and regular insertion is provided with
pgagent.
Note: It may be necessary to add the following line to the pg_hba.conf file
host testdb postgres localhost trust
Right click on pgAent Jobs in pgAdmin and click on create → pgAgent job, a
pop-up window opens.
A scheduled job is created by following the step-by-step instructions below.


Click on edit with pencil icon on the left.

Name, SQL/batch, connection type and database information are entered.





Name, SQL/batch, connection type and database information are entered.