Re: Expanded Objects and Order By - Mailing list pgsql-hackers

From Paul Ramsey
Subject Re: Expanded Objects and Order By
Date
Msg-id 933D0559-FAC7-4970-9573-0CFF34CCB444@cleverelephant.ca
Whole thread Raw
In response to Re: Expanded Objects and Order By  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Expanded Objects and Order By
Re: Expanded Objects and Order By
List pgsql-hackers
Thank the Maker, it is reproduceable: returning an expanded header in the _in function is not appreciated in a very
narrownumber 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];




pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Releasing in September
Next
From: Peter Geoghegan
Date:
Subject: Re: Releasing in September