Re: Unable to identify an ordering operator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ferruccio Zamuner <nonsolosoft(at)diff(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Unable to identify an ordering operator
Date: 2000-12-31 17:17:19
Message-ID: 8413.978283039@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ferruccio Zamuner <nonsolosoft(at)diff(dot)org> writes:
> select persons.name,firm.name,persons.tel
> from persons,work,firm
> where (persons.table_owner=0) and
> (work.id_firm=firm.id and work.id_person=persons.id)
> union
> select persons.name,firm.name,persons.tel
> from persons,work,firm
> where (persons.table_owner=1) and
> (work.id_firm=firm.id and work.id_person=persons.id);

> ERROR: Unable to identify an ordering operator '<' for type '_text'

UNION is defined to eliminate duplicate rows, so it has to be able to
sort and compare rows, which means it needs < and = operators for each
selected column's datatype. Evidently one of the name or tel columns
is declared as array of text ('_text' means text[]), for which there
is no '<' operator. You could probably make one if you were intent
on it (see contrib/array for some inspiration). A lazier way out is
to use UNION ALL, which doesn't try to eliminate duplicates.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Albert REINER 2000-12-31 21:29:33 Arrays
Previous Message Ferruccio Zamuner 2000-12-31 14:55:12 Unable to identify an ordering operator