From: Itai Zukerman <zukerman@math-hat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Polymorphic?
Date: Tue, 25 Feb 2003 22:40:58 -0500
Message-ID: <878yw31zg5.fsf@matt.w80.math-hat.com> (raw)
In-Reply-To: <10960.1046190011@sss.pgh.pa.us>
References: <87lm041jnq.fsf@matt.w80.math-hat.com>
<10960.1046190011@sss.pgh.pa.us>
>> 1. Extract information about the underlying type from the arrays, in
>> particular the size of the type?
>> 2. Apply an operator from within C?
>
> contrib/array might be a useful example of array manipulation. As for
> the other stuff, do you actually want to invoke those operators
> specifically, or are you looking for sorting? In any case you might
> prefer to use any_ordering_op, SelectSortFunction and ApplySortFunction
> rather than nailing down your own assumptions about what to compare
> with.
I think ApplySortFunction is exactly what I wanted.
I'm not sure when I'm going to get to it, but what I'd like to do is:
given an existing order relation on a type, extend it to an order on
arrays of that type. I've done it for INT4[], and it looks like the
general case is possible, just a question of figuring out which pegs
go in which slots. So far PostgreSQL's been a pleasure to work with;
kudos!
CREATE FUNCTION arr_int4_lt(int4[], int4[]) RETURNS boolean
AS 'arr_ops', 'generic_lt'
LANGUAGE 'C' STRICT;
CREATE FUNCTION arr_foo_lt(foo, foo) RETURNS boolean
AS 'arr_ops', 'generic_lt'
LANGUAGE 'C' STRICT;
etc.
--
Itai Zukerman <http://www.math-hat.com/~zukerman/;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: zukerman@math-hat.com, tgl@sss.pgh.pa.us
Subject: Re: Polymorphic?
In-Reply-To: <878yw31zg5.fsf@matt.w80.math-hat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox