[SQL] Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause

2010-10-29 Thread Axel Rau
Good morning, I have a function argument blah of type text containing something like 33,44,55,66 . Can I cast it in some way to use it in an IN clause as integers like UPDATE foo SET x = y WHERE id IN ( blah ); or need I revert to dynamic SQL (EXECUTE...) ? Thanks, Axel --- axel@chao

Re: [SQL] [GENERAL] How to update multiple rows

2010-10-29 Thread Alban Hertroys
On 26 Oct 2010, at 9:07, venkat wrote: > Dear All, > > I want to update multiple row in single query.I am trying for below query.I > am getting error as > > "ERROR: more than one row returned by a subquery used as an expression > SQL state: 21000" You're probably looking for UPDATE table F

Re: [SQL] [GENERAL] How to update multiple rows

2010-10-29 Thread Dann Corbit
If you do not understand what you are doing, it might be a good idea to find someone in your organization who understands SQL. You were given the suggestion UPDATE SET FROM ... which is documented here: http://www.postgresql.org/docs/9.0/interactive/sql-update.html In the end, your query should

Re: [SQL] Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause

2010-10-29 Thread Dmitriy Igrishin
Hey Axel, How about this solution: UPDATE foo SET x = y WHERE ANY(string_to_array(blah, ',')) = id; ? 2010/10/25 Axel Rau > Good morning, > > I have a function argument blah of type text containing something like >33,44,55,66 > . Can I cast it in some way to use it in an IN clause as intege

Re: [SQL] Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause

2010-10-29 Thread Dmitriy Igrishin
Ooops, sorry UPDATE foo SET x = y WHERE id = ANY(string_to_array(blah, ',')::integer[]); 2010/10/29 Dmitriy Igrishin > Hey Axel, > > How about this solution: > UPDATE foo SET x = y WHERE ANY(string_to_array(blah, ',')) = id; > ? > > 2010/10/25 Axel Rau > > Good morning, >> >> I have a function

[SQL] Re: resolved: WITH RECURSIVE: ARRAY[id] All column datatypes must be hashable

2010-10-29 Thread Will Furnass
>> rawi writes: > The Error was caused because I used UNION in place of UNION ALL. > > I still don't understand why the ARRAY (path) could not be grouped... Yeah, it's an unimplemented feature --- there's no hashing support for arrays. I hope to get that done for 8.5. In the meantime you have