Coder Social home page Coder Social logo

pgagent's Introduction

pgAgent
=======

This document describes the compilation of pgAgent, a job scheduler for
PostgreSQL.

pgAgent is managed using pgAdmin (http://www.pgadmin.org). The pgAdmin
documentation contains details of the setup and use of pgAgent with your
PostgreSQL system. The latest build of the documentation can be found at
https://www.pgadmin.org/docs/pgadmin4/development/pgagent.html.

Building pgAgent
----------------

You will need:

- A C/C++ compiler, such as GCC or Microsoft Visual C++ on Windows.
- CMake 3.3 (from www.cmake.org)
- A Boost library 1.41 or higher installation
- A PostgreSQL 8.3 or higher installation

1) Unpack the pgAgent source code
2) Create a build directory in which the code will be built.
3) Run ccmake from the build directory (on Windows, use the CMake graphical
   interface). By default, ccmake will generate Unix Makefiles - consult the
   documentation if you wish to generate other types of output:

$ ccmake /path/to/pgagent

4) If required, press 'c' to generate a default configuration:

CMAKE_BUILD_TYPE                 Release
CMAKE_INSTALL_PREFIX             /usr/local
CMAKE_OSX_ARCHITECTURES          x86_64
CMAKE_OSX_SYSROOT                /Developer/SDKs/MacOSX10.10.sdk
PostgreSQL_CONFIG_EXECUTABLE     /usr/local/pgsql/bin/pg_config
Boost_FIND_REQUIRED              ON
Boost_FIND_QUIETLY               OFF
Boost_DEBUG                      OFF
Boost_USE_MULTITHREADED          ON
Boost_USE_STATIC_LIBS            OFF

5) Use the ccmake interface to adjust any settings as required. When configured
   as required, press 'c' to re-configure (if required) and 'g' to generate the
   build files and exit.

6) Run 'make' to build pgAgent on Mac or Unix, or open the generated project
   files in VC++ on Windows and build the solution in the desired configuration.

Running Regression Tests
========================

To run the regression tests, use a command such as:

make USE_PGXS=1 -f test/Makefile installcheck

You will need to ensure that the appropriate pg_config executable is in the path
and that variables such as PGPORT and PGUSER are set if required.

pgagent's People

Contributors

akshay-joshi avatar asheshv avatar avolkov avatar df7cb avatar dhirajchawla avatar dpage avatar eshkinkot avatar gleu avatar lathiarb avatar mhagander avatar neel5481 avatar sandeep-edb avatar semab-tariq avatar theory avatar tkren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pgagent's Issues

pgAgent "Job no steps to execute!" problem

Hello,
I use pgagent_14-4.2.1.
Jobs run every minute. Sometimes this error occurs but there are steps in pgagent.pga_jobstep.

Problem name: [2 / requestloginsert_minute] Job no steps to execute!

pgagent.pga_joblog :

pgagent_1

In the screenshot, 3 jobs start and end at the same time.

pgagent_2

How can I solve this problem?

Thank you.

win32 batch scripts always fail

re: job.cpp line 263

when a win32 batch script executes the return code is set to 1 - this will in turn set the step status to what is set on the 'on error' field. The rc variable should be set to 0.

pgagent doesn't work for Windows 10 and windows 2019 server

The pgagent windows version for postgresql 12 and 16 don't work for windows 10 and windows server 2019. I downloaded them via EDB installer, both version pgagent stuck at starting stage, didn't do anything further. Windows 10 is a laptop, Windows 2019 is a virtual machine.

Probably this is why there is no downloadable pgagent windows version from the official web site.

Support for PostgreSQL 10

Is pgagent support PostgreSQL 10 ? After install with apt packages pgagent was installed only for postgresql 9.x.

doesnt run properly

i installed pgagent from stack builder and from pgadmin and also directly from the postgres shell and all 3 times, the pgagent would only work on the deafult database "postgres" created by the postgres. i did try changing stuff in pgpass so that pgagent can access other databases too but it never worked. I cant see any problem as nothing is being logged about this in the log files.

Compile error in CentOS 7

 CMake Error at cmake/FindWX.cmake:271 (MESSAGE):
   The selected wxWidgets configuration (version: 2.8, debug: no, static: yes,
   unicode: yes, modules: base) is not available.
 Call Stack (most recent call first):
   CMakeLists.txt:95 (FIND_PACKAGE)

When I use ccmake to compile pgAgent, I got this error. I'm sure I have installed wxWidget correctly. Can anyone help me? Thank you

Cannot start pgAgent Service on Windows 10 with AzureAD login

Cannot start pgAgent Service on Windows 10 with AzureAD login.

The installer creates a new user folder that is username.computername and puts the pgpass.conf file in that location.
pgagent service fails to start after install. No error is reported.

Running pgAgent REMOVE pgAgent results in ERROR: Failed to uninstall source

Tried installing with domain\username but that just fails to create the $env:APPDATA/postgresql/pgpass.conf file.

How can I install this so it works with an AzureAD user on a corporate network?

Does not work with PGPool

Configuration: Postgres 9.5, PGAgent 3.4.1-2, PGPool 3.4.3. Ubuntu 16. PGAgent daemon connects to the PGPool load balancer.

I found that PGAgent causes PGPool backends to get out of sync due to the way it ascertains agent pid for the pgagent.pga_jobagent table. Because job agent Id comes from a call to pg_backend_pid() you get different PIDs in each backend in the cluster. (Line 93 of https://github.com/postgres/pgagent/blob/master/pgAgent.cpp seems to be the place).

From the looks of it, I'd expect it to break with statement based replication of any kind. The result is that when the job runs, you get a foreign key violation on one of the backend nodes that happens to have the "wrong" job id (b/c the postgres process doesn't exist on that box) and no jobs can run.

Is there another candidate for job ID besides backend PID?

Pgagent crash after job step error

Hi,

The pgagent crashes with the following error message when job step fails, even with on error = ignore
"terminate called after throwing an instance of 'std::__ios_failure'
what(): basic_filebuf::_M_convert_to_external conversion error: iostream error"

The issue is more common or started to appear after operating system upgrade(to Debian 11, 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27)) and postgres upgrade(from 9.6 to 13.11)

What's interesting is that not all errors in steps cause pgagent crash.
There is no problem when executing regular functions with some issues.
I noticed that the issue is visible when an SQL error is raised from inside dblinks which are extensively used in the step code.

Job step settings:
Kind: SQL
Connection type: Local
On error: Ignore
Job step sample code
SELECT schema.function_name(CURRENT_DATE);
inside
SELECT * FROM dblink((SELECT * FROM dblink_get_connection()), v_query ...
In case of any error in v_query the pgagent main process crashes
pgagent version
extension: 4.2
pgagent -v: Version: 4.2.1

I would be grateful for help

hostaddr dont resolve in docker

Office docker FROM postgres:9.6

pgagent Version: 4.0.0
OS: PRETTY_NAME="Debian GNU/Linux 9 (stretch)

cat /etc/hosts

10.66.33.8 psql_host e31547b61562
10.66.33.9 84f81c219d46

pgagent -f hostaddr=psql_host dbname=${POSTGRES_DB} user=postgres port=5432 password=${POSTGRES_PASSWORD} -l 1 -t 60"


Thu Sep 27 20:34:51 2018 WARNING: Failed to create primary connection: could not parse network address "(null)": Name or service not known
Thu Sep 27 20:34:51 2018 WARNING: Couldn't create the primary connection [Attempt #1]
Thu Sep 27 20:34:57 2018 WARNING: Failed to create primary connection: could not parse network address "(null)": Name or service not known
Thu Sep 27 20:34:57 2018 WARNING: Couldn't create the primary connection [Attempt #2]
Thu Sep 27 20:35:03 2018 WARNING: Failed to create primary connection: could not parse network address "(null)": Name or service not known

pgagent 4 does not start when upgraded from pgagent 3

If you upgrade pgagent from 3 to 4 it fails to start with:

Wed Sep 5 15:44:38 2018 ERROR: Unsupported schema version: 3. Version 4 is required - please run pgagent_upgrade.sql.

The message is not really helpful as the package does not contain pgagent_upgrade.sql at all. I believe it's a leftover from previous release of pgagent which had pgagent_upgrade.sql.
There is /usr/share/postgresql/9.6/extension/pgagent--3.4--4.0.sql which has a helpful hint:

\echo Use "CREATE EXTENSION pgagent UPDATE" to load this file. \quit

Unfortunately:

postgres=# CREATE EXTENSION pgagent UPDATE;
ERROR:  syntax error at or near "UPDATE"
LINE 1: CREATE EXTENSION pgagent UPDATE

@dpage are you the correct person to tackle this?

PgAgent 4.2.2 as released has broken connection string support

Hello!

Installing PgAgent 4.2.2 (http://apt.postgresql.org/pub/repos/apt/pool/main/p/pgagent/pgagent_4.2.2-2.pgdg100%2B1_amd64.deb) on Debian 10 it appears that you can't use a full connection string (for example ./pgagent -l 2 -f hostaddr=pgagentserver dbname=postgres user=pgagent_login_user password=ourverysecurepassword) this worked fine under 4.2.1 (on Debian 9 for example)

The error output is something like:

./pgagent -l 2 -f hostaddr=pgagentserver dbname=postgres user=pgagent_login_user password=ourverysecurepassword
Thu Nov 3 15:22:18 2022 DEBUG: Creating primary connection
Thu Nov 3 15:22:18 2022 DEBUG: Parsing connection information...
Thu Nov 3 15:22:18 2022 DEBUG: Creating DB connection: user=pgagent_login_user password=***** dbname=postgres hostaddr=pgagentserver dbname=postgres
Thu Nov 3 15:22:18 2022 WARNING: Failed to create primary connection: connection to server at "pgagentserver", port 5432 failed: FATAL:  password authentication failed for user "pgagent_login_user"
connection to server at "pgagentserver", port 5432 failed: FATAL:  password authentication failed for user "pgagent_login_user"
Thu Nov 3 15:22:18 2022 WARNING: Couldn't create the primary connection [Attempt #1]
Thu Nov 3 15:22:18 2022 DEBUG: Clearing all connections
Thu Nov 3 15:22:18 2022 DEBUG: No connections found!

This has been fixed in this commit (we have built and tested this in the lab) a172ef5 however for some reason this fix isn't included in the 4.2.2 release even though (as far as I can see) it should have been?

WARNING: Query error: SSL SYSCALL error: EOF detected

While the pgagent job was doing a reindex on tbl1, another query tried to select from the same table that the job was working on.Then job failed with this error:

WARNING: Query error: SSL SYSCALL error: EOF detected

  1. First the job was doing the reindex on the table, why the coming query did not go to wait state until the job finish?
  2. How to solve the issue?

Wrong step status for batch jobs

Environment:
pgAgent 3.4.1-2, Ubuntu 16.04, pgAdmin 4 (1.4), Python 2.7.12, PostgreSQL 9.5

pgAgent seems to ignore the exit code of batch steps when the job contains also SQL steps. If the job only contains batch steps the status is shown correctly, namely 0 for 's' and 1 for 'f'. Strangely, if there are also SQL steps in the same job, the status is always shown as 's', no matter what exit code is delivered by the application (a jar file, in my case)

image

I would very much appreciate any suggestion from the experts!

pgagent compile error windows

Hello, I am trying compile pgagent on Windows 11 using:

g++ (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 13.2.0
cmake gui 3.28.0. rc5
Boost 1.78
Postgresql 16
Visual Studio 17 2022

C:\Library>cmake pgAgent -B build
-- Building for: Visual Studio 17 2022
CMake Deprecation Warning at CMakeLists.txt:17 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Selecting Windows SDK version 10.0.22621.0 to target Windows 6.2.9200.
-- The C compiler identification is MSVC 19.38.33133.0
-- The CXX compiler identification is MSVC 19.38.33133.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:112 (FIND_PACKAGE):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    C:\Library\boost

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost toolset is unknown (compiler MSVC 19.38.33133.0)
-- Boost  found.
-- Found Boost components:
   filesystem;regex;date_time;thread;system
--
-- ================================================================================
-- Configuration summary:
--
--   Project                     : pgagent
--   Description                 : pgAgent is a job scheduling engine for PostgreSQL
--   Version                     : 4.2.1
--
--   PostgreSQL version string   : PostgreSQL 16.0
--   PostgreSQL version parts    : 16
--   PostgreSQL path             : C:/Library/pgsql
--   PostgreSQL config binary    : C:/Library/pgsql/bin/pg_config.exe
--   PostgreSQL include path     : C:/Library/pgsql/include
--   PostgreSQL library path     : C:/Library/pgsql/lib
--   PostgreSQL share path       : C:/Library/pgsql/share
--
--   Boost version               : 1.78.0
--   Boost path                  : C:/Library/boost/include/boost-1_78
--   Boost include directory     : C:/Library/boost/include/boost-1_78
--   Boost library directory     :
--   Boost Static linking        : NO
-- ================================================================================
--
-- Configuring done (5.3s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Library/build

After opening solution on Visual Studio to build, I get various errors:

Error        LNK2001	unresolved external symbol "public: virtual void __cdecl boost::detail::thread_data_base::notify_all_at_thread_exit(class boost::condition_variable *,class boost::mutex *)" (?notify_all_at_thread_exit@thread_data_base@detail@boost@@UEAAXPEAVcondition_variable@3@PEAVmutex@3@@Z)	pgagent	C:\Library\build\pgAgent.obj	1		


Error	LNK2001	unresolved external symbol "public: virtual __cdecl boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base@detail@boost@@UEAA@XZ)	pgagent	C:\Library\build\pgAgent.obj	1

Error	LNK2019	unresolved external symbol "__declspec(dllimport) bool __cdecl boost::filesystem::detail::create_directory(class boost::filesystem::path const &,class boost::filesystem::path const *,class boost::system::error_code *)" (__imp_?create_directory@detail@filesystem@boost@@YA_NAEBVpath@23@PEBV423@PEAVerror_code@system@3@@Z) referenced in function "bool __cdecl boost::filesystem::create_directory(class boost::filesystem::path const &)" (?create_directory@filesystem@boost@@YA_NAEBVpath@12@@Z)	pgagent	C:\Library\build\job.obj	1		
	
Error	LNK2019	unresolved external symbol "__declspec(dllimport) class boost::filesystem::file_status __cdecl boost::filesystem::detail::status(class boost::filesystem::path const &,class boost::system::error_code *)" (__imp_?status@detail@filesystem@boost@@YA?AVfile_status@23@AEBVpath@23@PEAVerror_code@system@3@@Z) referenced in function "bool __cdecl boost::filesystem::exists(class boost::filesystem::path const &)" (?exists@filesystem@boost@@YA_NAEBVpath@12@@Z)	pgagent	C:\Library\build\job.obj	1		

New release possible?

The bug fixed by f9bf1cc is critical on some platforms. Is it possible to make this a release so it can be officially packaged?

pgagent log needs timestamps

The pgagent log output is very hard to use for debugging because of a lack of timestamps. Can we add a timestamp to the beginning of each line?

pgAgent build error

Hello.

OS: Windows 7 x64
pgAgent 3.4.0
CMake 2.6
wxWidgets 2.8.12
Visual Studio 2008 Express , Version 9.0.30729.1 SP, Visual C++ Microsoft Visual Studio 2008
Microsoft .NET Framework
Version 3.5 SP1

All steps for building doing like described here https://github.com/postgres/pgagent
But -
------ Построение начато: проект: pgagent, Конфигурация: Debug Win32 ------
Компоновка...
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQfinish в функции "private: bool __thiscall DBconn::Connect(class wxString const &)" (?Connect@DBconn@@AAE_NABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQerrorMessage в функции "private: bool __thiscall DBconn::Connect(class wxString const &)" (?Connect@DBconn@@AAE_NABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQstatus в функции "private: bool __thiscall DBconn::Connect(class wxString const &)" (?Connect@DBconn@@AAE_NABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQconnectdb в функции "private: bool __thiscall DBconn::Connect(class wxString const &)" (?Connect@DBconn@@AAE_NABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQcmdTuples в функции "public: long __thiscall DBresult::RowsAffected(void)const " (?RowsAffected@DBresult@@QBEJXZ)
job.obj : error LNK2001: неразрешенный внешний символ "_PQcmdTuples"
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQclear в функции "protected: __thiscall DBresult::DBresult(class DBconn *,class wxString const &)" (??0DBresult@@iae@PAVDBconn@@ABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQntuples в функции "protected: __thiscall DBresult::DBresult(class DBconn *,class wxString const &)" (??0DBresult@@iae@PAVDBconn@@ABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQresultStatus в функции "protected: __thiscall DBresult::DBresult(class DBconn *,class wxString const &)" (??0DBresult@@iae@PAVDBconn@@ABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQexec в функции "protected: __thiscall DBresult::DBresult(class DBconn *,class wxString const &)" (??0DBresult@@iae@PAVDBconn@@ABVwxString@@@z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQgetvalue в функции "public: class wxString __thiscall DBresult::GetString(int)const " (?GetString@DBresult@@qbe?AVwxString@@h@Z)
connection.obj : error LNK2019: ссылка на неразрешенный внешний символ _PQfnumber в функции "public: class wxString __thiscall DBresult::GetString(class wxString const &)const " (?GetString@DBresult@@qbe?AVwxString@@abv2@@z)
C:\Users\Beholder\Documents\Binaries\Debug\pgagent.exe : fatal error LNK1120: 11 неразрешенных внешних элементов
Журнал построения был сохранен в "file://c:\Users\Beholder\Documents\Binaries\pgagent.dir\Debug\BuildLog.htm"
pgagent - ошибок 13, предупреждений 0
------ Построение начато: проект: run, Конфигурация: Debug Win32 ------
Generating pgagent--3.4.sql, pgagent.control
CMake Error: Error processing file: cmake/MakeExt.cmake
Project : error PRJ0019: Инструмент вернул код ошибки из "Generating pgagent--3.4.sql, pgagent.control"
Журнал построения был сохранен в "file://c:\Users\Beholder\Documents\Binaries\run.dir\Debug\BuildLog.htm"
run - ошибок 1, предупреждений 0
------ Пропуск построения: проект: INSTALL, Конфигурация: Debug Win32 ------
Проект не выбран для построения в данной конфигурации решения
------ Пропуск построения: проект: PACKAGE, Конфигурация: Debug Win32 ------
Проект не выбран для построения в данной конфигурации решения
========== Построение: успешно: 0, с ошибками: 2, без изменений: 3, пропущено: 2 ==========

4.2.2 build error on RHEL 7

Hi,

4.2.2 fails to build on RHEL 7. Can you please check? Thanks!

[ 22%] Building CXX object CMakeFiles/pgagent.dir/connection.cpp.o
/usr/lib64/ccache/c++  -DPGAGENT_VERSION=\"4.2.2\" -DPGAGENT_VERSION_MAJOR=4 -I/usr/pgsql-15/include -I/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2 -I/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fPIC -pie -pthread   -o CMakeFiles/pgagent.dir/connection.cpp.o -c /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:372:2: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
  if (m_result != nullptr)
  ^
In file included from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/pgAgent.h:36:0,
                 from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:12:
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h: In constructor 'DBconn::DBconn(const string&)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:113:19: warning: 'DBconn::m_inUse' will be initialized after [-Wreorder]
  bool             m_inUse;
                   ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:109:19: warning:   'DBconn* DBconn::m_next' [-Wreorder]
  DBconn          *m_next;
                   ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:22:1: warning:   when initialized here [-Wreorder]
 DBconn::DBconn(const std::string &connectString)
 ^
In file included from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/pgAgent.h:36:0,
                 from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:12:
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:110:19: warning: 'DBconn::m_prev' will be initialized after [-Wreorder]
  DBconn          *m_prev;
                   ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:98:7: warning:   'int DBconn::m_minorVersion' [-Wreorder]
  int  m_minorVersion,
       ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:22:1: warning:   when initialized here [-Wreorder]
 DBconn::DBconn(const std::string &connectString)
 ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp: In member function 'std::string DBconn::ExecuteScalar(const string&)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:328:6: warning: variable 'rows' set but not used [-Wunused-but-set-variable]
  int rows = -1;
      ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp: In constructor 'DBresult::DBresult(DBconn*, const string&)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:372:18: error: 'nullptr' was not declared in this scope
  if (m_result != nullptr)
                  ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp: In static member function 'static const string CONNinfo::Parse(const string&, std::string*, std::string*, bool)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:436:30: error: 'nullptr' was not declared in this scope
  char              *errmsg = nullptr;
                              ^
make[3]: *** [CMakeFiles/pgagent.dir/connection.cpp.o] Error 1
make[3]: Leaving directory `/home/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2'
make[2]: *** [CMakeFiles/pgagent.dir/all] Error 2
make[2]: Leaving directory `/home/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2'
error: Bad exit status from /var/tmp/rpm-tmp.aZ1q0W (%install)


Job finishes successfully but reruns unwanted!!!

Hi,
I have a pgagent instance installed on Windows and Linux.
In both platforms I created one Job and multiple Job steps. It starts at the time scheduled and finishes successfully.
But reruns again and again.
I do upload some pics.

My schedule:
1
The History
2

Ability to connect using pgadmin,but unability to connect throgh pgagent job

I have a postgresql instance and pgagent on windows server.

When I try to connect to a remote Linux version of postgresql through pgagent, it happens,but when I try to connect using pgagent job I get this error:

Couldn't get a connection to the database

Pgpass on the remote server is properly configured.

PgAgent seems to ignore .pgpass whenever it has 127.0.0.1 (127.0.0.1:5432:*:postgres:postgres) throws an error:

PgAgent is not inline with standard program psql program for passing host address in connection string. PgAgent is passing host address to libpq with always ‘hostaddr=’ instead of ‘host=’
Because of this, when we run pgagent with command – “/usr/bin/pgagent -f -l 2 hostaddr=127.0.0.1 dbname=linuxpostgresdb user=postgres port=5432”

PgAgent seems to ignore .pgpass whenever it has 127.0.0.1 (127.0.0.1:5432:*:postgres:postgres) throws an error:
DEBUG: Creating DB connection: user=postgres port=5432 hostaddr=127.0.0.1 dbname=linuxpostgresdb
WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth: no password supplied

If the .pgpass is modified to have the contents( localhost:5432:*:postgres:postgres), then above pgAgent command works fine without complaining.

When we change pgAgent code, where connection.cpp:461 like the below; It works in line to the psql program.
connStr += wxT(" host=") + host;

With this change, pgAgent is in line with itself. Since the command line string should always match with pgpass.conf.

Can you please incorporate this change.

pgagent_11 not work

I download
https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7.8-x86_64/pgagent_11-4.0.0-4.rhel7.x86_64.rpm
and install it on
CentOS Linux release 7.8.2003 (Core)

but pagent not working

postgresql.log:
2022-10-03 17:01:45 MSK postgres 127.0.0.1(45240) 6696 ERROR: unterminated quoted string at or near "'" at character 80 2022-10-03 17:01:45 MSK postgres 127.0.0.1(45240) 6696 STATEMENT: INSERT INTO pgagent.pga_jobagent (jagpid, jagstation) SELECT pg_backend_pid(), ' 2022-10-03 17:01:45 MSK postgres 127.0.0.1(45242) 6701 ERROR: unterminated quoted string at or near "'" at character 80 2022-10-03 17:01:45 MSK postgres 127.0.0.1(45242) 6701 STATEMENT: INSERT INTO pgagent.pga_jobagent (jagpid, jagstation) SELECT pg_backend_pid(), '

pgagent_11.log:
Mon Oct 3 17:01:55 2022 WARNING: Couldn't create the primary connection [Attempt #6]

SQL error in pgagent.pga_exception_trigger

On PG 9.1 an SQL error is generated because the local variable is the same name as a column in a query, the following code corrects the issue.

CREATE OR REPLACE FUNCTION pgagent.pga_exception_trigger (
)
RETURNS trigger AS
$body$
DECLARE

l_jobid int4 := 0;

BEGIN

 IF TG_OP = 'DELETE' THEN

    SELECT INTO l_jobid jscjobid FROM pgagent.pga_schedule WHERE jscid = OLD.jexscid;

    -- update pga_job from remaining schedules
    -- the actual calculation of jobnextrun will be performed in the trigger
    UPDATE pgagent.pga_job
       SET jobnextrun = NULL
     WHERE jobenabled AND jobid=l_jobid;
    RETURN OLD;
ELSE

    SELECT INTO l_jobid jscjobid FROM pgagent.pga_schedule WHERE jscid = NEW.jexscid;

    UPDATE pgagent.pga_job
       SET jobnextrun = NULL
     WHERE jobenabled AND jobid=l_jobid;
    RETURN NEW;
END IF;

END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;

new row for relation "pga_schedule" violates check constraint "pga_schedule_jscmonthdays_size"

  1. postgres : psql (14.2 (Debian 14.2-1.pgdg110+1), server 14.10 (Debian 14.10-1.pgdg110+1))
  2. pgadmin4 : Version 8.5
  3. pgagent 4.2.2

i think there is a mistake in pga_schedule_jscmonthdays_size CONSTRAINT :
ALTER TABLE pgagent.pga_schedule ADD CONSTRAINT pga_schedule_jscmonthdays_size CHECK ((array_upper(jscmonthdays, 1) = 32))

if check TRUE then insert is OK , but there is no any month with 32 days !

??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.