4 CREATE TABLE OID_TBL(f1 oid);
5 INSERT INTO OID_TBL(f1) VALUES ('1234');
6 INSERT INTO OID_TBL(f1) VALUES ('1235');
7 INSERT INTO OID_TBL(f1) VALUES ('987');
8 INSERT INTO OID_TBL(f1) VALUES ('-1040');
9 INSERT INTO OID_TBL(f1) VALUES ('99999999');
10 INSERT INTO OID_TBL(f1) VALUES ('5 ');
11 INSERT INTO OID_TBL(f1) VALUES (' 10 ');
12 -- leading/trailing hard tab is also allowed
13 INSERT INTO OID_TBL(f1) VALUES (' 15 ');
15 INSERT INTO OID_TBL(f1) VALUES ('');
16 ERROR: invalid input syntax for type oid: ""
17 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('');
19 INSERT INTO OID_TBL(f1) VALUES (' ');
20 ERROR: invalid input syntax for type oid: " "
21 LINE 1: INSERT INTO OID_TBL(f1) VALUES (' ');
23 INSERT INTO OID_TBL(f1) VALUES ('asdfasd');
24 ERROR: invalid input syntax for type oid: "asdfasd"
25 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('asdfasd');
27 INSERT INTO OID_TBL(f1) VALUES ('99asdfasd');
28 ERROR: invalid input syntax for type oid: "99asdfasd"
29 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('99asdfasd');
31 INSERT INTO OID_TBL(f1) VALUES ('5 d');
32 ERROR: invalid input syntax for type oid: "5 d"
33 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('5 d');
35 INSERT INTO OID_TBL(f1) VALUES (' 5d');
36 ERROR: invalid input syntax for type oid: " 5d"
37 LINE 1: INSERT INTO OID_TBL(f1) VALUES (' 5d');
39 INSERT INTO OID_TBL(f1) VALUES ('5 5');
40 ERROR: invalid input syntax for type oid: "5 5"
41 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('5 5');
43 INSERT INTO OID_TBL(f1) VALUES (' - 500');
44 ERROR: invalid input syntax for type oid: " - 500"
45 LINE 1: INSERT INTO OID_TBL(f1) VALUES (' - 500');
47 INSERT INTO OID_TBL(f1) VALUES ('32958209582039852935');
48 ERROR: value "32958209582039852935" is out of range for type oid
49 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('32958209582039852935');
51 INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385');
52 ERROR: value "-23582358720398502385" is out of range for type oid
53 LINE 1: INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385');
55 SELECT * FROM OID_TBL;
68 -- Also try it with non-error-throwing API
69 SELECT pg_input_is_valid('1234', 'oid');
75 SELECT pg_input_is_valid('01XYZ', 'oid');
81 SELECT * FROM pg_input_error_info('01XYZ', 'oid');
82 message | detail | hint | sql_error_code
83 --------------------------------------------+--------+------+----------------
84 invalid input syntax for type oid: "01XYZ" | | | 22P02
87 SELECT pg_input_is_valid('9999999999', 'oid');
93 SELECT * FROM pg_input_error_info('9999999999', 'oid');
94 message | detail | hint | sql_error_code
95 -------------------------------------------------+--------+------+----------------
96 value "9999999999" is out of range for type oid | | | 22003
99 -- While we're here, check oidvector as well
100 SELECT pg_input_is_valid(' 1 2 4 ', 'oidvector');
106 SELECT pg_input_is_valid('01 01XYZ', 'oidvector');
112 SELECT * FROM pg_input_error_info('01 01XYZ', 'oidvector');
113 message | detail | hint | sql_error_code
114 ------------------------------------------+--------+------+----------------
115 invalid input syntax for type oid: "XYZ" | | | 22P02
118 SELECT pg_input_is_valid('01 9999999999', 'oidvector');
124 SELECT * FROM pg_input_error_info('01 9999999999', 'oidvector');
125 message | detail | hint | sql_error_code
126 -------------------------------------------------+--------+------+----------------
127 value "9999999999" is out of range for type oid | | | 22003
130 SELECT o.* FROM OID_TBL o WHERE o.f1 = 1234;
136 SELECT o.* FROM OID_TBL o WHERE o.f1 <> '1234';
148 SELECT o.* FROM OID_TBL o WHERE o.f1 <= '1234';
158 SELECT o.* FROM OID_TBL o WHERE o.f1 < '1234';
167 SELECT o.* FROM OID_TBL o WHERE o.f1 >= '1234';
176 SELECT o.* FROM OID_TBL o WHERE o.f1 > '1234';