Ok, I can look into this now...
Good, thank you.


I'm not sure really where to being though. What are all the new operators? What does it even mean to use a GIN over an int[] column?

Patch introduces three new operators over one-dimensional arrays (left and rights args should have the same real type) without null elements:

*   anyarray @ anyarray   - contains
    true, if all elements of right array exists in left one
*   anyarray && anyarray  - overlap
    true, if it exists at least one element in both arrays
*   anyarray ~ anyarray   - contained
    true, if all elements of left array exists in right one

Operations @ and ~ are commutators.
Pls, note:
* type of array element must have equality operator, finding by
  typentry = lookup_type_cache(element_type,  TYPECACHE_EQ_OPR_FINFO);
  typentry->eq_opr_finfo.fn_oid
  Equality operator is searching by the same way as it does by
  'anyarray = anyarray' operator.
* nulls element is prohibited because we can't find correct logic for
  result of operations:
  *  '{1,2,3}' @ '{1,NULL}'  - is it true or false?
  *  '{1,2,3,NULL}' @ '{1,NULL}' - ???
  I see that '{NULL}'::int[] = '{NULL}'::int[] returns true, but NULL = NULL
  returns NULL, should I treat NULL element in array as usual element with
  specific value and suppose that NULL=NULL?
* non-one-dimensional arrays have similar problem for definition:
  '{{1,2},{3,4}}' @ '{1,3}'  - ?


GIN has built-in support of that 3 operations over
select pg_type.typname, pg_opclass.opcname from pg_am, pg_opclass, pg_type where pg_opclass.opcamid = pg_am.oid and pg_am.amname='gin' and pg_opclass.opcintype = pg_type.oid;


Contrib/intarray adds support to GIN for 'int4[] @@ query_int' operation (boolean search in array), contrib/tsearch2 use GIN to speed up 'tsvector @@ tsquery'

I guess it's a little more difficult to understand than I guessed...

Hope, it will be easier that you think :)

--
Teodor Sigaev                                   E-mail: [EMAIL PROTECTED]
                                                   WWW: http://www.sigaev.ru/

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to