parse
<<foo>>
DECLARE
  var1 integer := 30;
BEGIN
END
----
<<foo>>
DECLARE
var1 INT8 := 30;
BEGIN
END foo;
 -- normalized!
<<foo>>
DECLARE
var1 INT8 := (30);
BEGIN
END foo;
 -- fully parenthesized
<<foo>>
DECLARE
var1 INT8 := _;
BEGIN
END foo;
 -- literals removed
<<_>>
DECLARE
_ INT8 := 30;
BEGIN
END _;
 -- identifiers removed

parse
<<foo>>
DECLARE
  var1 CONSTANT INTEGER COLLATE collation_name NOT NULL := 30;
BEGIN
END foo
----
<<foo>>
DECLARE
var1 CONSTANT INT8 COLLATE collation_name NOT NULL := 30;
BEGIN
END foo;
 -- normalized!
<<foo>>
DECLARE
var1 CONSTANT INT8 COLLATE collation_name NOT NULL := (30);
BEGIN
END foo;
 -- fully parenthesized
<<foo>>
DECLARE
var1 CONSTANT INT8 COLLATE collation_name NOT NULL := _;
BEGIN
END foo;
 -- literals removed
<<_>>
DECLARE
_ CONSTANT INT8 COLLATE _ NOT NULL := 30;
BEGIN
END _;
 -- identifiers removed

parse
DECLARE
  var1 CONSTANT INTEGER COLLATE collation_name NOT NULL DEFAULT 30;
BEGIN
END
----
DECLARE
var1 CONSTANT INT8 COLLATE collation_name NOT NULL := 30;
BEGIN
END;
 -- normalized!
DECLARE
var1 CONSTANT INT8 COLLATE collation_name NOT NULL := (30);
BEGIN
END;
 -- fully parenthesized
DECLARE
var1 CONSTANT INT8 COLLATE collation_name NOT NULL := _;
BEGIN
END;
 -- literals removed
DECLARE
_ CONSTANT INT8 COLLATE _ NOT NULL := 30;
BEGIN
END;
 -- identifiers removed

parse
DECLARE
  "%_2jd9$f foo" integer := 30;
BEGIN
END
----
DECLARE
"%_2jd9$f foo" INT8 := 30;
BEGIN
END;
 -- normalized!
DECLARE
"%_2jd9$f foo" INT8 := (30);
BEGIN
END;
 -- fully parenthesized
DECLARE
"%_2jd9$f foo" INT8 := _;
BEGIN
END;
 -- literals removed
DECLARE
_ INT8 := 30;
BEGIN
END;
 -- identifiers removed

error
DECLARE
  var1 integer := 30;
  var2 ALIAS FOR quantity;
BEGIN
END
----
----
at or near ";": syntax error: unimplemented: this syntax
DETAIL: source SQL:
DECLARE
  var1 integer := 30;
  var2 ALIAS FOR quantity;
                         ^
HINT: You have attempted to use a feature that is not yet implemented.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.
----
----

parse
DECLARE
  var1 CURSOR FOR SELECT * FROM t1 WHERE id = arg1;
BEGIN
END
----
DECLARE
var1 CURSOR FOR SELECT * FROM t1 WHERE id = arg1;
BEGIN
END;
 -- normalized!
DECLARE
var1 CURSOR FOR SELECT (*) FROM t1 WHERE ((id) = (arg1));
BEGIN
END;
 -- fully parenthesized
DECLARE
var1 CURSOR FOR SELECT * FROM t1 WHERE id = arg1;
BEGIN
END;
 -- literals removed
DECLARE
_ CURSOR FOR SELECT * FROM _ WHERE _ = _;
BEGIN
END;
 -- identifiers removed

error
DECLARE
  var1 NO SCROLL CURSOR (arg1 INTEGER) FOR SELECT * FROM t1 WHERE id = arg1;
BEGIN
END
----
----
at or near "(": syntax error: unimplemented: this syntax
DETAIL: source SQL:
DECLARE
  var1 NO SCROLL CURSOR (arg1 INTEGER) FOR SELECT * FROM t1 WHERE id = arg1;
                        ^
HINT: You have attempted to use a feature that is not yet implemented.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.
----
----

# Correctly handle parsing errors for variable types.
error
DECLARE
  var1 one.two.three.four;
BEGIN
END
----
at or near "four": syntax error: unable to parse type of variable declaration
DETAIL: source SQL:
DECLARE
  var1 one.two.three.four;
                     ^

error
DECLARE
  var1 one.two.three.four := 0;
BEGIN
END
----
at or near "four": syntax error: unable to parse type of variable declaration
DETAIL: source SQL:
DECLARE
  var1 one.two.three.four := 0;
                     ^

error
DECLARE
  var1 1;
BEGIN
END
----
at or near "1": syntax error: unable to parse type of variable declaration
DETAIL: source SQL:
DECLARE
  var1 1;
       ^

error
DECLARE
  var1 'foo';
BEGIN
END
----
at or near "foo": syntax error: unable to parse type of variable declaration
DETAIL: source SQL:
DECLARE
  var1 'foo';
       ^

error
DECLARE
  var1 xy%ROWTYPE;
BEGIN
END
----
at or near "rowtype": syntax error: unable to parse type of variable declaration
DETAIL: source SQL:
DECLARE
  var1 xy%ROWTYPE;
          ^
HINT: you may have attempted to use %TYPE or %ROWTYPE syntax, which is unsupported.
--
See: https://go.crdb.dev/issue-v/114676/

error
DECLARE
  var1 INT;
  var2 var1%TYPE;
BEGIN
END
----
at or near "type": syntax error: unable to parse type of variable declaration
DETAIL: source SQL:
DECLARE
  var1 INT;
  var2 var1%TYPE;
            ^
HINT: you may have attempted to use %TYPE or %ROWTYPE syntax, which is unsupported.
--
See: https://go.crdb.dev/issue-v/114676/
