Page 1 of 1

Tutorial D INIT clause still not supported on base relvars

Posted: Tue Sep 23, 2008 4:35 pm
by HughDarwen
Perhaps there should be a special section for discussing Rel vs Tutorial D differences. IWBNI the one mentioned in my subject line were resolved one day!

I mean something like:

VAR S BASE RELATION { S# CHAR, Sname CHAR,
Status INTEGER, City CHAR}
KEY { S# }
INIT ( RELATION {
TUPLE { S# 'S1', Sname 'Smith',
City 'London',
Status 20 }
} ) ;

Hugh

Re: Tutorial D INIT clause still not supported on base relvars

Posted: Tue Sep 23, 2008 8:23 pm
by Dave
The Tutorial D grammar specifies that a <real relation var def> ::= VAR <relation var name> <real or base> <relation type or init value> <candidate key def>.

Therefore, the above should be:

Code: Select all

VAR S BASE RELATION { S# CHAR, Sname CHAR, 
                      Status INTEGER, City CHAR} 
           INIT ( RELATION { 
                    TUPLE { S# 'S1', Sname 'Smith',
                            City 'London', 
                            Status 20 }
                    }  ) 
           KEY { S# } ;
I think you'll find it works. :mrgreen: