(update: scroll down for a workaround)


Here's the simple V17 reproducible; the database is empty, and there is no "other connection".

-- V17
SELECT @@VERSION;
CREATE SEQUENCE s;
MESSAGE STRING ( 's.nextval = ', s.nextval ) TO CONSOLE;
DROP SEQUENCE s;
SELECT '...done' AS status;

@@VERSION
'17.0.9.4882'

s.nextval = 1

Could not execute statement.
Sequence 's' in use by another connection
SQLCODE=-1366, ODBC 3 State="40001"
Line 5, column 1
You can continue executing or stop.
DROP SEQUENCE s

status
'...done'


The exact same code works in V16.

-- V16
SELECT @@VERSION;
CREATE SEQUENCE s
MESSAGE STRING ( 's.nextval = ', s.nextval ) TO CONSOLE;
DROP SEQUENCE s;
SELECT '...done' AS status;

@@VERSION
'16.0.0.2512'

s.nextval = 1

status
'...done'

Easy Workaround: Don't call s.nextval in a MESSAGE statement. ...which is easy in the real world, because calling nextval in a MESSAGE statement makes no sense :) It's a benign error, but... even benign errors can be canaries in the mineshaft; i.e., hargingers of doom :)
-- V17
-- Workaround: Don't call s.nextval in MESSAGE statement.
BEGIN
SELECT @@VERSION;
CREATE SEQUENCE s;
DECLARE @diagnostic LONG VARCHAR;
SELECT STRING ( 's.nextval = ', s.nextval ) INTO @diagnostic;
MESSAGE STRING ( @diagnostic ) TO CONSOLE;
DROP SEQUENCE s;
SELECT '...done' AS status;
END;

@@VERSION
'17.0.9.4882'

s.nextval = 1

status
'...done'

asked 04 Jul '19, 08:16

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%

edited 04 Jul '19, 08:55

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×6

question asked: 04 Jul '19, 08:16

question was seen: 650 times

last updated: 04 Jul '19, 08:55