mdref.json config
[mdref/mdref-pq] / pq / Types.md
1 # class pq\Types implements ArrayAccess
2
3 Accessor to the PostgreSQL `pg_type` relation.
4 See [here for an overview](pq/Types/:%20Overview).
5
6 ## Example:
7
8 <?php
9
10 $connection = new pq\Connection;
11 $types = new pq\Types($connection);
12 foreach ($types["int2vector"] as $key=>$val) {
13 printf("%-20s = %s\n", $key, is_bool($val) ? ($val?'t':'f') : $val);
14 }
15
16 ?>
17
18 Yields for a PostgreSQL v9.3 server:
19
20 oid = 22
21 typname = int2vector
22 typnamespace = 11
23 typowner = 10
24 typlen = -1
25 typbyval = f
26 typtype = b
27 typcategory = A
28 typispreferred = f
29 typisdefined = t
30 typdelim = ,
31 typrelid = 0
32 typelem = 21
33 typarray = 1006
34 typinput = int2vectorin
35 typoutput = int2vectorout
36 typreceive = int2vectorrecv
37 typsend = int2vectorsend
38 typmodin = -
39 typmodout = -
40 typanalyze = -
41 typalign = i
42 typstorage = p
43 typnotnull = f
44 typbasetype = 0
45 typtypmod = -1
46 typndims = 0
47 typcollation = 0
48 typdefaultbin =
49 typdefault =
50 typacl =
51
52 > ***NOTE:***
53 The following OID constants are obtained from the postgres server headers at build time and differ
54 between major versions. Dynamic type information, f.e. from extensions or the actual version of
55 the postgres connected to, can be accessed through the ArrayAccess interface of pq\Types.
56
57 ## Constants:
58
59 * BOOL
60 OID of the `bool` type.
61 * BYTEA
62 OID of the `bytea` type.
63 * CHAR
64 OID of the `char` type.
65 * NAME
66 OID of the `name` type.
67 * INT8
68 OID of the `int8` type.
69 * INT2
70 OID of the `int2` type.
71 * INT2VECTOR
72 OID of the `int2vector` type.
73 * INT4
74 OID of the `int4` type.
75 * REGPROC
76 OID of the `regproc` type.
77 * TEXT
78 OID of the `text` type.
79 * OID
80 OID of the `oid` type.
81 * TID
82 OID of the `tid` type.
83 * XID
84 OID of the `xid` type.
85 * CID
86 OID of the `cid` type.
87 * OIDVECTOR
88 OID of the `oidvector` type.
89 * PG_TYPE
90 OID of the `pg_type` type.
91 * PG_ATTRIBUTE
92 OID of the `pg_attribute` type.
93 * PG_PROC
94 OID of the `pg_proc` type.
95 * PG_CLASS
96 OID of the `pg_class` type.
97 * JSON
98 OID of the `json` type.
99 * XML
100 OID of the `xml` type.
101 * XMLARRAY
102 OID of the `xmlarray` type.
103 * JSONARRAY
104 OID of the `jsonarray` type.
105 * PG_NODE_TREE
106 OID of the `pg_node_tree` type.
107 * SMGR
108 OID of the `smgr` type.
109 * POINT
110 OID of the `point` type.
111 * LSEG
112 OID of the `lseg` type.
113 * PATH
114 OID of the `path` type.
115 * BOX
116 OID of the `box` type.
117 * POLYGON
118 OID of the `polygon` type.
119 * LINE
120 OID of the `line` type.
121 * LINEARRAY
122 OID of the `linearray` type.
123 * FLOAT4
124 OID of the `float4` type.
125 * FLOAT8
126 OID of the `float8` type.
127 * UNKNOWN
128 OID of the `unknown` type.
129 * CIRCLE
130 OID of the `circle` type.
131 * CIRCLEARRAY
132 OID of the `circlearray` type.
133 * MONEY
134 OID of the `money` type.
135 * MONEYARRAY
136 OID of the `moneyarray` type.
137 * MACADDR
138 OID of the `macaddr` type.
139 * INET
140 OID of the `inet` type.
141 * CIDR
142 OID of the `cidr` type.
143 * BOOLARRAY
144 OID of the `boolarray` type.
145 * BYTEAARRAY
146 OID of the `byteaarray` type.
147 * CHARARRAY
148 OID of the `chararray` type.
149 * NAMEARRAY
150 OID of the `namearray` type.
151 * INT2ARRAY
152 OID of the `int2array` type.
153 * INT2VECTORARRAY
154 OID of the `int2vectorarray` type.
155 * INT4ARRAY
156 OID of the `int4array` type.
157 * REGPROCARRAY
158 OID of the `regprocarray` type.
159 * TEXTARRAY
160 OID of the `textarray` type.
161 * OIDARRAY
162 OID of the `oidarray` type.
163 * TIDARRAY
164 OID of the `tidarray` type.
165 * XIDARRAY
166 OID of the `xidarray` type.
167 * CIDARRAY
168 OID of the `cidarray` type.
169 * OIDVECTORARRAY
170 OID of the `oidvectorarray` type.
171 * BPCHARARRAY
172 OID of the `bpchararray` type.
173 * VARCHARARRAY
174 OID of the `varchararray` type.
175 * INT8ARRAY
176 OID of the `int8array` type.
177 * POINTARRAY
178 OID of the `pointarray` type.
179 * LSEGARRAY
180 OID of the `lsegarray` type.
181 * PATHARRAY
182 OID of the `patharray` type.
183 * BOXARRAY
184 OID of the `boxarray` type.
185 * FLOAT4ARRAY
186 OID of the `float4array` type.
187 * FLOAT8ARRAY
188 OID of the `float8array` type.
189 * POLYGONARRAY
190 OID of the `polygonarray` type.
191 * ACLITEM
192 OID of the `aclitem` type.
193 * ACLITEMARRAY
194 OID of the `aclitemarray` type.
195 * MACADDRARRAY
196 OID of the `macaddrarray` type.
197 * INETARRAY
198 OID of the `inetarray` type.
199 * CIDRARRAY
200 OID of the `cidrarray` type.
201 * CSTRINGARRAY
202 OID of the `cstringarray` type.
203 * BPCHAR
204 OID of the `bpchar` type.
205 * VARCHAR
206 OID of the `varchar` type.
207 * DATE
208 OID of the `date` type.
209 * TIME
210 OID of the `time` type.
211 * TIMESTAMP
212 OID of the `timestamp` type.
213 * TIMESTAMPARRAY
214 OID of the `timestamparray` type.
215 * DATEARRAY
216 OID of the `datearray` type.
217 * TIMEARRAY
218 OID of the `timearray` type.
219 * TIMESTAMPTZ
220 OID of the `timestamptz` type.
221 * TIMESTAMPTZARRAY
222 OID of the `timestamptzarray` type.
223 * INTERVAL
224 OID of the `interval` type.
225 * INTERVALARRAY
226 OID of the `intervalarray` type.
227 * NUMERICARRAY
228 OID of the `numericarray` type.
229 * TIMETZ
230 OID of the `timetz` type.
231 * TIMETZARRAY
232 OID of the `timetzarray` type.
233 * BIT
234 OID of the `bit` type.
235 * BITARRAY
236 OID of the `bitarray` type.
237 * VARBIT
238 OID of the `varbit` type.
239 * VARBITARRAY
240 OID of the `varbitarray` type.
241 * NUMERIC
242 OID of the `numeric` type.
243 * REFCURSOR
244 OID of the `refcursor` type.
245 * REFCURSORARRAY
246 OID of the `refcursorarray` type.
247 * REGPROCEDURE
248 OID of the `regprocedure` type.
249 * REGOPER
250 OID of the `regoper` type.
251 * REGOPERATOR
252 OID of the `regoperator` type.
253 * REGCLASS
254 OID of the `regclass` type.
255 * REGTYPE
256 OID of the `regtype` type.
257 * REGPROCEDUREARRAY
258 OID of the `regprocedurearray` type.
259 * REGOPERARRAY
260 OID of the `regoperarray` type.
261 * REGOPERATORARRAY
262 OID of the `regoperatorarray` type.
263 * REGCLASSARRAY
264 OID of the `regclassarray` type.
265 * REGTYPEARRAY
266 OID of the `regtypearray` type.
267 * UUID
268 OID of the `uuid` type.
269 * UUIDARRAY
270 OID of the `uuidarray` type.
271 * TSVECTOR
272 OID of the `tsvector` type.
273 * GTSVECTOR
274 OID of the `gtsvector` type.
275 * TSQUERY
276 OID of the `tsquery` type.
277 * REGCONFIG
278 OID of the `regconfig` type.
279 * REGDICTIONARY
280 OID of the `regdictionary` type.
281 * TSVECTORARRAY
282 OID of the `tsvectorarray` type.
283 * GTSVECTORARRAY
284 OID of the `gtsvectorarray` type.
285 * TSQUERYARRAY
286 OID of the `tsqueryarray` type.
287 * REGCONFIGARRAY
288 OID of the `regconfigarray` type.
289 * REGDICTIONARYARRAY
290 OID of the `regdictionaryarray` type.
291 * TXID_SNAPSHOT
292 OID of the `txid_snapshot` type.
293 * TXID_SNAPSHOTARRAY
294 OID of the `txid_snapshotarray` type.
295 * INT4RANGE
296 OID of the `int4range` type.
297 * INT4RANGEARRAY
298 OID of the `int4rangearray` type.
299 * NUMRANGE
300 OID of the `numrange` type.
301 * NUMRANGEARRAY
302 OID of the `numrangearray` type.
303 * TSRANGE
304 OID of the `tsrange` type.
305 * TSRANGEARRAY
306 OID of the `tsrangearray` type.
307 * TSTZRANGE
308 OID of the `tstzrange` type.
309 * TSTZRANGEARRAY
310 OID of the `tstzrangearray` type.
311 * DATERANGE
312 OID of the `daterange` type.
313 * DATERANGEARRAY
314 OID of the `daterangearray` type.
315 * INT8RANGE
316 OID of the `int8range` type.
317 * INT8RANGEARRAY
318 OID of the `int8rangearray` type.
319 * RECORD
320 OID of the `record` type.
321 * CSTRING
322 OID of the `cstring` type.
323 * ANY
324 OID of the `any` type.
325 * ANYARRAY
326 OID of the `anyarray` type.
327 * VOID
328 OID of the `void` type.
329 * TRIGGER
330 OID of the `trigger` type.
331 * EVENT_TRIGGER
332 OID of the `event_trigger` type.
333 * LANGUAGE_HANDLER
334 OID of the `language_handler` type.
335 * INTERNAL
336 OID of the `internal` type.
337 * OPAQUE
338 OID of the `opaque` type.
339 * ANYELEMENT
340 OID of the `anyelement` type.
341 * ANYNONARRAY
342 OID of the `anynonarray` type.
343 * ANYENUM
344 OID of the `anyenum` type.
345 * FDW_HANDLER
346 OID of the `fdw_handler` type.
347 * ANYRANGE
348 OID of the `anyrange` type.
349
350 ## Properties:
351
352 * public (readonly) pq\Connection $connection
353 The connection which was used to obtain type information.