Re: Typing Records

From: Joe Conway <mail(at)joeconway(dot)com>
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 06:24:41
Message-ID: 4C7365A9.6030200@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/23/2010 08:33 PM, David E. Wheeler wrote:
> 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:

<snip>

> Aside from that, might there be another way to do this without an
> explicit composite type? Maybe with VALUES() or something?

Maybe something like this?

select cmp_ok(a,b,c)
from
(
values('1.2.2'::varchar, '='::text, '1.2.2'::varchar),
('1.2.23', '=', '1.2.23'),
('1.2.42', '=', '1.2.32')
) as ss(a, b, c);
cmp_ok
--------
t
t
f
(3 rows)

HTH,

Joe

--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2010-08-24 06:32:47 Re: patch (for 9.1) string functions
Previous Message igor polishchuk 2010-08-24 05:25:41 INSERT and parentheses