Added job step and job schedule disable icons to identify it quickly within the browser tree. Fixes #4636

Add Reverse Engineered and Modified SQL tests for pgAgent jobs. Fixes #4623
Fixed modified SQL issue while adding an exception in pgAgent job schedule. Fixes #5356
This commit is contained in:
Neel Patel
2020-04-21 17:00:21 +05:30
committed by Akshay Joshi
parent f289dfb762
commit 07f72252d7
41 changed files with 1616 additions and 39 deletions

View File

@@ -10,6 +10,7 @@
"""Implements the pgAgent Jobs Node"""
from functools import wraps
import json
from datetime import datetime, time
from flask import render_template, request, jsonify
from flask_babelex import gettext as _
@@ -323,7 +324,8 @@ SELECT EXISTS(
row['jobid'],
sid,
row['jobname'],
icon="icon-pga_job"
icon="icon-pga_job" if row['jobenabled']
else "icon-pga_job-disabled"
)
)
@@ -500,6 +502,10 @@ SELECT EXISTS(
if schedule['jexid']:
idx = 0
for exc in schedule['jexid']:
# Convert datetime.time object to string
if isinstance(schedule['jextime'][idx], time):
schedule['jextime'][idx] = \
schedule['jextime'][idx].strftime("%H:%M:%S")
schedule['jscexceptions'].append({
'jexid': exc,
'jexdate': schedule['jexdate'][idx],

View File

@@ -73,6 +73,23 @@ class JobScheduleModule(CollectionNodeModule):
"""
return 'pga_job'
@property
def csssnippets(self):
"""
Returns a snippet of css to include in the page
"""
snippets = [
render_template(
"pga_schedule/css/pga_schedule.css",
node_type=self.node_type
)
]
for submodule in self.submodules:
snippets.extend(submodule.csssnippets)
return snippets
@property
def module_use_template_javascript(self):
"""
@@ -245,7 +262,8 @@ class JobScheduleView(PGChildNodeView):
row['jscid'],
row['jscjobid'],
row['jscname'],
icon="icon-pga_schedule",
icon="icon-pga_schedule" if row['jscenabled'] else
"icon-pga_schedule-disabled",
enabled=row['jscenabled']
)
)
@@ -256,7 +274,8 @@ class JobScheduleView(PGChildNodeView):
row['jscid'],
row['jscjobid'],
row['jscname'],
icon="icon-pga_schedule",
icon="icon-pga_schedule" if row['jscenabled'] else
"icon-pga_schedule-disabled",
enabled=row['jscenabled']
)
)
@@ -359,7 +378,8 @@ class JobScheduleView(PGChildNodeView):
row['jscid'],
row['jscjobid'],
row['jscname'],
icon="icon-pga_schedule",
icon="icon-pga_schedule" if row['jscenabled'] else
"icon-pga_schedule-disabled",
enabled=row['jscenabled']
)
)
@@ -422,7 +442,8 @@ class JobScheduleView(PGChildNodeView):
jscid,
jid,
row['jscname'],
icon="icon-pga_schedule",
icon="icon-pga_schedule" if row['jscenabled'] else
"icon-pga_schedule-disabled",
enabled=row['jscenabled']
)
)

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#E3F3F9;stroke:#BD4949;stroke-width:0.75;stroke-miterlimit:10;}
.st1{fill:#1E50AD;}
.st2{fill:#D0021B;}
</style>
<circle class="st0" cx="8" cy="8.2" r="5.4"/>
<path class="st1" d="M10.7,7.7H8.5V4.6c0-0.3-0.2-0.5-0.5-0.5S7.5,4.3,7.5,4.6v3.6c0,0.3,0.2,0.5,0.5,0.5h2.7c0.3,0,0.5-0.2,0.5-0.5
S11,7.7,10.7,7.7z"/>
<path class="st2" d="M13.3,3.9l1.5-1.5c0.3-0.3,0.3-0.8,0-1.1s-0.8-0.3-1.1,0l-1.5,1.5l-1.5-1.5c-0.3-0.3-0.8-0.3-1.1,0
s-0.3,0.8,0,1.1l1.5,1.5L9.7,5.4c-0.3,0.3-0.3,0.8,0,1.1c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2L12.2,5l1.5,1.5
c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2c0.3-0.3,0.3-0.8,0-1.1L13.3,3.9z"/>
</svg>

After

Width:  |  Height:  |  Size: 1004 B

View File

@@ -366,13 +366,6 @@ define('pgadmin.node.pga_schedule', [
var res = Backform.FieldsetControl.prototype.render.apply(
this, arguments
);
// $(
// '<div>' +
// gettext('Schedules are specified using a <strong>cron-style</strong> format.<br/><ul><li>For each selected time or date element, the schedule will execute.<br/>e.g. To execute at 5 minutes past every hour, simply select 05 in the Minutes list box.<br/></li><li>Values from more than one field may be specified in order to further control the schedule.<br/>e.g. To execute at 12:05 and 14:05 every Monday and Thursday, you would click minute 05, hours 12 and 14, and weekdays Monday and Thursday.</li><li>For additional flexibility, the Month Days check list includes an extra Last Day option. This matches the last day of the month, whether it happens to be the 28th, 29th, 30th or 31st.</li></ul>') +
// '</div>'
// ).insertBefore(this.$el);
return res;
},
}),
@@ -498,7 +491,8 @@ define('pgadmin.node.pga_schedule', [
if (_.isUndefined(val) || _.isNull(val) ||
String(val).replace(/^\s+|\s+$/g, '') == '') {
if (val == '') {
this.set('jscend', undefined);
/* Set the default value used in model initialization */
this.set('jscend', null);
}
return;
}

View File

@@ -6,3 +6,21 @@
vertical-align: middle;
height: 1.3em;
}
.icon-pga_schedule-disabled {
background-image: url('{{ url_for('NODE-pga_schedule.static', filename='img/pga_schedule-disabled.svg') }}') !important;
background-repeat: no-repeat;
background-size: 20px !important;
align-content: center;
vertical-align: middle;
height: 1.3em;
}
.icon-coll-pga_schedule {
background-image: url('{{ url_for('NODE-pga_schedule.static', filename='img/coll-pga_schedule.svg') }}') !important;
background-repeat: no-repeat;
background-size: 20px !important;
align-content: center;
vertical-align: middle;
height: 1.3em;
}

View File

@@ -274,7 +274,8 @@ SELECT EXISTS(
row['jstid'],
row['jstjobid'],
row['jstname'],
icon="icon-pga_jobstep",
icon="icon-pga_jobstep" if row['jstenabled'] else
"icon-pga_jobstep-disabled",
enabled=row['jstenabled'],
kind=row['jstkind']
)
@@ -286,7 +287,8 @@ SELECT EXISTS(
row['jstid'],
row['jstjobid'],
row['jstname'],
icon="icon-pga_jobstep",
icon="icon-pga_jobstep" if row['jstenabled'] else
"icon-pga_jobstep-disabled",
enabled=row['jstenabled'],
kind=row['jstkind']
)
@@ -383,7 +385,8 @@ SELECT EXISTS(
row['jstid'],
row['jstjobid'],
row['jstname'],
icon="icon-pga_jobstep"
icon="icon-pga_jobstep" if row['jstenabled']
else "icon-pga_jobstep-disabled"
)
)
@@ -469,7 +472,8 @@ SELECT EXISTS(
jstid,
jid,
row['jstname'],
icon="icon-pga_jobstep"
icon="icon-pga_jobstep" if row['jstenabled']
else "icon-pga_jobstep-disabled"
)
)

View File

@@ -1 +1,45 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#def4fd;}.cls-2{fill:#34495e;}.cls-3{fill:#2195e7;}.cls-4{fill:none;stroke:#2195e7;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.75px;}</style></defs><title>coll-pga_jobstep</title><g id="_2" data-name="2"><rect class="cls-1" x="3.89" y="3.38" width="8.23" height="10.25" rx="0.63" ry="0.63"/><path class="cls-2" d="M11.49,3.75a.25.25,0,0,1,.25.25v9a.25.25,0,0,1-.25.25h-7A.25.25,0,0,1,4.26,13V4a.25.25,0,0,1,.25-.25h7m0-.75h-7a1,1,0,0,0-1,1v9a1,1,0,0,0,1,1h7a1,1,0,0,0,1-1V4a1,1,0,0,0-1-1Z"/><path class="cls-1" d="M6.38,3.63V3A.63.63,0,0,1,7,2.38H9A.63.63,0,0,1,9.63,3v.63Z"/><path class="cls-2" d="M9,2.75A.25.25,0,0,1,9.25,3v.25H6.75V3A.25.25,0,0,1,7,2.75H9M9,2H7A1,1,0,0,0,6,3V4h4V3A1,1,0,0,0,9,2Z"/><polygon class="cls-3" points="10.93 5.97 8 5.97 8 6.65 10.93 6.65 10.93 5.97 10.93 5.97"/><polygon class="cls-3" points="10.93 8.54 8 8.54 8 9.22 10.93 9.22 10.93 8.54 10.93 8.54"/><polygon class="cls-3" points="10.93 11.29 8 11.29 8 11.98 10.93 11.98 10.93 11.29 10.93 11.29"/><polyline class="cls-4" points="5.47 6.36 6.13 6.89 7.22 5.41"/><polyline class="cls-4" points="5.47 9.09 6.13 9.62 7.22 8.14"/><polyline class="cls-4" points="5.47 11.54 6.13 12.07 7.22 10.59"/></g></svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#DEF4FD;}
.st1{fill:#34495E;}
.st2{fill:#2195E7;}
.st3{fill:none;stroke:#2195E7;stroke-width:0.6667;stroke-linecap:round;stroke-linejoin:round;}
</style>
<g>
<g id="_2">
<path class="st0" d="M2.9,2.7h6.2c0.3,0,0.6,0.3,0.6,0.6v8c0,0.3-0.3,0.6-0.6,0.6H2.9c-0.3,0-0.6-0.3-0.6-0.6v-8
C2.4,3,2.6,2.7,2.9,2.7z"/>
<path class="st1" d="M9.1,3.1c0.1,0,0.2,0.1,0.2,0.2v8c0,0.1-0.1,0.2-0.2,0.2H2.9c-0.1,0-0.2-0.1-0.2-0.2v-8
c0-0.1,0.1-0.2,0.2-0.2H9.1 M9.2,2.4H2.9C2.4,2.4,2,2.8,2,3.3v8c0,0.5,0.4,0.9,0.9,0.9h6.2c0.5,0,0.9-0.4,0.9-0.9v-8
C10,2.8,9.6,2.4,9.2,2.4z"/>
<path class="st0" d="M4.6,3V2.4c0-0.3,0.2-0.5,0.6-0.6h1.8c0.3,0,0.6,0.2,0.6,0.6V3H4.6z"/>
<path class="st1" d="M6.9,2C7,2,7.1,2.1,7.1,2.2v0.2H4.9V2.2C4.9,2.1,5,2,5.1,2H6.9 M6.9,1.3H5.1c-0.5,0-0.9,0.4-0.9,0.9v0.9h3.6
V2.2C7.8,1.7,7.4,1.3,6.9,1.3z"/>
<polygon class="st2" points="8.6,5 6,5 6,5.6 8.6,5.6 8.6,5 "/>
<polygon class="st2" points="8.6,7.3 6,7.3 6,7.9 8.6,7.9 8.6,7.3 "/>
<polygon class="st2" points="8.6,9.8 6,9.8 6,10.4 8.6,10.4 8.6,9.8 "/>
<polyline class="st3" points="3.8,5.4 4.4,5.9 5.3,4.5 "/>
<polyline class="st3" points="3.8,7.8 4.4,8.3 5.3,7 "/>
<polyline class="st3" points="3.8,10 4.4,10.5 5.3,9.1 "/>
</g>
<g id="_2_2_">
<path class="st0" d="M6.9,5.3h6.2c0.3,0,0.6,0.3,0.6,0.6v8c0,0.3-0.3,0.6-0.6,0.6H6.9c-0.3,0-0.6-0.3-0.6-0.6v-8
C6.3,5.5,6.5,5.3,6.9,5.3z"/>
<path class="st1" d="M13.1,5.6c0.1,0,0.2,0.1,0.2,0.2v8c0,0.1-0.1,0.2-0.2,0.2H6.8c-0.1,0-0.2-0.1-0.2-0.2v-8
c0-0.1,0.1-0.2,0.2-0.2H13.1 M13.1,4.9H6.8C6.4,4.9,6,5.3,6,5.8v8c0,0.5,0.4,0.9,0.9,0.9h6.2c0.5,0,0.9-0.4,0.9-0.9v-8
C14,5.3,13.6,4.9,13.1,4.9z"/>
<path class="st0" d="M8.5,5.5V4.9c0-0.3,0.2-0.5,0.6-0.6h1.8c0.3,0,0.6,0.2,0.6,0.6v0.6H8.5z"/>
<path class="st1" d="M10.8,4.5c0.1,0,0.2,0.1,0.2,0.2v0.2H8.8V4.7c0-0.1,0.1-0.2,0.2-0.2H10.8 M10.8,3.8H9.1
c-0.5,0-0.9,0.4-0.9,0.9v0.9h3.6V4.7C11.7,4.2,11.3,3.8,10.8,3.8z"/>
<polygon class="st2" points="12.6,7.6 9.9,7.6 9.9,8.2 12.6,8.2 12.6,7.6 "/>
<polygon class="st2" points="12.6,9.9 9.9,9.9 9.9,10.5 12.6,10.5 12.6,9.9 "/>
<polygon class="st2" points="12.6,12.3 9.9,12.3 9.9,12.9 12.6,12.9 12.6,12.3 "/>
<polyline class="st3" points="7.7,7.9 8.3,8.4 9.3,7.1 "/>
<polyline class="st3" points="7.7,10.3 8.3,10.8 9.3,9.5 "/>
<polyline class="st3" points="7.7,12.5 8.3,13 9.3,11.7 "/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#DEF4FD;}
.st1{fill:#34495E;}
.st2{fill:#2195E7;}
.st3{fill:#717F8E;}
.st4{fill:none;stroke:#2195E7;stroke-width:0.75;stroke-linecap:round;stroke-linejoin:round;}
.st5{fill:none;stroke:#D0021B;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;}
</style>
<g id="_2">
<path class="st0" d="M4.5,3.4h7c0.3,0,0.6,0.3,0.6,0.6v9c0,0.3-0.3,0.6-0.6,0.6h-7c-0.3,0-0.6-0.3-0.6-0.6V4
C3.9,3.7,4.2,3.4,4.5,3.4z"/>
<path class="st1" d="M11.5,3.8c0.1,0,0.2,0.1,0.2,0.2v9c0,0.1-0.1,0.2-0.2,0.2h-7c-0.1,0-0.2-0.1-0.2-0.2V4c0-0.1,0.1-0.2,0.2-0.2
H11.5 M11.5,3h-7c-0.6,0-1,0.4-1,1v9c0,0.6,0.4,1,1,1h7c0.6,0,1-0.4,1-1V4C12.5,3.4,12.1,3,11.5,3z"/>
<path class="st0" d="M6.4,3.6V3c0-0.3,0.3-0.6,0.6-0.6h2c0.3,0,0.6,0.3,0.6,0.6v0.6H6.4z"/>
<path class="st1" d="M9,2.8c0.1,0,0.2,0.1,0.2,0.2v0.2H6.8V3c0-0.1,0.1-0.2,0.2-0.2H9 M9,2H7C6.4,2,6,2.4,6,3v1h4V3
C10,2.4,9.6,2,9,2z"/>
<path class="st2" d="M7.7,6.6V5.9h3.2v0.7H7.7z"/>
<path class="st3" d="M7.7,9.2V8.5h3.2v0.7H7.7z"/>
<path class="st3" d="M7.7,12v-0.7h3.2V12H7.7z"/>
<path class="st3" d="M5.6,9.4V8.3h1.1v1.1H5.6z"/>
<path class="st3" d="M5.6,12.1v-1.1h1.1v1.1H5.6z"/>
<polyline class="st4" points="5.5,6.3 6.1,6.9 7.2,5.4 "/>
</g>
<g>
<line class="st5" x1="13.5" y1="2.3" x2="10.5" y2="5.3"/>
<line class="st5" x1="13.5" y1="5.3" x2="10.5" y2="2.3"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -7,6 +7,15 @@
height: 1.3em;
}
.icon-pga_jobstep-disabled {
background-image: url('{{ url_for('NODE-pga_jobstep.static', filename='img/pga_jobstep-disabled.svg') }}') !important;
background-repeat: no-repeat;
background-size: 20px !important;
align-content: center;
vertical-align: middle;
height: 1.3em;
}
.icon-coll-pga_jobstep {
background-image: url('{{ url_for('NODE-pga_jobstep.static', filename='img/coll-pga_jobstep.svg') }}') !important;
background-repeat: no-repeat;

View File

@@ -0,0 +1,54 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_batch_job_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 'b'::character(1),
''::text, ''::name, 'i'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_2'::text, false , 'b'::character(1),
''::text, ''::name, 's'::character(1),
'SELECT 10;'::text, 'job step_2 description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_2'::text, 'test schedule_2 comment'::text, true,
'<TIMESTAMPTZ_1>'::timestamp with time zone, '<TIMESTAMPTZ_2>'::timestamp with time zone,
-- Minutes
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,false,false,false,false,false]::boolean[],
-- Month days
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false]::boolean[]
) RETURNING jscid INTO scid;
END
$$;

View File

@@ -0,0 +1,25 @@
DO $$
DECLARE
scid integer;
BEGIN
-- Inserting a schedule (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
<PGA_JOB_ID>, 'schedule_2'::text, 'test schedule_2 comment'::text, true,
'2020-04-15 05:11:31 -07:00'::timestamp with time zone, '2020-04-16 05:11:34 -07:00'::timestamp with time zone,
-- Minutes
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,false,false,false,false,false]::boolean[],
-- Month days
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,false,false,false,false,false,false,false,false,false,false]::boolean[]
) RETURNING jscid INTO scid;END
$$;

View File

@@ -0,0 +1,33 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_batch_job_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 'b'::character(1),
''::text, ''::name, 'i'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_2'::text, false , 'b'::character(1),
''::text, ''::name, 's'::character(1),
'SELECT 10;'::text, 'job step_2 description'::text
) ;
END
$$;

View File

@@ -0,0 +1,11 @@
-- Inserting a step (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
<PGA_JOB_ID>, 'step_2'::text, false , 'b'::character(1),
''::text, ''::name, 's'::character(1),
'SELECT 10;'::text, 'job step_2 description'::text
) RETURNING jstid;

View File

@@ -0,0 +1,66 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
4::integer, 'test_sql_job_local_db_updated_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description updated'::text, 'test_host_updated'::text, false
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_2_added'::text, true, 's'::character(1),
''::text, 'postgres'::name, 's'::character(1),
'SELECT 3;'::text, 'job step 2 description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_2'::text, 'test schedule_2 comment'::text, false,
'<TIMESTAMPTZ_1>'::timestamp with time zone, '<TIMESTAMPTZ_2>'::timestamp with time zone,
-- Minutes
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[false,false,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-22', 'YYYY-MM-DD')::date, '01:22:00'::time without time zone
);
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-23', 'YYYY-MM-DD')::date, '01:23:00'::time without time zone
);
END
$$;

View File

@@ -0,0 +1,37 @@
DO $$
DECLARE
scid integer;
BEGIN
-- Inserting a schedule (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
<PGA_JOB_ID>, 'schedule_2'::text, 'test schedule_2 comment'::text, false,
'2020-04-14 05:11:31 -07:00'::timestamp with time zone, '2020-04-15 05:11:34 -07:00'::timestamp with time zone,
-- Minutes
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[false,false,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[false,false,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-22', 'YYYY-MM-DD')::date, '01:22:00'::time without time zone
);
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-23', 'YYYY-MM-DD')::date, '01:23:00'::time without time zone
);END
$$;

View File

@@ -0,0 +1,54 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_remote_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
'host=localhost port=5432 dbname=postgres connect_timeout=10'::text, ''::name, 's'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_2'::text, false , 's'::character(1),
'host=localhost port=5434 dbname=postgres connect_timeout=20'::text, ''::name, 'f'::character(1),
'SELECT 5;'::text, 'job step_2 description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_2'::text, 'test schedule_2 comment'::text, true,
'<TIMESTAMPTZ_1>'::timestamp with time zone, '<TIMESTAMPTZ_2>'::timestamp with time zone,
-- Minutes
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Week days
ARRAY[false,false,false,false,false,false,false]::boolean[],
-- Month days
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false]::boolean[]
) RETURNING jscid INTO scid;
END
$$;

View File

@@ -0,0 +1,25 @@
DO $$
DECLARE
scid integer;
BEGIN
-- Inserting a schedule (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
<PGA_JOB_ID>, 'schedule_2'::text, 'test schedule_2 comment'::text, true,
'2020-04-15 05:11:31 -07:00'::timestamp with time zone, '2020-04-16 05:11:34 -07:00'::timestamp with time zone,
-- Minutes
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Week days
ARRAY[false,false,false,false,false,false,false]::boolean[],
-- Month days
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[false,false,false,false,false,false,false,false,false,false,false,false]::boolean[]
) RETURNING jscid INTO scid;END
$$;

View File

@@ -0,0 +1,33 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
4::integer, 'test_sql_job_local_db_updated_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description updated'::text, 'test_host_updated'::text, false
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_2_added'::text, true, 's'::character(1),
''::text, 'postgres'::name, 's'::character(1),
'SELECT 3;'::text, 'job step 2 description'::text
) ;
END
$$;

View File

@@ -0,0 +1,11 @@
-- Inserting a step (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
<PGA_JOB_ID>, 'step_2_added'::text, true, 's'::character(1),
''::text, 'postgres'::name, 's'::character(1),
'SELECT 3;'::text, 'job step 2 description'::text
) RETURNING jstid;

View File

@@ -0,0 +1,33 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_remote_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
'host=localhost port=5432 dbname=postgres connect_timeout=10'::text, ''::name, 's'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_2'::text, false , 's'::character(1),
'host=localhost port=5434 dbname=postgres connect_timeout=20'::text, ''::name, 'f'::character(1),
'SELECT 5;'::text, 'job step_2 description'::text
) ;
END
$$;

View File

@@ -0,0 +1,11 @@
-- Inserting a step (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
<PGA_JOB_ID>, 'step_2'::text, false , 's'::character(1),
'host=localhost port=5434 dbname=postgres connect_timeout=20'::text, ''::name, 'f'::character(1),
'SELECT 5;'::text, 'job step_2 description'::text
) RETURNING jstid;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
4::integer, 'test_sql_job_local_db_updated_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description updated'::text, 'test_host_updated'::text, false
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,3 @@
UPDATE pgagent.pga_job
SET jobjclid=4::integer, jobname='test_sql_job_local_db_updated_$%{}[]()&*^!@""''`\/#'::text, jobdesc='test_job_step_schedule description updated'::text, jobhostagent='test_host_updated'::text, jobenabled=false
WHERE jobid = <PGA_JOB_ID>;

View File

@@ -0,0 +1,45 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_batch_job_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 'b'::character(1),
''::text, ''::name, 'i'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_1'::text, 'test schedule comment'::text, true,
'<TIMESTAMPTZ_1>'::timestamp with time zone, '<TIMESTAMPTZ_2>'::timestamp with time zone,
-- Minutes
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
END
$$;

View File

@@ -0,0 +1,45 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_batch_job_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 'b'::character(1),
''::text, ''::name, 'i'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_1'::text, 'test schedule comment'::text, true,
'2020-04-14 01:11:31 -07:00'::timestamp with time zone, '2020-04-15 01:11:34 -07:00'::timestamp with time zone,
-- Minutes
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
END
$$;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_batch_job_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 'b'::character(1),
''::text, ''::name, 'i'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_batch_job_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 'b'::character(1),
''::text, ''::name, 'i'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,57 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_local_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_1'::text, 'test schedule comment'::text, true,
'<TIMESTAMPTZ_1>'::timestamp with time zone, '<TIMESTAMPTZ_2>'::timestamp with time zone,
-- Minutes
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-18', 'YYYY-MM-DD')::date, '01:18:00'::time without time zone
);
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-19', 'YYYY-MM-DD')::date, '01:19:00'::time without time zone
);
END
$$;

View File

@@ -0,0 +1,57 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_local_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_1'::text, 'test schedule comment'::text, true,
'2020-04-14 01:11:31 -07:00'::timestamp with time zone, '2020-04-15 01:11:34 -07:00'::timestamp with time zone,
-- Minutes
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-18', 'YYYY-MM-DD')::date, '01:18:00'::time without time zone
);
-- Inserting a schedule exception
INSERT INTO pgagent.pga_exception (
jexscid, jexdate, jextime
) VALUES (
scid, to_date('2020-04-19', 'YYYY-MM-DD')::date, '01:19:00'::time without time zone
);
END
$$;

View File

@@ -0,0 +1,45 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_remote_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
'host=localhost port=5432 dbname=postgres connect_timeout=10'::text, ''::name, 's'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_1'::text, 'test schedule comment'::text, true,
'<TIMESTAMPTZ_1>'::timestamp with time zone, '<TIMESTAMPTZ_2>'::timestamp with time zone,
-- Minutes
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
END
$$;

View File

@@ -0,0 +1,45 @@
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_remote_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
'host=localhost port=5432 dbname=postgres connect_timeout=10'::text, ''::name, 's'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
-- Schedules
-- Inserting a schedule
INSERT INTO pgagent.pga_schedule(
jscjobid, jscname, jscdesc, jscenabled,
jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
jid, 'schedule_1'::text, 'test schedule comment'::text, true,
'2020-04-14 01:11:31 -07:00'::timestamp with time zone, '2020-04-15 01:11:34 -07:00'::timestamp with time zone,
-- Minutes
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Hours
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false]::boolean[],
-- Week days
ARRAY[true,true,true,true,true,true,true]::boolean[],
-- Month days
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false]::boolean[],
-- Months
ARRAY[true,true,true,true,true,true,true,true,true,true,true,true]::boolean[]
) RETURNING jscid INTO scid;
END
$$;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_remote_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
'host=localhost port=5432 dbname=postgres connect_timeout=10'::text, ''::name, 's'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_remote_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
'host=localhost port=5432 dbname=postgres connect_timeout=10'::text, ''::name, 's'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_local_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,24 @@
DO $$
DECLARE
jid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'test_sql_job_local_db_$%{}[]()&*^!@""''`\/#'::text, 'test_job_step_schedule description'::text, 'test_host'::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'step_1'::text, true, 's'::character(1),
''::text, 'postgres'::name, 'f'::character(1),
'SELECT 1;'::text, 'job step description'::text
) ;
END
$$;

View File

@@ -0,0 +1,503 @@
{
"scenarios": [
{
"type": "create",
"name": "Create SQL job with job step and schedule on local database",
"endpoint": "NODE-pga_job.obj",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql",
"pgagent_test": "True",
"convert_timestamp_columns": { "jschedules": ["jscstart", "jscend"] },
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"jobname": "test_sql_job_local_db_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": true,
"jobhostagent": "test_host",
"jobjclid": "1",
"jobdesc": "test_job_step_schedule description",
"jsteps": [{
"jstid":"",
"jstjobid":"",
"jstname":"step_1",
"jstdesc":"job step description",
"jstenabled":true,
"jstkind":true,
"jstconntype":true,
"jstcode":"SELECT 1;",
"jstconnstr":"",
"jstdbname":"postgres",
"jstonerror":"f",
"jstnextrun":""
}],
"jschedules": [{
"jscid":"",
"jscjobid":"",
"jscname":"schedule_1",
"jscdesc":"test schedule comment",
"jscenabled":true,
"jscstart":"2020-04-14 01:11:31 -07:00",
"jscend":"2020-04-15 01:11:34 -07:00",
"jscweekdays":[true,true,true,true,true,true,true],
"jscmonthdays":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false],
"jscmonths":[true,true,true,true,true,true,true,true,true,true,true,true],
"jschours":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false],
"jscminutes":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscexceptions":[{"jexdate": "2020-04-18", "jextime": "01:18:00"}, {"jexdate": "2020-04-19", "jextime": "01:19:00"}]
}]
},
"expected_sql_file": "create_sql_job_local_db_with_all_options.sql",
"expected_msql_file": "create_sql_job_local_db_with_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop the SQL job scheduled on local database with all the options",
"endpoint": "NODE-pga_job.obj_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"name": "test_sql_job_local_db_$%{}[]()&*^!@\"\"'`\\/#"
}
}, {
"type": "create",
"name": "Create SQL job with job step on local database",
"endpoint": "NODE-pga_job.obj",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"jobname": "test_sql_job_local_db_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": true,
"jobhostagent": "test_host",
"jobjclid": "1",
"jobdesc": "test_job_step_schedule description",
"jsteps": [{
"jstid":"",
"jstjobid":"",
"jstname":"step_1",
"jstdesc":"job step description",
"jstenabled":true,
"jstkind":true,
"jstconntype":true,
"jstcode":"SELECT 1;",
"jstconnstr":"",
"jstdbname":"postgres",
"jstonerror":"f",
"jstnextrun":""
}]
},
"expected_sql_file": "create_sql_job_with_step_local_db.sql",
"expected_msql_file": "create_sql_job_with_step_local_db_msql.sql"
}, {
"type": "alter",
"name": "Alter job with all the options on local database",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"data": {
"jobname": "test_sql_job_local_db_updated_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": false,
"jobjclid": "4",
"jobhostagent": "test_host_updated",
"jobdesc": "test_job_step_schedule description updated"
},
"expected_sql_file": "alter_sql_job_all_options.sql",
"expected_msql_file": "alter_sql_job_all_options_msql.sql"
}, {
"type": "alter",
"name": "Alter job steps with all the options on local database",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"data": {
"jsteps": {
"added": [
{
"jstid":"",
"jstjobid":"",
"jstname": "step_2_added",
"jstdesc": "job step 2 description",
"jstenabled": true,
"jstkind": true,
"jstconntype": true,
"jstcode": "SELECT 3;",
"jstconnstr": "",
"jstdbname": "postgres",
"jstonerror": "s",
"jstnextrun": ""
}
]
}
},
"expected_sql_file": "alter_job_step_all_options.sql",
"expected_msql_file": "alter_job_step_all_options_msql.sql"
}, {
"type": "alter",
"name": "Alter job schedule with all the options on local database",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"convert_timestamp_columns": { "jschedules": ["jscstart", "jscend"] },
"data": {
"jschedules": {
"added": [
{
"jscid":"",
"jscjobid":"",
"jscname":"schedule_2",
"jscdesc":"test schedule_2 comment",
"jscenabled":false,
"jscstart":"2020-04-14 05:11:31 -07:00",
"jscend":"2020-04-15 05:11:34 -07:00",
"jscweekdays":[false,false,true,true,true,true,true],
"jscmonthdays":[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false],
"jscmonths":[false,false,true,true,true,true,true,true,true,true,true,true],
"jschours":[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false],
"jscminutes":[false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscexceptions":[{"jexdate": "2020-04-22", "jextime": "01:22:00"}, {"jexdate": "2020-04-23", "jextime": "01:23:00"}]
}
]
}
},
"expected_sql_file": "alter_job_schedule_all_options.sql",
"expected_msql_file": "alter_job_schedule_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop the SQL job scheduled on local database with all the options",
"endpoint": "NODE-pga_job.obj_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"name": "test_sql_job_local_db_updated_$%{}[]()&*^!@\"\"'`\\/#"
}
}, {
"type": "create",
"name": "Create SQL job with job step and schedule on remote database",
"endpoint": "NODE-pga_job.obj",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql",
"convert_timestamp_columns": { "jschedules": ["jscstart", "jscend"] },
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"jobname": "test_sql_job_remote_db_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": true,
"jobhostagent": "test_host",
"jobjclid": "1",
"jobdesc": "test_job_step_schedule description",
"jsteps": [{
"jstid":"",
"jstjobid":"",
"jstname":"step_1",
"jstdesc":"job step description",
"jstenabled":true,
"jstkind":true,
"jstconntype":false,
"jstcode":"SELECT 1;",
"jstconnstr":"host=localhost port=5432 dbname=postgres connect_timeout=10",
"jstdbname":"",
"jstonerror":"s",
"jstnextrun":""
}],
"jschedules": [{
"jscid":"",
"jscjobid":"",
"jscname":"schedule_1",
"jscdesc":"test schedule comment",
"jscenabled":true,
"jscstart":"2020-04-14 01:11:31 -07:00",
"jscend":"2020-04-15 01:11:34 -07:00",
"jscweekdays":[true,true,true,true,true,true,true],
"jscmonthdays":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false],
"jscmonths":[true,true,true,true,true,true,true,true,true,true,true,true],
"jschours":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false],
"jscminutes":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscexceptions":[]
}]
},
"expected_sql_file": "create_sql_job_remote_db_with_all_options.sql",
"expected_msql_file": "create_sql_job_remote_db_with_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop the SQL job scheduled on remote database with all options",
"endpoint": "NODE-pga_job.obj_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"name": "test_sql_job_remote_db_$%{}[]()&*^!@\"\"'`\\/#"
}
}, {
"type": "create",
"name": "Create SQL job with job step on remote database",
"endpoint": "NODE-pga_job.obj",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"jobname": "test_sql_job_remote_db_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": true,
"jobhostagent": "test_host",
"jobjclid": "1",
"jobdesc": "test_job_step_schedule description",
"jsteps": [{
"jstid":"",
"jstjobid":"",
"jstname":"step_1",
"jstdesc":"job step description",
"jstenabled":true,
"jstkind":true,
"jstconntype":false,
"jstcode":"SELECT 1;",
"jstconnstr":"host=localhost port=5432 dbname=postgres connect_timeout=10",
"jstdbname":"",
"jstonerror":"s",
"jstnextrun":""
}]
},
"expected_sql_file": "create_sql_job_step_remote_db.sql",
"expected_msql_file": "create_sql_job_step_remote_db_msql.sql"
}, {
"type": "alter",
"name": "Alter job steps with all the options on remote database",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"data": {
"jsteps": {
"added": [
{
"jstid":"",
"jstjobid":"",
"jstname":"step_2",
"jstdesc":"job step_2 description",
"jstenabled":false,
"jstkind":true,
"jstconntype":false,
"jstcode":"SELECT 5;",
"jstconnstr":"host=localhost port=5434 dbname=postgres connect_timeout=20",
"jstdbname":"",
"jstonerror":"f",
"jstnextrun":""
}
]
}
},
"expected_sql_file": "alter_job_step_remote_db_all_options.sql",
"expected_msql_file": "alter_job_step_remote_db_all_options_msql.sql"
}, {
"type": "alter",
"name": "Alter job schedule with all the options on remote database",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"convert_timestamp_columns": { "jschedules": ["jscstart", "jscend"] },
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"data": {
"jschedules": {
"added": [
{
"jscid":"",
"jscjobid":"",
"jscname":"schedule_2",
"jscdesc":"test schedule_2 comment",
"jscenabled":true,
"jscstart":"2020-04-15 05:11:31 -07:00",
"jscend":"2020-04-16 05:11:34 -07:00",
"jscweekdays":[false,false,false,false,false,false,false],
"jscmonthdays":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscmonths":[false,false,false,false,false,false,false,false,false,false,false,false],
"jschours":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscminutes":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscexceptions":[]
}
]
}
},
"expected_sql_file": "alter_job_schedule_remote_db_all_options.sql",
"expected_msql_file": "alter_job_schedule_remote_db_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop the SQL job scheduled on remote database with all options",
"endpoint": "NODE-pga_job.obj_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"name": "test_sql_job_remote_db_$%{}[]()&*^!@\"\"'`\\/#"
}
}, {
"type": "create",
"name": "Create batch job with all the options",
"endpoint": "NODE-pga_job.obj",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql",
"convert_timestamp_columns": { "jschedules": ["jscstart", "jscend"] },
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"jobname": "test_batch_job_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": true,
"jobhostagent": "test_host",
"jobjclid": "1",
"jobdesc": "test_job_step_schedule description",
"jsteps": [{
"jstid":"",
"jstjobid":"",
"jstname":"step_1",
"jstdesc":"job step description",
"jstenabled":true,
"jstkind":false,
"jstconntype":true,
"jstcode":"SELECT 1;",
"jstconnstr":"",
"jstdbname":"",
"jstonerror":"i",
"jstnextrun":""
}],
"jschedules": [{
"jscid":"",
"jscjobid":"",
"jscname":"schedule_1",
"jscdesc":"test schedule comment",
"jscenabled":true,
"jscstart":"2020-04-14 01:11:31 -07:00",
"jscend":"2020-04-15 01:11:34 -07:00",
"jscweekdays":[true,true,true,true,true,true,true],
"jscmonthdays":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false],
"jscmonths":[true,true,true,true,true,true,true,true,true,true,true,true],
"jschours":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false],
"jscminutes":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscexceptions":[]
}]
},
"expected_sql_file": "create_batch_job_with_all_options.sql",
"expected_msql_file": "create_batch_job_with_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop the batch job with step and schedule",
"endpoint": "NODE-pga_job.obj_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"name": "test_batch_job_$%{}[]()&*^!@\"\"'`\\/#"
}
}, {
"type": "create",
"name": "Create batch job with job step",
"endpoint": "NODE-pga_job.obj",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"jobname": "test_batch_job_$%{}[]()&*^!@\"\"'`\\/#",
"jobenabled": true,
"jobhostagent": "test_host",
"jobjclid": "1",
"jobdesc": "test_job_step_schedule description",
"jsteps": [{
"jstid":"",
"jstjobid":"",
"jstname":"step_1",
"jstdesc":"job step description",
"jstenabled":true,
"jstkind":false,
"jstconntype":true,
"jstcode":"SELECT 1;",
"jstconnstr":"",
"jstdbname":"",
"jstonerror":"i",
"jstnextrun":""
}]
},
"expected_sql_file": "create_batch_job_with_step.sql",
"expected_msql_file": "create_batch_job_with_step_msql.sql"
}, {
"type": "alter",
"name": "Alter batch job steps with all the options",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"data": {
"jsteps": {
"added": [
{
"jstid":"",
"jstjobid":"",
"jstname":"step_2",
"jstdesc":"job step_2 description",
"jstenabled":false,
"jstkind":false,
"jstconntype":true,
"jstcode":"SELECT 10;",
"jstconnstr":"",
"jstdbname":"",
"jstonerror":"s",
"jstnextrun":""
}
]
}
},
"expected_sql_file": "alter_batch_job_step_all_options.sql",
"expected_msql_file": "alter_batch_job_step_all_options_msql.sql"
}, {
"type": "alter",
"name": "Alter batch job schedule with all the options",
"endpoint": "NODE-pga_job.obj_id",
"sql_endpoint": "NODE-pga_job.sql_id",
"msql_endpoint": "NODE-pga_job.msql_id",
"convert_timestamp_columns": { "jschedules": ["jscstart", "jscend"] },
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"pga_job_id": "<PGA_JOB_ID>",
"data": {
"jschedules": {
"added": [
{
"jscid":"",
"jscjobid":"",
"jscname":"schedule_2",
"jscdesc":"test schedule_2 comment",
"jscenabled":true,
"jscstart":"2020-04-15 05:11:31 -07:00",
"jscend":"2020-04-16 05:11:34 -07:00",
"jscweekdays":[true,true,false,false,false,false,false],
"jscmonthdays":[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscmonths":[true,true,false,false,false,false,false,false,false,false,false,false],
"jschours":[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscminutes":[true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
"jscexceptions":[]
}
]
}
},
"expected_sql_file": "alter_batch_job_schedule_all_options.sql",
"expected_msql_file": "alter_batch_job_schedule_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop the batch job with all the options",
"endpoint": "NODE-pga_job.obj_id",
"pgagent_test": "True",
"precondition_sql": "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='pgagent' AND table_name='pga_jobstep' AND column_name='jstconnstr'",
"data": {
"name": "test_batch_job_$%{}[]()&*^!@\"\"'`\\/#"
}
}
]
}

View File

@@ -10,7 +10,7 @@ CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
NOREPLICATION
CONNECTION LIMIT 100
ENCRYPTED PASSWORD '<PASSWORD>'
VALID UNTIL '<TIMESTAMPTZ>';
VALID UNTIL '<TIMESTAMPTZ_1>';
ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET application_name TO 'pg4';

View File

@@ -10,7 +10,7 @@ CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
NOREPLICATION
CONNECTION LIMIT 100
ENCRYPTED PASSWORD '<PASSWORD>'
VALID UNTIL '<TIMESTAMPTZ>';
VALID UNTIL '<TIMESTAMPTZ_1>';
ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET application_name TO 'pg4';