proposal casting from XML[] to int[], numeric[], text[]

Поиск
Список
Период
Сортировка
Искать
От
Pavel Stehule
Тема
proposal casting from XML[] to int[], numeric[], text[]
Дата
Msg-id
162867790709250057i3e54c8e3v9459b2c5b8defd58@mail.gmail.com
Список
Дерево обсуждения
proposal casting from XML[] to int[], numeric[], text[] "Pavel Stehule" <pavel.stehule@gmail.com>
Re: proposal casting from XML[] to int[], numeric[], text[] Peter Eisentraut <peter_e@gmx.net>
Re: proposal casting from XML[] to int[], numeric[], text[] "Nikolay Samokhvalov" <nikolay@samokhvalov.com>
Re: proposal casting from XML[] to int[], numeric[], text[] "Pavel Stehule" <pavel.stehule@gmail.com>
Re: proposal casting from XML[] to int[], numeric[], text[] "Nikolay Samokhvalov" <nikolay@samokhvalov.com>
Re: proposal casting from XML[] to int[], numeric[], text[] "Pavel Stehule" <pavel.stehule@gmail.com>
Re: proposal casting from XML[] to int[], numeric[], text[] Peter Eisentraut <peter_e@gmx.net>
Re: proposal casting from XML[] to int[], numeric[], text[] Andrew Dunstan <andrew@dunslane.net>
Re: proposal casting from XML[] to int[], numeric[], text[] Bruce Momjian <bruce@momjian.us>
Re: proposal casting from XML[] to int[], numeric[], text[] Bruce Momjian <bruce@momjian.us>
Re: proposal casting from XML[] to int[], numeric[], text[] "Nikolay Samokhvalov" <samokhvalov@gmail.com>
Re: proposal casting from XML[] to int[], numeric[], text[] "Pavel Stehule" <pavel.stehule@gmail.com>
Re: proposal casting from XML[] to int[], numeric[], text[] Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal casting from XML[] to int[], numeric[], text[] "Nikolay Samokhvalov" <samokhvalov@gmail.com>
Re: proposal casting from XML[] to int[], numeric[], text[] Andrew Dunstan <andrew@dunslane.net>
Re: proposal casting from XML[] to int[], numeric[], text[] "Pavel Stehule" <pavel.stehule@gmail.com>
Hello

Current result from xpath function isn't indexable. It cannot be
problem with possibility cast it to some base types.

CREATE OR REPLACE FUNCTION xml_list_to_int(xml[])
RETURNS int[] AS $$
SELECT ARRAY(SELECT to_number(($1[i])::text,'999999.99')::int               FROM generate_series(1, array_upper($1,1)) g(i))
$$ LANGUAGE SQL IMMUTABLE;


CREATE CAST (xml[] AS int[]) WITH FUNCTION xml_list_to_int(xml[]);

-- now I can build functional index
CREATE INDEX fx ON foo USING
GIN((xpath('//id/text()',objednavka_v_xml)::int[]));

Does anybody know better solution?

Regards
Pavel Stehule

В списке pgsql-hackers по дате отправления
От: Chuck McDevitt
Дата:
Сообщение: Re: Suggestion for MSVC build
От: Csaba Nagy
Дата:
FAQ