updating elements of an array which is part of a composite type?

Поиск
Список
Период
Сортировка
Искать

updating elements of an array which is part of a composite type?

От:
"Celia McInnis" <celia@drmath.ca>
Дата:
How do I update the elements of an array when the array is part of a 
composite type?

If I type:

  update mytable set (mytype).myarray[1]='whatever' where ...;

I get :

ERROR: syntax error at or near "(" at character ...

indicating that the first bracket is not acceptable.

I have no trouble selecting via:

   select (mytype).myarray[1] from mytable;

Thanks for any help.
Celia McInnis

Re: updating elements of an array which is part of a composite type?

От:
Michael Fuhr <mike@fuhr.org>
Дата:
On Wed, Jun 01, 2005 at 09:54:38AM -0500, Celia McInnis wrote:
>
> How do I update the elements of an array when the array is part of a 
> composite type?
> 
> If I type:
> 
>   update mytable set (mytype).myarray[1]='whatever' where ...;
> 
> I get :
> 
> ERROR: syntax error at or near "(" at character ...

Remove the parentheses:

UPDATE mytable SET mytype.myarray[1] = 'whatever' WHERE ...;

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/
FAQ