Re: [HACKERS] looking for an array-extract-item-as-it operator

2016-01-11 Thread Peter Krauss
(ops, sending to the pgsql-hackers, see the complete thread below) Adding a formal suggestion after discussion: to include a fast array_getarray() function! CREATE FUNCTION array_getarray( m anyarray, idx int ) RETURNS anyarray AS $f$ -- this is a slow workaround for an (need for) inter

Re: [HACKERS] looking for an array-extract-item-as-it operator

2016-01-06 Thread Tom Lane
Peter Krauss writes: > I need to access an array-item from an array of arrays. Multi-dimensional arrays in Postgres are not "arrays of arrays". If you persist in thinking they are, it's mostly going to lead you astray about what will work or not. Having said that, you might find that plpgsql's

[HACKERS] looking for an array-extract-item-as-it operator

2016-01-06 Thread Peter Krauss
I need to access an array-item from an array of arrays. Suppose WITH t AS (SELECT '{{1,2,3},{33,44,55}}'::int[][] as a)SELECT a[2],-- returns null (!), why not works? a[2:2], -- returns array-into-array, not a simple arrayFROM t; There are a simple function or operator to acess i