Replace bigint seconds and useconds with timestamp in psql
This commit is contained in:
parent
4636d04ab2
commit
5794633735
|
@ -31,10 +31,8 @@ CREATE TABLE IF NOT EXISTS ulog2_ct (
|
|||
icmp_code smallint default NULL,
|
||||
icmp_type smallint default NULL,
|
||||
ct_mark bigint default 0,
|
||||
flow_start_sec bigint default 0,
|
||||
flow_start_usec bigint default 0,
|
||||
flow_end_sec bigint default 0,
|
||||
flow_end_usec bigint default 0,
|
||||
flow_start timestamp default NULL,
|
||||
flow_end timestamp default NULL,
|
||||
ct_event smallint default 0
|
||||
);
|
||||
|
||||
|
@ -91,9 +89,11 @@ BEGIN
|
|||
reply_ip_saddr_str, reply_ip_daddr_str, reply_ip_protocol,
|
||||
reply_l4_sport, reply_l4_dport, reply_raw_pktlen, reply_raw_pktcount,
|
||||
icmp_code, icmp_type, ct_mark,
|
||||
flow_start_sec, flow_start_usec,
|
||||
flow_end_sec, flow_end_usec, ct_event)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24);
|
||||
flow_start, flow_end, ct_event)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,
|
||||
to_timestamp($20) + $21 * interval '1 microsecond'
|
||||
to_timestamp($22) + $23 * interval '1 microsecond',
|
||||
$24);
|
||||
_id = $1;
|
||||
RETURN _id;
|
||||
END
|
||||
|
@ -133,8 +133,8 @@ BEGIN
|
|||
if (_orig_ip_protocol = 1) THEN
|
||||
UPDATE ulog2_ct SET (orig_raw_pktlen, orig_raw_pktcount,
|
||||
reply_raw_pktlen, reply_raw_pktcount,
|
||||
ct_mark, flow_end_sec, flow_end_usec, ct_event)
|
||||
= ($8,$9,$15,$16,$19,$22,$23,$24)
|
||||
ct_mark, flow_end, ct_event)
|
||||
= ($8,$9,$15,$16,$19,to_timestamp($22) + $23 * interval '1 microsecond',$24)
|
||||
WHERE ct_id=$1 AND oob_family=$2 AND orig_ip_saddr_str = $3
|
||||
AND orig_ip_daddr_str = $4 AND orig_ip_protocol = $5
|
||||
AND reply_ip_saddr_str = $10 AND reply_ip_daddr_str = $11
|
||||
|
@ -144,8 +144,8 @@ BEGIN
|
|||
ELSE
|
||||
UPDATE ulog2_ct SET (orig_raw_pktlen, orig_raw_pktcount,
|
||||
reply_raw_pktlen, reply_raw_pktcount,
|
||||
ct_mark, flow_end_sec, flow_end_usec, ct_event)
|
||||
= ($8,$9,$15,$16,$19,$22,$23,$24)
|
||||
ct_mark, flow_end, ct_event)
|
||||
= ($8,$9,$15,$16,$19,to_timestamp($22) + $23 * interval '1 microsecond',$24)
|
||||
WHERE ct_id=$1 AND oob_family=$2 AND orig_ip_saddr_str = $3
|
||||
AND orig_ip_daddr_str = $4 AND orig_ip_protocol = $5
|
||||
AND orig_l4_sport = $6 AND orig_l4_dport = $7
|
||||
|
|
Loading…
Reference in a new issue