Newbie, Howto access Array-Slots in user defined functions?

From: 100(dot)179370(at)germanynet(dot)de (Martin Jacobs)
To: PGSQL Mailinglist <pgsql-general(at)hub(dot)org>
Subject: Newbie, Howto access Array-Slots in user defined functions?
Date: 2000-10-05 16:28:33
Message-ID: m13hDsn-000QbqC@Schnecke.Windsbach.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am new to this list, maybe my question is already answered, but
I did not find any hint.

I have PostgreSQL 6.3 running, a table contains, among others, a
column with an array of bytes (c bytea[4]). Trying to do a

SELECT DISTINCT c FROM table;

I get

ERROR: There is no operator '<' for types '_bytea' and '_bytea'
You will either have to retype this query using an explicit cast,
or you will have to define the operator using CREATE OPERATOR

To create an operator I need a function, so let's beginn with a
compare function:

CREATE FUNCTION lessbyte (_bytea, _bytea) RETURNS bool AS
'SELECT $1[1] < $[2];' LANGUAGE 'sql';

I get

ERROR: parser: parse error at or near "["

Any hint, how to overcome this?

Martin

--
Martin Jacobs * Windsbach * 100(dot)179370(at)germanynet(dot)de und
martin(dot)jacobs(at)an-netz(dot)de
Registered Linux User #87175

Browse pgsql-general by date

  From Date Subject
Next Message Gunnar R|nning 2000-10-05 16:46:42 Re: Re: JDBC Performance
Previous Message Michael Ansley 2000-10-05 16:14:51 RE: Re: [SQL] Object syntax