~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/catalog-pg-cast.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>pg_cast</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.1beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="System Catalogs"
 
16
HREF="catalogs.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="pg_auth_members"
 
19
HREF="catalog-pg-auth-members.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="pg_class"
 
22
HREF="catalog-pg-class.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2011-04-27T21:20:33"></HEAD
 
30
><BODY
 
31
CLASS="SECT1"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.1beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="pg_auth_members"
 
57
HREF="catalog-pg-auth-members.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
TITLE="System Catalogs"
 
67
HREF="catalogs.html"
 
68
>Fast Backward</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
>Chapter 45. System Catalogs</TD
 
75
><TD
 
76
WIDTH="10%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="System Catalogs"
 
81
HREF="catalogs.html"
 
82
>Fast Forward</A
 
83
></TD
 
84
><TD
 
85
WIDTH="10%"
 
86
ALIGN="right"
 
87
VALIGN="top"
 
88
><A
 
89
TITLE="pg_class"
 
90
HREF="catalog-pg-class.html"
 
91
ACCESSKEY="N"
 
92
>Next</A
 
93
></TD
 
94
></TR
 
95
></TABLE
 
96
><HR
 
97
ALIGN="LEFT"
 
98
WIDTH="100%"></DIV
 
99
><DIV
 
100
CLASS="SECT1"
 
101
><H1
 
102
CLASS="SECT1"
 
103
><A
 
104
NAME="CATALOG-PG-CAST"
 
105
>45.10. <TT
 
106
CLASS="STRUCTNAME"
 
107
>pg_cast</TT
 
108
></A
 
109
></H1
 
110
><P
 
111
>   The catalog <TT
 
112
CLASS="STRUCTNAME"
 
113
>pg_cast</TT
 
114
> stores data type conversion
 
115
   paths, both built-in paths and those defined with
 
116
   <A
 
117
HREF="sql-createcast.html"
 
118
>CREATE CAST</A
 
119
>.
 
120
  </P
 
121
><P
 
122
>   It should be noted that <TT
 
123
CLASS="STRUCTNAME"
 
124
>pg_cast</TT
 
125
> does not represent
 
126
   every type conversion that the system knows how to perform; only those that
 
127
   cannot be deduced from some generic rule.  For example, casting between a
 
128
   domain and its base type is not explicitly represented in
 
129
   <TT
 
130
CLASS="STRUCTNAME"
 
131
>pg_cast</TT
 
132
>.  Another important exception is that
 
133
   <SPAN
 
134
CLASS="QUOTE"
 
135
>"automatic I/O conversion casts"</SPAN
 
136
>, those performed using a data
 
137
   type's own I/O functions to convert to or from <TT
 
138
CLASS="TYPE"
 
139
>text</TT
 
140
> or other
 
141
   string types, are not explicitly represented in
 
142
   <TT
 
143
CLASS="STRUCTNAME"
 
144
>pg_cast</TT
 
145
>.
 
146
  </P
 
147
><DIV
 
148
CLASS="TABLE"
 
149
><A
 
150
NAME="AEN85217"
 
151
></A
 
152
><P
 
153
><B
 
154
>Table 45-10. <TT
 
155
CLASS="STRUCTNAME"
 
156
>pg_cast</TT
 
157
> Columns</B
 
158
></P
 
159
><TABLE
 
160
BORDER="1"
 
161
CLASS="CALSTABLE"
 
162
><COL><COL><COL><COL><THEAD
 
163
><TR
 
164
><TH
 
165
>Name</TH
 
166
><TH
 
167
>Type</TH
 
168
><TH
 
169
>References</TH
 
170
><TH
 
171
>Description</TH
 
172
></TR
 
173
></THEAD
 
174
><TBODY
 
175
><TR
 
176
><TD
 
177
><TT
 
178
CLASS="STRUCTFIELD"
 
179
>castsource</TT
 
180
></TD
 
181
><TD
 
182
><TT
 
183
CLASS="TYPE"
 
184
>oid</TT
 
185
></TD
 
186
><TD
 
187
><TT
 
188
CLASS="LITERAL"
 
189
><A
 
190
HREF="catalog-pg-type.html"
 
191
><TT
 
192
CLASS="STRUCTNAME"
 
193
>pg_type</TT
 
194
></A
 
195
>.oid</TT
 
196
></TD
 
197
><TD
 
198
>OID of the source data type</TD
 
199
></TR
 
200
><TR
 
201
><TD
 
202
><TT
 
203
CLASS="STRUCTFIELD"
 
204
>casttarget</TT
 
205
></TD
 
206
><TD
 
207
><TT
 
208
CLASS="TYPE"
 
209
>oid</TT
 
210
></TD
 
211
><TD
 
212
><TT
 
213
CLASS="LITERAL"
 
214
><A
 
215
HREF="catalog-pg-type.html"
 
216
><TT
 
217
CLASS="STRUCTNAME"
 
218
>pg_type</TT
 
219
></A
 
220
>.oid</TT
 
221
></TD
 
222
><TD
 
223
>OID of the target data type</TD
 
224
></TR
 
225
><TR
 
226
><TD
 
227
><TT
 
228
CLASS="STRUCTFIELD"
 
229
>castfunc</TT
 
230
></TD
 
231
><TD
 
232
><TT
 
233
CLASS="TYPE"
 
234
>oid</TT
 
235
></TD
 
236
><TD
 
237
><TT
 
238
CLASS="LITERAL"
 
239
><A
 
240
HREF="catalog-pg-proc.html"
 
241
><TT
 
242
CLASS="STRUCTNAME"
 
243
>pg_proc</TT
 
244
></A
 
245
>.oid</TT
 
246
></TD
 
247
><TD
 
248
>       The OID of the function to use to perform this cast.  Zero is
 
249
       stored if the cast method doesn't require a function.
 
250
      </TD
 
251
></TR
 
252
><TR
 
253
><TD
 
254
><TT
 
255
CLASS="STRUCTFIELD"
 
256
>castcontext</TT
 
257
></TD
 
258
><TD
 
259
><TT
 
260
CLASS="TYPE"
 
261
>char</TT
 
262
></TD
 
263
><TD
 
264
>&nbsp;</TD
 
265
><TD
 
266
>       Indicates what contexts the cast can be invoked in.
 
267
       <TT
 
268
CLASS="LITERAL"
 
269
>e</TT
 
270
> means only as an explicit cast (using
 
271
       <TT
 
272
CLASS="LITERAL"
 
273
>CAST</TT
 
274
> or <TT
 
275
CLASS="LITERAL"
 
276
>::</TT
 
277
> syntax).
 
278
       <TT
 
279
CLASS="LITERAL"
 
280
>a</TT
 
281
> means implicitly in assignment
 
282
       to a target column, as well as explicitly.
 
283
       <TT
 
284
CLASS="LITERAL"
 
285
>i</TT
 
286
> means implicitly in expressions, as well as the
 
287
       other cases.
 
288
      </TD
 
289
></TR
 
290
><TR
 
291
><TD
 
292
><TT
 
293
CLASS="STRUCTFIELD"
 
294
>castmethod</TT
 
295
></TD
 
296
><TD
 
297
><TT
 
298
CLASS="TYPE"
 
299
>char</TT
 
300
></TD
 
301
><TD
 
302
>&nbsp;</TD
 
303
><TD
 
304
>       Indicates how the cast is performed.
 
305
       <TT
 
306
CLASS="LITERAL"
 
307
>f</TT
 
308
> means that the function specified in the <TT
 
309
CLASS="STRUCTFIELD"
 
310
>castfunc</TT
 
311
> field is used.
 
312
       <TT
 
313
CLASS="LITERAL"
 
314
>i</TT
 
315
> means that the input/output functions are used.
 
316
       <TT
 
317
CLASS="LITERAL"
 
318
>b</TT
 
319
> means that the types are binary-coercible, thus no conversion is required.
 
320
      </TD
 
321
></TR
 
322
></TBODY
 
323
></TABLE
 
324
></DIV
 
325
><P
 
326
>   The cast functions listed in <TT
 
327
CLASS="STRUCTNAME"
 
328
>pg_cast</TT
 
329
> must
 
330
   always take the cast source type as their first argument type, and
 
331
   return the cast destination type as their result type.  A cast
 
332
   function can have up to three arguments.  The second argument,
 
333
   if present, must be type <TT
 
334
CLASS="TYPE"
 
335
>integer</TT
 
336
>; it receives the type
 
337
   modifier associated with the destination type, or -1
 
338
   if there is none.  The third argument,
 
339
   if present, must be type <TT
 
340
CLASS="TYPE"
 
341
>boolean</TT
 
342
>; it receives <TT
 
343
CLASS="LITERAL"
 
344
>true</TT
 
345
>
 
346
   if the cast is an explicit cast, <TT
 
347
CLASS="LITERAL"
 
348
>false</TT
 
349
> otherwise.
 
350
  </P
 
351
><P
 
352
>   It is legitimate to create a <TT
 
353
CLASS="STRUCTNAME"
 
354
>pg_cast</TT
 
355
> entry
 
356
   in which the source and target types are the same, if the associated
 
357
   function takes more than one argument.  Such entries represent
 
358
   <SPAN
 
359
CLASS="QUOTE"
 
360
>"length coercion functions"</SPAN
 
361
> that coerce values of the type
 
362
   to be legal for a particular type modifier value.
 
363
  </P
 
364
><P
 
365
>   When a <TT
 
366
CLASS="STRUCTNAME"
 
367
>pg_cast</TT
 
368
> entry has different source and
 
369
   target types and a function that takes more than one argument, it
 
370
   represents converting from one type to another and applying a length
 
371
   coercion in a single step.  When no such entry is available, coercion
 
372
   to a type that uses a type modifier involves two steps, one to
 
373
   convert between data types and a second to apply the modifier.
 
374
  </P
 
375
></DIV
 
376
><DIV
 
377
CLASS="NAVFOOTER"
 
378
><HR
 
379
ALIGN="LEFT"
 
380
WIDTH="100%"><TABLE
 
381
SUMMARY="Footer navigation table"
 
382
WIDTH="100%"
 
383
BORDER="0"
 
384
CELLPADDING="0"
 
385
CELLSPACING="0"
 
386
><TR
 
387
><TD
 
388
WIDTH="33%"
 
389
ALIGN="left"
 
390
VALIGN="top"
 
391
><A
 
392
HREF="catalog-pg-auth-members.html"
 
393
ACCESSKEY="P"
 
394
>Prev</A
 
395
></TD
 
396
><TD
 
397
WIDTH="34%"
 
398
ALIGN="center"
 
399
VALIGN="top"
 
400
><A
 
401
HREF="index.html"
 
402
ACCESSKEY="H"
 
403
>Home</A
 
404
></TD
 
405
><TD
 
406
WIDTH="33%"
 
407
ALIGN="right"
 
408
VALIGN="top"
 
409
><A
 
410
HREF="catalog-pg-class.html"
 
411
ACCESSKEY="N"
 
412
>Next</A
 
413
></TD
 
414
></TR
 
415
><TR
 
416
><TD
 
417
WIDTH="33%"
 
418
ALIGN="left"
 
419
VALIGN="top"
 
420
><TT
 
421
CLASS="STRUCTNAME"
 
422
>pg_auth_members</TT
 
423
></TD
 
424
><TD
 
425
WIDTH="34%"
 
426
ALIGN="center"
 
427
VALIGN="top"
 
428
><A
 
429
HREF="catalogs.html"
 
430
ACCESSKEY="U"
 
431
>Up</A
 
432
></TD
 
433
><TD
 
434
WIDTH="33%"
 
435
ALIGN="right"
 
436
VALIGN="top"
 
437
><TT
 
438
CLASS="STRUCTNAME"
 
439
>pg_class</TT
 
440
></TD
 
441
></TR
 
442
></TABLE
 
443
></DIV
 
444
></BODY
 
445
></HTML
 
446
>
 
 
b'\\ No newline at end of file'