123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- #
- # This file is derived from the logic test suite in CockroachDB. The
- # original file was retrieved on June 10, 2019 from:
- #
- # The original source code is subject to the terms of the Apache
- # 2.0 license, a copy of which can be found in the LICENSE file at the
- # root of this repository.
- query error could not determine data type of parameter \$1
- SELECT pg_typeof($1)
- query T
- SELECT pg_typeof('1')
- ----
- unknown
- query T
- SELECT pg_typeof(text '1')
- ----
- text
- query T
- SELECT pg_typeof(1)
- ----
- integer
- query T
- SELECT pg_typeof(1.0)
- ----
- numeric
- # Custom types
- statement ok
- CREATE TYPE int4_list AS LIST (ELEMENT TYPE = int4)
- statement ok
- CREATE TYPE int4_list_list AS LIST (ELEMENT TYPE = int4_list)
- statement ok
- CREATE TYPE composite AS (a int, b text, c float8);
- query T
- SELECT pg_typeof('{1}'::int4 list)
- ----
- integer list
- query T
- SELECT pg_typeof('{1}'::int4_list)
- ----
- int4_list
- query T
- SELECT pg_typeof('{{1}}'::int4 list list)
- ----
- integer list list
- query T
- SELECT pg_typeof('{{1}}'::int4_list_list)
- ----
- int4_list_list
- query T
- SELECT pg_typeof('{{1}}'::int4_list list)
- ----
- int4_list list
- query T
- SELECT pg_typeof((1,'abc',2.0)::composite);
- ----
- composite
- statement ok
- CREATE SCHEMA other;
- statement ok
- CREATE TYPE other.composite AS (a text, b text, c float8);
- query T
- SELECT pg_typeof(ROW('1', '2', 2.0)::composite)
- ----
- composite
- query T
- SELECT pg_typeof(ROW('1', '2', 2.0)::other.composite)
- ----
- other.composite
- query T
- SELECT pg_typeof(ARRAY[1::uint2])
- ----
- uint2[]
- query T
- SELECT pg_typeof(ARRAY[1::uint4])
- ----
- uint4[]
- query T
- SELECT pg_typeof(ARRAY[1::uint8])
- ----
- uint8[]
- query T
- SELECT pg_typeof(ARRAY[1::mz_timestamp])
- ----
- mz_timestamp[]
- query T
- SELECT pg_typeof(ARRAY[mz_internal.make_mz_aclitem('u1', 'u2', 'CREATE')])
- ----
- mz_aclitem[]
|