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

Поиск
Список
Период
Сортировка
От 100.179370@germanynet.de (Martin Jacobs)
Тема Newbie, Howto access Array-Slots in user defined functions?
Дата
Msg-id m13hDsn-000QbqC@Schnecke.Windsbach.de
обсуждение исходный текст
Список 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.179370@germanynet.de und
martin.jacobs@an-netz.de
Registered Linux User #87175

В списке pgsql-general по дате отправления:

Предыдущее
От: David Huttleston Jr
Дата:
Сообщение: Re: Using Microsoft Access as front end to Postgres
Следующее
От: "Len Morgan"
Дата:
Сообщение: Re: Newbie, Howto access Array-Slots in user defined functions?