Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
11.2.2
-
None
Description
I'm trying to reset my sequences using the `ALTER SEQUENCE` that says it's supported.
But I'm getting an error trying to restart my sequences using the `MAX(id) + 1` value of the table the sequence is for.
According to the help for MariaDB it looks like it should be supported, but I'm getting a syntax error.
ALTER SEQUENCE Help - https://mariadb.com/kb/en/alter-sequence/
Any help is appreciated..
MariaDB [bcfactory]> select * from job_SEQ;
|
+-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+
|
| next_not_cached_value | minimum_value | maximum_value | start_value | increment | cache_size | cycle_option | cycle_count |
|
+-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+
|
| 1 | 1 | 9223372036854775806 | 1 | 50 | 1000 | 0 | 0 |
|
+-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [bcfactory]> alter sequence job_SEQ RESTART WITH (select MAX(id) + 1 from job);
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select MAX(id) + 1 from job)' at line 1
|
MariaDB [bcfactory]> select version();
|
+---------------------------------------+
|
| version() |
|
+---------------------------------------+
|
| 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 |
|
+---------------------------------------+
|
1 row in set (0.000 sec)
|
```
|
Attachments
Issue Links
- relates to
-
MDEV-20111 (CREATE|ALTER) SEQUENCE / SETVAL: only integer literal accepted as parameter
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
I'm trying to reset my sequences using the `ALTER SEQUENCE` that says it's supported.
But I'm getting an error trying to restart my sequences using the `MAX(id) + 1` value of the table the sequence is for. According to the help for MariaDB it looks like it *should* be supported, but I'm getting a syntax error. Any help is appreciated.. ``` MariaDB [bcfactory]> select * from job_SEQ; +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | next_not_cached_value | minimum_value | maximum_value | start_value | increment | cache_size | cycle_option | cycle_count | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | 1 | 1 | 9223372036854775806 | 1 | 50 | 1000 | 0 | 0 | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ 1 row in set (0.000 sec) MariaDB [bcfactory]> alter sequence job_SEQ RESTART WITH (select MAX(id) + 1 from job); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select MAX(id) + 1 from job)' at line 1 MariaDB [bcfactory]> select version(); +---------------------------------------+ | version() | +---------------------------------------+ | 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 | +---------------------------------------+ 1 row in set (0.000 sec) ``` |
I'm trying to reset my sequences using the `ALTER SEQUENCE` that says it's supported.
But I'm getting an error trying to restart my sequences using the `MAX(id) + 1` value of the table the sequence is for. According to the help for MariaDB it looks like it *should* be supported, but I'm getting a syntax error. ALTER SEQUENCE Help - https://mariadb.com/kb/en/alter-sequence/ Any help is appreciated.. ``` MariaDB [bcfactory]> select * from job_SEQ; +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | next_not_cached_value | minimum_value | maximum_value | start_value | increment | cache_size | cycle_option | cycle_count | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | 1 | 1 | 9223372036854775806 | 1 | 50 | 1000 | 0 | 0 | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ 1 row in set (0.000 sec) MariaDB [bcfactory]> alter sequence job_SEQ RESTART WITH (select MAX(id) + 1 from job); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select MAX(id) + 1 from job)' at line 1 MariaDB [bcfactory]> select version(); +---------------------------------------+ | version() | +---------------------------------------+ | 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 | +---------------------------------------+ 1 row in set (0.000 sec) ``` |
Description |
I'm trying to reset my sequences using the `ALTER SEQUENCE` that says it's supported.
But I'm getting an error trying to restart my sequences using the `MAX(id) + 1` value of the table the sequence is for. According to the help for MariaDB it looks like it *should* be supported, but I'm getting a syntax error. ALTER SEQUENCE Help - https://mariadb.com/kb/en/alter-sequence/ Any help is appreciated.. ``` MariaDB [bcfactory]> select * from job_SEQ; +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | next_not_cached_value | minimum_value | maximum_value | start_value | increment | cache_size | cycle_option | cycle_count | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | 1 | 1 | 9223372036854775806 | 1 | 50 | 1000 | 0 | 0 | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ 1 row in set (0.000 sec) MariaDB [bcfactory]> alter sequence job_SEQ RESTART WITH (select MAX(id) + 1 from job); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select MAX(id) + 1 from job)' at line 1 MariaDB [bcfactory]> select version(); +---------------------------------------+ | version() | +---------------------------------------+ | 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 | +---------------------------------------+ 1 row in set (0.000 sec) ``` |
I'm trying to reset my sequences using the `ALTER SEQUENCE` that says it's supported.
But I'm getting an error trying to restart my sequences using the `MAX(id) + 1` value of the table the sequence is for. According to the help for MariaDB it looks like it *should* be supported, but I'm getting a syntax error. ALTER SEQUENCE Help - https://mariadb.com/kb/en/alter-sequence/ Any help is appreciated.. {noformat} MariaDB [bcfactory]> select * from job_SEQ; +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | next_not_cached_value | minimum_value | maximum_value | start_value | increment | cache_size | cycle_option | cycle_count | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ | 1 | 1 | 9223372036854775806 | 1 | 50 | 1000 | 0 | 0 | +-----------------------+---------------+---------------------+-------------+-----------+------------+--------------+-------------+ 1 row in set (0.000 sec) MariaDB [bcfactory]> alter sequence job_SEQ RESTART WITH (select MAX(id) + 1 from job); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select MAX(id) + 1 from job)' at line 1 MariaDB [bcfactory]> select version(); +---------------------------------------+ | version() | +---------------------------------------+ | 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 | +---------------------------------------+ 1 row in set (0.000 sec) ``` {noformat} |
Link |
This issue relates to |
Component/s | Sequences [ 14009 ] | |
Fix Version/s | N/A [ 14700 ] | |
Resolution | Not a Bug [ 6 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |