Re: Regarding select distinct ...query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: "Prachi Jain" <prachijain3(at)rediffmail(dot)com>, christoph(dot)dalitz(at)hs-niederrhein(dot)de, pgsql-general(at)postgresql(dot)org
Subject: Re: Regarding select distinct ...query
Date: 2002-12-19 00:51:20
Message-ID: 13595.1040259080@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Stark <gsstark(at)mit(dot)edu> writes:
> In the current situation we have a perfectly fine standard SQL query that runs
> fine on other databases but fails on postgres. And the only way to "fix" it
> for postgres is to add a non-standard cast to it that won't work on the other
> databases.

Which part of CAST('' AS CHARACTER VARYING(1)) doesn't work on your other
databases?

I am not here to defend the fact that SELECT DISTINCT 'foo' fails; in
fact fixing it is on my todo list I think [digs...] yeah here it is:

: SELECT DISTINCT 'bar' fails because there's no ordering op for unknown.
: Probably should coerce to text, much as we do for CASE and UNION.
: Msg 2/01/02 17:53
: Anywhere we are doing assignSortGroupRef, seems okay to modify tle to
: coerce to text. transformGroupClause, addTargetToSortList (but prepunion
: calls addAllTargetsToSortList; maybe need to do it at higher level?)

I'm just pointing out why it historically hasn't worked.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Larry Rosenman 2002-12-19 01:23:40 Re: trouble caused by change in 7.3 handling of '' in
Previous Message Ian Harding 2002-12-19 00:43:01 Re: Regarding select distinct ...query