Tutorial D INIT clause still not supported on base relvars

This forum is for anything about Rel that isn't more appropriate elsewhere.
Post Reply
HughDarwen
Posts: 124
Joined: Sat May 24, 2008 4:49 pm

Tutorial D INIT clause still not supported on base relvars

Post 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
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

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

Post 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:
Post Reply