Re: Typing Records

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Typing Records
Date: 2010-08-24 14:05:49
Message-ID: 28150.1282658749@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David E. Wheeler" <david(at)kineticode(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-24 14:40:30 EXPLAIN doesn't show the actual function expression for FunctionScan
Previous Message Bruce Momjian 2010-08-24 14:03:48 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session