Re: array support patch phase 1 patch

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: array support patch phase 1 patch
Date: 2003-04-08 13:55:44
Message-ID: 1049810144.1896.15.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Joe Conway kirjutas E, 07.04.2003 kell 05:12:
> Joe Conway wrote:
> It covers the following:
> ----------------------------------------------------------------------
> 1. Support for polymorphic functions, accepting and returning ANYARRAY
> and ANYELEMENT datatypes that are "tied" to each other and resolved
> to an actual type at runtime. This also includes the ability to
> define aggregates using the polymorphic functions.
>
> 2. Array handling functions:
> - singleton_array(ANYELEMENT) returns ANYARRAY
> - array_append(ANYARRAY, ANYELEMENT) returns ANYARRAY
> - array_prepend(ANYELEMENT, ANYARRAY) returns ANYARRAY
> - array_accum(ANYARRAY, ANYELEMENT) returns ANYARRAY
> - array_assign(ANYARRAY, int, ANYELEMENT) returns ANYARRAY
> - array_subscript(ANYARRAY, int) returns ANYELEMENT
> - array_cat(ANYARRAY, ANYARRAY) returns ANYARRAY
>

How hard would it be to add

array_eq, array_ne, array_gt, array_le and corresponding operators

SELECT ARRAY[1,2,3] = ARRAY[1,2,3]; # --> TRUE
SELECT ARRAY[1,2,3] < ARRAY[1,2,3]; # --> FALSE
SELECT ARRAY[1,2,3] <= ARRAY[1,2,3]; # --> TRUE
SELECT ARRAY[1,2,3] > ARRAY[1,2,3]; # --> FALSE
SELECT ARRAY[1,2,3] >= ARRAY[1,2,3]; # --> TRUE

I'd assume them to behave like string comparisons, i.e shorter subarray
is smaller:

SELECT ARRAY[1,2] < ARRAY[1,2,3]; # --> FALSE

Support for sorting and b-tree indexing could be nice too.

> Still needs to be done (in roughly this order):
> ----------------------------------------------------------------------
> 1. Functions:
> - str_to_array(str TEXT, delim TEXT) returns TEXT[]
> - array_to_str(array ANYARRAY, delim TEXT) returns TEXT
>
> 2. Documentation update:
> Update "User's Guide"->"Data Types"->"Arrays" documentation
> create a new section: "User's Guide"->
> "Functions and Operators"->
> "Array Functions and Operators"
>
>
> 4. PL/pgSQL support for polymorphic types

Where should one start to add PL/Python support for polymorphic types ?

> 6. Move as much of contrib/intarray into backend as makes sense,
> including migration to use polymorphic semantics (therefore make
> work on other than int where possible). Note: this may not happen
> for 7.4 as it looks to be fairly involved, at least at first glance.

What about moving contrib/intagg into backend ?

(And converting it into ANYagg on the way ;)

--------------------
Hannu

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-04-08 14:01:37 Re: array support patch phase 1 patch
Previous Message Peter Eisentraut 2003-04-08 12:19:56 Re: array support patch phase 1 patch