123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- # Copyright 2015 - 2019 The Cockroach Authors. All rights reserved.
- # 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:
- #
- # https://github.com/cockroachdb/cockroach/blob/d2f7fbf5dd1fc1a099bbad790a2e1f7c60a66cc3/pkg/sql/logictest/testdata/logic_test/int_size
- #
- # 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.
- # not supported yet
- halt
- mode cockroach
- subtest defaults
- query T
- SHOW default_int_size
- ----
- 8
- subtest set_int4
- statement ok
- SET default_int_size=4
- query T
- SHOW default_int_size
- ----
- 4
- statement ok
- CREATE TABLE i4 (i4 INT)
- query TT
- SHOW CREATE TABLE i4
- ----
- i4 CREATE TABLE i4 (
- i4 INT4 NULL,
- FAMILY "primary" (i4, rowid)
- )
- subtest set_int8
- statement ok
- SET default_int_size=8
- query T
- SHOW default_int_size
- ----
- 8
- statement ok
- CREATE TABLE i8 (i8 INT)
- query TT
- SHOW CREATE TABLE i8
- ----
- i8 CREATE TABLE i8 (
- i8 INT8 NULL,
- FAMILY "primary" (i8, rowid)
- )
- # https://github.com/cockroachdb/cockroach/issues/32846
- subtest issue_32846
- statement ok
- SET default_int_size=8
- # Parsing and evaluation are async, so the setting won't take
- # effect until the next statement is evaluated.
- statement ok
- SET default_int_size=4; CREATE TABLE late4 (a INT)
- query TT
- SHOW CREATE TABLE late4
- ----
- late4 CREATE TABLE late4 (
- a INT8 NULL,
- FAMILY "primary" (a, rowid)
- )
- query T
- SHOW default_int_size
- ----
- 4
- subtest set_bad_value
- statement error pq: only 4 or 8 are supported by default_int_size
- SET default_int_size=2
- # We want to check the combinations of default_int_size and
- # experimental_serialization_normalization.
- subtest serial_rowid
- # When using rowid, we should always see INT8, since that's the
- # return type of unique_rowid()
- statement ok
- SET default_int_size=4; SET experimental_serial_normalization='rowid';
- statement ok
- CREATE TABLE i4_rowid (a SERIAL)
- query TT
- SHOW CREATE TABLE i4_rowid
- ----
- i4_rowid CREATE TABLE i4_rowid (
- a INT8 NOT NULL DEFAULT unique_rowid(),
- FAMILY "primary" (a, rowid)
- )
- statement ok
- SET default_int_size=8; SET experimental_serial_normalization='rowid';
- statement ok
- CREATE TABLE i8_rowid (a SERIAL)
- query TT
- SHOW CREATE TABLE i8_rowid
- ----
- i8_rowid CREATE TABLE i8_rowid (
- a INT8 NOT NULL DEFAULT unique_rowid(),
- FAMILY "primary" (a, rowid)
- )
- subtest serial_sql_sequence
- # When using rowid, we should see an INTx that matches the current size setting.
- statement ok
- SET default_int_size=4; SET experimental_serial_normalization='sql_sequence';
- statement ok
- CREATE TABLE i4_sql_sequence (a SERIAL)
- query TT
- SHOW CREATE TABLE i4_sql_sequence
- ----
- i4_sql_sequence CREATE TABLE i4_sql_sequence (
- a INT4 NOT NULL DEFAULT nextval('i4_sql_sequence_a_seq':::STRING),
- FAMILY "primary" (a, rowid)
- )
- statement ok
- SET default_int_size=8; SET experimental_serial_normalization='sql_sequence';
- statement ok
- CREATE TABLE i8_sql_sequence (a SERIAL)
- query TT
- SHOW CREATE TABLE i8_sql_sequence
- ----
- i8_sql_sequence CREATE TABLE i8_sql_sequence (
- a INT8 NOT NULL DEFAULT nextval('i8_sql_sequence_a_seq':::STRING),
- FAMILY "primary" (a, rowid)
- )
- subtest serial_virtual_sequence
- # Virtual sequences are a wrapper around unique_rowid(), so they will also
- # return an INT8 value.
- statement ok
- SET default_int_size=4; SET experimental_serial_normalization='virtual_sequence';
- statement ok
- CREATE TABLE i4_virtual_sequence (a SERIAL)
- query TT
- SHOW CREATE TABLE i4_virtual_sequence
- ----
- i4_virtual_sequence CREATE TABLE i4_virtual_sequence (
- a INT8 NOT NULL DEFAULT nextval('i4_virtual_sequence_a_seq':::STRING),
- FAMILY "primary" (a, rowid)
- )
- statement ok
- SET default_int_size=8; SET experimental_serial_normalization='virtual_sequence';
- statement ok
- CREATE TABLE i8_virtual_sequence (a SERIAL)
- query TT
- SHOW CREATE TABLE i8_virtual_sequence
- ----
- i8_virtual_sequence CREATE TABLE i8_virtual_sequence (
- a INT8 NOT NULL DEFAULT nextval('i8_virtual_sequence_a_seq':::STRING),
- FAMILY "primary" (a, rowid)
- )
|