convert from json to text[]

Поиск
Список
Период
Сортировка
От Mason Leung
Тема convert from json to text[]
Дата
Msg-id CALQs-jJ0sB8SsHtKv17tiwAxzTuYZPET=5Ns=msGCpN9UZzK0w@mail.gmail.com
обсуждение исходный текст
Ответы Re: convert from json to text[]  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
Hi,

I am running postgres 9.2.4 and 1 of my columns (column name is old_field) is type json.  When I select from this table, I get the following sample data

select old_field from table1;

[], 
['a', 'b']
['a']
[]

How do I change the data type from json to text[]?

I have tried

alter table table1 add column new_field text[] default '{}'::text[]"
UPDATE table1 SET new_field = {old_field} where old_field is not null"

Questions:
1) how to I change the data type from json to text[]
2) how to I select rows that has data and not [],

thanks
-m

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Need help compiling from souce
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: convert from json to text[]