Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A312363289B for ; Tue, 22 Dec 2009 01:23:21 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 45511-09 for ; Tue, 22 Dec 2009 05:23:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f226.google.com (mail-ew0-f226.google.com [209.85.219.226]) by mail.postgresql.org (Postfix) with ESMTP id 0FF9A6324A5 for ; Tue, 22 Dec 2009 01:23:13 -0400 (AST) Received: by ewy26 with SMTP id 26so2299216ewy.3 for ; Mon, 21 Dec 2009 21:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NOa3bAAudDXkwcGXP6I3cqmg56RxwQrALy5JI0viA8o=; b=cTzt9R6W/mEYutJKUbJBaF+y9Nr4Qzc58v7R4Iu6agJGZSWJKnPjwp+n6e7JXFFg5O 2U4UHoeFYOf2aCSHM/9YIF/85qHLFzFbLnoqML2OPbeY9h9Tgo7Osl9+PzyGvmhboctP iU4vlwH6H3/3HAbQZo+h06zqgX+8F3Vbe0aYM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=sq9OLwb7YS+v6jglg4vYFlGQoqWF+gSbReQ/DvuYgW8U2qOQ1k22CF59E/E7zxa0FN tXmHdQkq6CnxGBCAcrq5DkltQZBd1FqFY9GybuIP//VX/pzrKti/8TzBB8fx35L3oCkM k2Km/UIKEmwowTTfd/IQdhFVPODTmGxmxInEE= MIME-Version: 1.0 Received: by 10.216.86.83 with SMTP id v61mr3015159wee.80.1261459392227; Mon, 21 Dec 2009 21:23:12 -0800 (PST) In-Reply-To: References: <302670f20912211415n4fc73b04x19eebfb9ff0acd60@mail.gmail.com> <302670f20912211945n1b6684e9xb304d4508766f117@mail.gmail.com> Date: Mon, 21 Dec 2009 22:23:11 -0700 Message-ID: Subject: Re: 8.4.1 distinct query WITHOUT order by From: Scott Marlowe To: Gary Chambers Cc: Thomas Kellerer , pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/53 X-Sequence-Number: 33491 On Mon, Dec 21, 2009 at 10:18 PM, Scott Marlowe w= rote: > On Mon, Dec 21, 2009 at 8:45 PM, Gary Chambers wrote: >>> Yeah, if you're code base is that fragile, bandaging it up by jumping >>> through hoops in pgsql is just putting off the inevitable when it (the >>> code base) has to get recompiled someday anyway. >> >> I appreciate (and agree with) the concern about the fragility of the >> codebase. =A0The maintainer knows that anything except adding ORDER BY >> is a kludge. >> >> Now, the aforementioned notwithstanding... > > Replacing the table with a view should work. =A0Just be sure to make > insert rules if you need it to be insertable by other parts of the app > I guess. Actually, since the order by in the view will be applied before the hash_agg and stuff, I don't think it will work.