Re: select * from (select * from bob) and other easy stuff
Posted in 2006
internetuser wrote:
> Adam Tauno Williams wrote:
>> I don't know, this always made perfect sense to me. A "serial" data
>> type's serial-ness can't be preserved through a virtual table.
>
> But while a "serial" may be something interesting before the number is
> generated, once a value is actually generated and in the table, isn't
> it in fact just a number, sitting there, ripe for the picking? For
> example - if I do something like:
>
> select myid,myid+50, v1,v2,v3,v4 from bob>
> I might get:
>
> 1,51,I am not impressed,true,true,true
> 50,100,I am still not impressed,true,true,true
>
> The first column is a "serial", but what I see are just numbers. It
> looks like an integer, it smells like an integer, I can add it to other
> integers and get a second column without casting it first. So why
> should I have to cast it when using MULTISET ? I don't get it.
>
> On a related note - what is REALLY stored in the serial column? Is it 1
> and 50, or is it some offset value from some base value, or whatever?
>
>> You can, you just need to cast it.
>> SELECT serial_key, other_value
>> FROM TABLE(MULTISET(SELECT serial_key::INT, other_value FROM booby));>
> Thanks for the tip. I will give this a try.
>
> Cheers!
> -sw
>
Can you give us the bob table schema and exactly what you're trying to do?
It would be better if we could see it, instead of trying stuff that
doesn't work for you...
Regards.