PG-267 Add testcase to test histogram.

This commit adds following three sql based testcases:

1) Test unique application name set by user.
2) Histogram function is working properly as desired.
3) Error on insert is shown with proper message.
This commit is contained in:
Naeem Akhter
2022-01-19 18:04:02 +05:00
committed by Hamid Akhtar
parent 0573be4090
commit 5aa6764041
9 changed files with 308 additions and 23 deletions

View File

@@ -0,0 +1,34 @@
Drop Table if exists Company;
NOTICE: table "company" does not exist, skipping
CREATE TABLE Company(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL
);
CREATE EXTENSION pg_stat_monitor;
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------
(1 row)
INSERT INTO Company(ID, Name) VALUES (1, 'Percona');
INSERT INTO Company(ID, Name) VALUES (1, 'Percona');
ERROR: duplicate key value violates unique constraint "company_pkey"
DETAIL: Key (id)=(1) already exists.
Drop Table if exists Company;
SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLATE "C",elevel;
query | elevel | sqlcode | message
-------------------------------------------------------+--------+---------+---------------------------------------------------------------
Drop Table if exists Company | 0 | |
INSERT INTO Company(ID, Name) VALUES ($1, $2) | 0 | |
INSERT INTO Company(ID, Name) VALUES (1, 'Percona'); | 21 | 23505 | duplicate key value violates unique constraint "company_pkey"
SELECT pg_stat_monitor_reset() | 0 | |
(4 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------
(1 row)
DROP EXTENSION pg_stat_monitor;