Try this:
var x base relation{z char} key{z};
insert x extend TABLE_DEE : {z := '//'};
I get
ERROR: Encountered "insert" at line 1, column 1.
Was expecting one of:
"BEGIN" ...
"TCLOSE" ...
<TUPLE> ...
"WITH" ...
<TUPLE> ...
I have used a bypass of this kind sometimes:
x := (extend TABLE_DEE : {z := '//'}) union x;
but it doesn't work with this particular example.
The problem seems to arise only with multiple successive slashes in quotes.
Hugh
Spurious sytax error with INSERT
Re: Spurious sytax error with INSERT
I'll do some tests on this to see if I can find a workaround. I know EXTEND can expose a grammar ambiguity (I don't recall the specifics, but I know it does) and this is likely related to it.
Re: Spurious sytax error with INSERT
I see the problem -- it's with the mechanism in the DBrowser front-end that tries to detect whether you've entered an expression or one or more statements. It's surprisingly complex and it can be fooled. In this case, it's being fooled into thinking you've entered an expression by the slashes '//', which it thinks are a comment token and so it ignores the rest of the line.
A simple workaround is to force the front-end to treat your statement(s) as an expression, using a Rel extension for that purpose. You surround the statements with a BEGIN ... END block, followed by an expression. Like this:
A simple workaround is to force the front-end to treat your statement(s) as an expression, using a Rel extension for that purpose. You surround the statements with a BEGIN ... END block, followed by an expression. Like this:
Code: Select all
begin;
var x base relation {z char} key {z};
insert x extend TABLE_DEE : {z := '//'};
end;
true
-
- Posts: 124
- Joined: Sat May 24, 2008 4:49 pm
Re: Spurious sytax error with INSERT
Thank you. I like your suggested bypass because since I posted this problem I've been surrounding the code with begin/end for other reasons. My own bypass had been to use direct assignment: x := (extend TABLE_DEE <etc.>) union x;
Hugh
Hugh