select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 6.4
Historical version. PostgreSQL 6.4 reached end of support in October 2003. See the current manual for supported releases.

Query Targets

Target Evaluation

  1. Check for an exact match with the target.

  2. Try to coerce the expression directly to the target type if necessary.

  3. If the target is a fixed-length type (e.g. char or varchar declared with a length) then try to find a sizing function of the same name as the type taking two arguments, the first the type name and the second an integer length.

Examples

varchar Storage

For a target column declared as varchar(4) the following query ensures that the target is sized correctly:

tgl=> CREATE TABLE vv (v varchar(4));
CREATE
tgl=> INSERT INTO vv SELECT 'abc' || 'def';
INSERT 392905 1
tgl=> select * from vv;
v
----
abcd
(1 row)

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.