pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Unable to identify an ordering operator
2+ messages / 2 participants
[nested] [flat]

* Unable to identify an ordering operator
@ 2000-12-31 14:55 Ferruccio Zamuner <nonsolosoft@diff.org>
  2000-12-31 17:17 ` Re: Unable to identify an ordering operator Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Ferruccio Zamuner @ 2000-12-31 14:55 UTC (permalink / raw)
  To: pgsql-sql

Hello,

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'
        Use an explicit ordering operator or modify the query


I know that this query can be rewrite to eliminate the UNION using an
OR operator on first condition but my question is:

How can I specify an ordering operator? On which field have I to put it?


Best wishes for the new YEAR,              \fer



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Unable to identify an ordering operator
  2000-12-31 14:55 Unable to identify an ordering operator Ferruccio Zamuner <nonsolosoft@diff.org>
@ 2000-12-31 17:17 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-12-31 17:17 UTC (permalink / raw)
  To: Ferruccio Zamuner <nonsolosoft@diff.org>; +Cc: pgsql-sql

Ferruccio Zamuner <nonsolosoft@diff.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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-12-31 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-31 14:55 Unable to identify an ordering operator Ferruccio Zamuner <nonsolosoft@diff.org>
2000-12-31 17:17 ` Tom Lane <tgl@sss.pgh.pa.us>

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