[Ur] Subqueries.

Adam Chlipala adamc at impredicative.com
Tue Feb 28 08:40:10 EST 2012


Alexei Golovko wrote:
> This seems to require also to optionify columns:
>    
>> table t : { X : option int, Y : option int }
>> table s : { X : int, Y : int, Z : int }
>> val test = dml (INSERT INTO t (X, Y) VALUES
>>      ( (SELECT (s.X) FROM s WHERE s.Z = 1),
>>      (SELECT (s.Y) FROM s WHERE s.Z = 1) )
>> )
>>      
> Is it possible to use similar query with
>    
>> table t' : { X : int, Y :  int }
>>      
> (let it abort transaction instead inserting NULL)?
>    

No, that isn't currently supported in the precise way you describe, but 
you have 'COALESCE' available as usual in SQL.



More information about the Ur mailing list