Thank the Maker, it is reproduceable: returning an expanded header in the _in
function is not appreciated in a very narrow number of cases.
Edit arrayfuncs.c:array_in(), change the return line thus:
// PG_RETURN_ARRAYTYPE_P(retval);
PG_RETURN_DATUM(expand_array(PointerGetDatum(retval),
CurrentMemoryContext, my_extra));
And here is a small test case that exercises it:
CREATE TABLE orderby_expanded (
id integer,
a integer[]
);
INSERT INTO orderby_expanded (id, a) VALUES (1, ARRAY[1,2]);
-- works
SELECT id, a FROM orderby_expanded
ORDER BY a = '{1,2}'::integer[];
-- ERROR: could not find pathkey item to sort
SELECT id FROM orderby_expanded
ORDER BY a = '{1,2}'::integer[];
-- works
SELECT id FROM orderby_expanded
ORDER BY a = ARRAY[1,2];
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers