Re: Does Type Have = Operator? - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: Does Type Have = Operator?
Date
Msg-id A97E493F-87D2-47D1-84D7-2A1BDAAB012A@justatheory.com
Whole thread Raw
In response to Re: Does Type Have = Operator?  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List 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.Nasby@BlueTreble.com> wrote:

> Speaking specifically to is(), what I'd find most useful is if it at least hinted that there might be some type
shenanigansgoing on, because I've run across something like your example more than once and it always takes a lot to
finallyfigure 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
lostyour 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


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: Does Type Have = Operator?
Next
From: Tom Lane
Date:
Subject: Re: Parameters don't work in FETCH NEXT clause?