Re: Typing Records - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Typing Records
Date
Msg-id 28150.1282658749@sss.pgh.pa.us
Whole thread Raw
In response to Typing Records  ("David E. Wheeler" <david@kineticode.com>)
Responses Re: Typing Records
List pgsql-hackers
"David E. Wheeler" <david@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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Next
From: Tom Lane
Date:
Subject: EXPLAIN doesn't show the actual function expression for FunctionScan