Re: Should we document IS [NOT] OF?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should we document IS [NOT] OF?
Date: 2020-11-19 16:06:52
Message-ID: 1052846.1605802012@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway <mail(at)joeconway(dot)com> writes:
> Here is a link to previous list discussions:
> https://www.postgresql.org/message-id/45DA44F3.3010401%40joeconway.com

Ah, thanks, I was intending to go do some searching for that.

So at this point this has been re-debated at least three times.
I think it's time to put it out of its misery. You can get
equivalent behavior using something like
pg_typeof(foo) in ('int'::regtype, 'float8'::regtype)
so we've got the "another way to do it" covered. And I'm
still convinced that the existing implementation is not
anywhere near per-spec. The issue about NULL is somewhat
minor perhaps, but the real problem is that I think the
spec intends "foo is of (sometype)" to return true if foo
is of any subtype of sometype. We don't have subtypes in
the way SQL intends, but we do have inheritance children
which are more or less the same idea. The closest you can
get right now is to do something like

select * from parent_table t where t.tableoid = 'child1'::regclass

but this will fail to match grandchilden of child1.
I think a minimum expectation is that you could do
something like "where (t.*) is of (child1)", but
our existing code is nowhere near making that work.

Let's just rip it out and be done. If anyone is ever
motivated to make it work per spec, they can resurrect
whatever seems useful from the git history.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2020-11-19 16:15:33 Re: Should we document IS [NOT] OF?
Previous Message Stephen Frost 2020-11-19 16:04:17 Re: Disable WAL logging to speed up data loading