is not distinct from any(...)

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: is not distinct from any(...)
Date: 2008-09-19 14:14:05
Message-ID: 603c8f070809190714s1c310d9er3f398a26768fe609@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to write a SQL statement to determine whether a value is an
an array, but I want the comparison to be done using IS NOT DISTINCT
FROM rather than =.

My first thought was that instead of writing:

SELECT value = ANY(array)

...I could simply write:

SELECT value IS NOT DISTINCT FROM ANY(array)

That doesn't seem to work, because IS NOT DISTINCT FROM is not an
operator. So then I tried creating an operator === (anyelement,
anyelement) that just does IS NOT DISTINCT FROM and writing:

select 1 === any(array[1]);

which got me:

ERROR: could not find array type for data type anyelement

Grr... any suggestions?

...Robert

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-09-19 14:34:07 Re: Query planner issue
Previous Message Markova, Nina 2008-09-19 13:59:58 setting Postgres client