Hello, in general, subject. There is a postgresql 9.3 database, in it there are 2 wrapper tables, I wrote a sql request for the insert, it executes the rules, added it to pgagent, writes that everything was fine, but there is no result. if you perform manually the result is. Here is the request itself

insert into oracle_billetwba (data_in,nplv,ves,line) select to_timestamp(datetimecontrol,'Mon DD YYYY HH12:MI:SS:MSAM')::timestamp without time zone,numbermelt,to_number(regexp_replace(weigth, ',', '.'),'9.99'),'Б' from mssql_billetwbb_test where to_timestamp(datetimecontrol,'Mon DD YYYY HH12:MI:SS:MSAM')::timestamp without time zone>(select max(data_in)from oracle_billetwba where line='Б'); 
  • There are other tasks there, they are performed normally - Egor
  • In general, pgagent does not want to perform select in where - Egor

1 answer 1

Used bash

 #!/bin/bash sudo -u postgres -ppasword psql -d bdname -c "insert into oracle_billetwba (data_in,nplv,ves,line) select to_timestamp(datetimecontrol,'Mon DD YYYY HH12:MI:SS:MSAM')::timestamp without time zone,numbermelt,to_number(regexp_replace(weigth, ',', '.'),'9.99'),'Б' from mssql_billetwbb_test where to_timestamp(datetimecontrol,'Mon DD YYYY HH12:MI:SS:MSAM')::timestamp without time zone>(select max(data_in)from oracle_billetwba where line='Б');"