| # sequence.iq - Sequences |
| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to you under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| !use seq |
| !set outputformat mysql |
| |
| select next value for "my_seq" as c from (values 1, 2); |
| +---+ |
| | C | |
| +---+ |
| | 1 | |
| | 2 | |
| +---+ |
| (2 rows) |
| |
| !ok |
| select current value for "my_seq" as c from (values 1, 2); |
| +---+ |
| | C | |
| +---+ |
| | 2 | |
| | 2 | |
| +---+ |
| (2 rows) |
| |
| !ok |
| |
| select next value for "my_seq" as c from (values 1, 2); |
| C BIGINT(19) NOT NULL |
| !type |
| |
| # Qualified with schema name |
| select next value for "s"."my_seq" as c from (values 1, 2); |
| C BIGINT(19) NOT NULL |
| !type |
| |
| select next value for "unknown_seq" as c from (values 1, 2); |
| From line 1, column 23 to line 1, column 35: Table 'unknown_seq' not found |
| !error |
| |
| # Qualified with bad schema name |
| select next value for "unknown_schema"."my_seq" as c from (values 1, 2); |
| From line 1, column 23 to line 1, column 47: Table 'unknown_schema.my_seq' not found |
| !error |
| |
| # Table found, but not a sequence |
| select next value for "metadata".tables as c from (values 1, 2); |
| From line 1, column 23 to line 1, column 39: Table 'metadata.TABLES' is not a sequence |
| !error |
| |
| # Sequences appear in the catalog as tables of type 'SEQUENCE' |
| select * from "metadata".tables; |
| +----------+------------+-----------+--------------+---------+---------+-----------+----------+------------------------+---------------+ |
| | tableCat | tableSchem | tableName | tableType | remarks | typeCat | typeSchem | typeName | selfReferencingColName | refGeneration | |
| +----------+------------+-----------+--------------+---------+---------+-----------+----------+------------------------+---------------+ |
| | | metadata | COLUMNS | SYSTEM TABLE | | | | | | | |
| | | metadata | TABLES | SYSTEM TABLE | | | | | | | |
| | | s | my_seq | SEQUENCE | | | | | | | |
| +----------+------------+-----------+--------------+---------+---------+-----------+----------+------------------------+---------------+ |
| (3 rows) |
| |
| !ok |
| |
| # End sequence.iq |