Re: Does Type Have = Operator?

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Kevin Grittner <kgrittn(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Does Type Have = Operator?
Date: 2016-05-17 16:06:16
Message-ID: A97E493F-87D2-47D1-84D7-2A1BDAAB012A@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry for the pgTAP off-topicness here, hackers. Please feel free to ignore.

On May 17, 2016, at 8:10 AM, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> wrote:

> Speaking specifically to is(), what I'd find most useful is if it at least hinted that there might be some type shenanigans going on, because I've run across something like your example more than once and it always takes a lot to finally figure out WTF is going on.

Agreed. Same for the relation testing functions. Maybe some additional diagnostics could be added in the event of failure.

> I think it'd also be useful to be able to specify an equality operator to is(), though that means not using IS DISTINCT.

You can use cmp_ok().

http://pgxn.org/dist/pgtap/doc/pgtap.html#cmp_ok.

> Something else to keep in mind here is that is() is defined as is(anyelement, anyelement, text), which means you've lost your original type information when you use it. I don't think you could actually do anything useful here because of that.

pg_typeof() will give it to you.

Best,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-05-17 16:13:09 Re: Parameters don't work in FETCH NEXT clause?
Previous Message David E. Wheeler 2016-05-17 16:03:02 Re: Does Type Have = Operator?