targetted array element modification or delete without knowing the index?

Поиск
Список
Период
Сортировка
От Gauthier, Dave
Тема targetted array element modification or delete without knowing the index?
Дата
Msg-id 482E80323A35A54498B8B70FF2B879800438374E8C@azsmsx504.amr.corp.intel.com
обсуждение исходный текст
Ответы Re: targetted array element modification or delete without knowing the index?  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-general

Is there a way to modify or delete an element of an array with knowledge only of the element’s value?  Maybe an array index finder would help?

 

For example

 

create table foo (name,text, arr text[]);

insert into foo (name,arr) values (‘joe’,ARRAY[‘a’,’b’,’c’]);

 

 

update foo set arr[indexfinder(‘b’)] = ‘z’;

 

This would update arr[2], because that’s the element with value ‘b’

 

Thanks !

В списке pgsql-general по дате отправления:

Предыдущее
От: Israel Brewster
Дата:
Сообщение: Re: defining yuor own commands in PG ?
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: targetted array element modification or delete without knowing the index?