Specifying data type of columns in a values subquery

后端 未结 1 557
刺人心
刺人心 2021-01-19 14:48

Is there a way to specify the data types of the columns in a values subquery? Something like (values (...)) as tmp_name (colname::type)?

C

1条回答
  •  暖寄归人
    2021-01-19 14:59

    You can cast once on the join predicate:

    select foo.id from foo 
    inner join (values 
        ('aaaabbbbccccffffddeeeeffff00001111'),
        ('aaaabbbbccccffffddeeeeffff00000000'))
    as tmp (id) on foo.id = tmp.id::uuid;
    

    0 讨论(0)
提交回复
热议问题