Array iterators

From: "Rod Taylor" <rbt(at)zort(dot)ca>
To: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Array iterators
Date: 2002-05-15 01:15:31
Message-ID: 029201c1fbae$0227ab40$8001a8c0@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I really like array iterators, and am interested in simplifying them
somewhat. Currently they required too many operator entries and
functions to be truely useful in the base.

Please fill in holes ;)

Ok, first step. The ability to create an operator that will work on a
vast number of data types without having to specify each one. This
requires creation of functions which can accept type unknown, and more
importantly an array of unknown.

I don't think much (any?) modifcation will be required to arrayin() /
arrayout() for this as unknown is basically a varchar.

Step 2 is to teach oper_select_candidate() about functions which
accept unknown and _unknown that can be used as a last resort. We
will allow coercions to type unknown and _unknown from any type to
accomplish this but only in this specific case. Why unknown and not
text? We simply don't want to allow this special method for
everything. Just a few special cases where comparing Datums is close
enough. Array iterators and perhaps a generic '=' operator where one
doesn't exist with a specific type tied to it that we can use instead.

Step 3 is to have the iter operators use datumIsEqual(). The special
cases that datumIsEqual doesn't work will get it's own set of array
iterator functions. A list of these needs to be compiled, although it
should be a short one.

Doesn't seem like a great solution because I don't like coercing
stuff back to unknown. Making a special generic type or using text in
this case isn't much better as it's still arbirarily selecting when to
coerce to it or not.

Perhaps all thats needed is an interator function set per type group
(ints, chars, bool, ...)

It'll be a while before I do anything -- but perhaps for 7.4.

--
Rod

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-05-15 02:25:24 resetting stats on the fly
Previous Message Tom Lane 2002-05-14 23:29:10 Re: can't cast varchar as integer?