2016-06-21 03:06:44 -05:00
|
|
|
.. _cast_dialog:
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2018-06-15 03:14:12 -05:00
|
|
|
********************
|
|
|
|
`Cast Dialog`:index:
|
|
|
|
********************
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Use the *Cast* dialog to define a cast. A cast specifies how to convert a value
|
|
|
|
from one data type to another.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
The *Cast* dialog organizes the development of a cast through the following
|
|
|
|
dialog tabs: *General* and *Definition*. The *SQL* tab displays the SQL code
|
|
|
|
generated by dialog selections.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2016-05-20 15:39:21 -05:00
|
|
|
.. image:: images/cast_general.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Cast dialog general tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Use the fields in the *General* tab to identify the cast:
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
* The *Name* field is disabled. The name that will be displayed in the
|
|
|
|
*pgAdmin* tree control is the *Source* type concatenated with the *Target*
|
|
|
|
type, and is generated automatically when you make selections on the *Cast*
|
|
|
|
dialog *Definition* tab.
|
2016-05-24 07:47:35 -05:00
|
|
|
* Store notes about the cast in the *Comment* field.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Click the *Definition* tab to continue.
|
|
|
|
|
2016-05-20 15:39:21 -05:00
|
|
|
.. image:: images/cast_definition.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Cast dialog definition tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Use the fields in the *Definition* tab to define parameters:
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
* Use the drop-down listbox next to *Source type* to select the name of the
|
|
|
|
source data type of the cast.
|
|
|
|
* Use the drop-down listbox next to *Target type* to select the name of the
|
|
|
|
target data type of the cast.
|
|
|
|
* Use the drop-down listbox next to *Function* to select the function used to
|
|
|
|
perform the cast. The function's result data type must match the target type
|
|
|
|
of the cast.
|
2021-09-24 10:31:56 -05:00
|
|
|
* Select *Context* toggle to *Implicit* if the cast is implicit.
|
2019-03-08 09:29:05 -06:00
|
|
|
By default, a cast can be invoked only by an explicit cast request. If the
|
|
|
|
cast is marked *Implicit* then it can be invoked implicitly in any context,
|
|
|
|
whether by assignment or internally in an expression.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Click the *SQL* tab to continue.
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Your entries in the *Cast* dialog generate a SQL command (see an example below).
|
|
|
|
Use the *SQL* tab for review; revisit or switch tabs to make any changes to the
|
|
|
|
SQL command.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2016-05-24 07:47:35 -05:00
|
|
|
**Example**
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
The following is an example of the sql command generated by user selections in
|
|
|
|
the *Cast* dialog:
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2016-05-24 07:47:35 -05:00
|
|
|
.. image:: images/cast_sql.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Cast dialog sql tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
* Click the *Info* button (i) to access online help.
|
2016-05-24 07:47:35 -05:00
|
|
|
* Click the *Save* button to save work.
|
2021-09-24 10:31:56 -05:00
|
|
|
* Click the *Close* button to exit without saving work.
|
|
|
|
* Click the *Reset* button to restore configuration parameters.
|