Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
49.10. pg_cast
Prev UpChapter 49. System CatalogsHome Next

49.10. pg_cast

The catalogpg_cast stores data type conversion paths, both built-in and user-defined.

It should be noted thatpg_cast does not represent every type conversion that the system knows how to perform; only those that cannot be deduced from some generic rule. For example, casting between a domain and its base type is not explicitly represented inpg_cast. Another important exception is thatautomatic I/O conversion casts, those performed using a data type's own I/O functions to convert to or fromtext or other string types, are not explicitly represented inpg_cast.

Table 49.10. pg_cast Columns

NameTypeReferencesDescription
oidoid Row identifier (hidden attribute; must be explicitly selected)
castsourceoidpg_type.oidOID of the source data type
casttargetoidpg_type.oidOID of the target data type
castfuncoidpg_proc.oid The OID of the function to use to perform this cast. Zero is stored if the cast method doesn't require a function.
castcontextchar  Indicates what contexts the cast can be invoked in.e means only as an explicit cast (usingCAST or:: syntax).a means implicitly in assignment to a target column, as well as explicitly.i means implicitly in expressions, as well as the other cases.
castmethodchar  Indicates how the cast is performed.f means that the function specified in thecastfunc field is used.i means that the input/output functions are used.b means that the types are binary-coercible, thus no conversion is required.

The cast functions listed inpg_cast must always take the cast source type as their first argument type, and return the cast destination type as their result type. A cast function can have up to three arguments. The second argument, if present, must be typeinteger; it receives the type modifier associated with the destination type, or -1 if there is none. The third argument, if present, must be typeboolean; it receivestrue if the cast is an explicit cast,false otherwise.

It is legitimate to create apg_cast entry in which the source and target types are the same, if the associated function takes more than one argument. Such entries representlength coercion functions that coerce values of the type to be legal for a particular type modifier value.

When apg_cast entry has different source and target types and a function that takes more than one argument, it represents converting from one type to another and applying a length coercion in a single step. When no such entry is available, coercion to a type that uses a type modifier involves two steps, one to convert between data types and a second to apply the modifier.


Prev Up Next
49.9. pg_auth_members Home 49.11. pg_class
pdfepub
Go to Postgres Pro Standard 9.5
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp