"David E. Wheeler" <da...@kineticode.com> writes:
> I've been trying to come up with a simpler way to iterate over a series of 
> values in pgTAP tests than by creating a table, inserting rows, and then 
> selecting from the table. The best I've come up with so far is:

>     CREATE TYPE vcmp AS ( lv semver, op text, rv semver);

>     SELECT cmp_ok(lv, op, rv) FROM unnest(ARRAY[
>         ROW('1.2.2',  '=', '1.2.2')::vcmp,
>         ROW('1.2.23', '=', '1.2.23')::vcmp
>     ]);

> Not bad, but I was hoping that I could cast all the rows at once,

You could do it like this:

    SELECT cmp_ok(lv, op, rv) FROM unnest(ARRAY[
        ROW('1.2.2',  '=', '1.2.2'),
        ROW('1.2.23', '=', '1.2.23')
    ]::vcmp[]);


> psql:t/types.pg:205: ERROR:  invalid memory alloc request size 
> 18446744071604011012
> Wha??
> That seems like a bug.

I get a core dump on that one ... looking ...

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to