From: | Paul Ramsey <pramsey(at)cleverelephant(dot)ca> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Paul Ramsey <pramsey(at)cleverelephant(dot)ca>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Expanded Objects and Order By |
Date: | 2016-01-20 23:44:45 |
Message-ID: | 933D0559-FAC7-4970-9573-0CFF34CCB444@cleverelephant.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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];
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2016-01-20 23:51:49 | Re: Releasing in September |
Previous Message | Peter Geoghegan | 2016-01-20 23:43:46 | Re: Releasing in September |