1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
--- Debian version type and operators -*- sql -*-
---
--- Copyright © 2008 Roger Leigh <rleigh@debian.org>
---
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 2 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful, but
--- WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--- General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see
--- <http://www.gnu.org/licenses/>.
CREATE EXTENSION debversion;
SET client_min_messages = warning; -- suppress "pkey created" message
CREATE TABLE versions (
ver debversion
CONSTRAINT versions_pkey PRIMARY KEY
);
RESET client_min_messages;
INSERT INTO versions (ver) VALUES ('4.1.5-2');
INSERT INTO versions (ver) VALUES ('4.0.2-1');
INSERT INTO versions (ver) VALUES ('4.1.4-1');
INSERT INTO versions (ver) VALUES ('4.1.5-1');
INSERT INTO versions (ver) VALUES ('4.2.0-1');
INSERT INTO versions (ver) VALUES ('4.1.4-2');
INSERT INTO versions (ver) VALUES ('4.1.5-2.01');
INSERT INTO versions (ver) VALUES ('4.1.99-a2-1');
INSERT INTO versions (ver) VALUES ('5.2.1-2');
INSERT INTO versions (ver) VALUES ('5.0.0-3');
INSERT INTO versions (ver) VALUES ('5.1.98.2-2');
INSERT INTO versions (ver) VALUES ('3.1.4-1');
INSERT INTO versions (ver) VALUES ('5.2.3-1');
INSERT INTO versions (ver) VALUES ('0:5.2.2-1');
INSERT INTO versions (ver) VALUES ('0:5.2.4-1');
INSERT INTO versions (ver) VALUES ('1:3.2.3-1');
SELECT * FROM versions ORDER BY ver;
ver
-------------
3.1.4-1
4.0.2-1
4.1.4-1
4.1.4-2
4.1.5-1
4.1.5-2
4.1.5-2.01
4.1.99-a2-1
4.2.0-1
5.0.0-3
5.1.98.2-2
5.2.1-2
0:5.2.2-1
5.2.3-1
0:5.2.4-1
1:3.2.3-1
(16 rows)
SELECT min(ver) FROM versions;
min
---------
3.1.4-1
(1 row)
SELECT max(ver) FROM versions;
max
-----------
1:3.2.3-1
(1 row)
-- PK violations
INSERT INTO versions (ver) VALUES ('0:4.1.5-2');
ERROR: duplicate key value violates unique constraint "versions_pkey"
DETAIL: Key (ver)=(0:4.1.5-2) already exists.
INSERT INTO versions (ver) VALUES ('04.1.5-2');
ERROR: duplicate key value violates unique constraint "versions_pkey"
DETAIL: Key (ver)=(04.1.5-2) already exists.
INSERT INTO versions (ver) VALUES ('4.01.5-2');
ERROR: duplicate key value violates unique constraint "versions_pkey"
DETAIL: Key (ver)=(4.01.5-2) already exists.
INSERT INTO versions (ver) VALUES ('4.1.05-2');
ERROR: duplicate key value violates unique constraint "versions_pkey"
DETAIL: Key (ver)=(4.1.05-2) already exists.
INSERT INTO versions (ver) VALUES ('4.1.5-02');
ERROR: duplicate key value violates unique constraint "versions_pkey"
DETAIL: Key (ver)=(4.1.5-02) already exists.
|