"Jan Peters" <petersjan@gmx.at> writes:
>> Seems like using EXECUTE is the hardest possible way to do this. Why
>> don't you just SELECT?
>>
>> SELECT id FROM precip_arrays WHERE b = precip_control INTO id_result;
> How should the code look like to do this?
Uh ... just like that.
> SELECT precip_control FROM precip_arrays WHERE id = 400; --returns an array
> SELECT id FROM precip_arrays WHERE [THE RETURNED ARRAY] = precip_scenario;--compares the above array to the arrays in
colum"precip_scenario".
Sure, SELECT precip_control INTO some_local_array_variable FROM ...
and then use the variable in the next command.
> This obviously does NOT work:
> SELECT id FROM precip_arrays WHERE (SELECT precip_control FROM precip_arrays WHERE id = 400;) = precip_control;
Well, it would if you got rid of the first semicolon, although most
people would prefer to write this as a join.
regards, tom lane