Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrGYi-00088z-JL for pgsql-general@arkaria.postgresql.org; Thu, 10 Jun 2021 09:01:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lrGYh-0005RY-CN for pgsql-general@arkaria.postgresql.org; Thu, 10 Jun 2021 09:01:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrGYh-0005RM-02 for pgsql-general@lists.postgresql.org; Thu, 10 Jun 2021 09:01:03 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lrGYd-0000fT-LI for pgsql-general@lists.postgresql.org; Thu, 10 Jun 2021 09:01:02 +0000 Received: by mail-wr1-x434.google.com with SMTP id a11so1333268wrt.13 for ; Thu, 10 Jun 2021 02:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=89Yz4IiwkmVWHaKz6irRxLtQ/2GtobmzE45vwacYoB0=; b=lFNkGEl74fRtiMRVq458bxZl/ERrz3ZmYdHoauyoi1KoCx2AC+4C4L1AJPLOJ3d8ah SdnlMV6SEI+y7SEPkofWwKo8jzY7K6RUWpznKBVxMoRF3GQvom8TFxX7YUUJLpoe7T85 2uI6EKoxFLcpv9RoKwHRyMazkA8KOMdsN6/d2Nrk/xMhS5j5489QOIKjOuCrEUtU2VLM aeyxmTMEPL1BITUT46USki0dvReOLpBwtmADMDPvV6uhxryNdIxOxT5gKGrXd4Qr3eLh POSDJv3cLYx8YdoJ9cv4pjl169Z+vIPpR7Smzk1U+lzkkx7qm+IUO7sA41BsqSPRsEMk xytg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=89Yz4IiwkmVWHaKz6irRxLtQ/2GtobmzE45vwacYoB0=; b=TQZQV5LYguH8tAcBRA5SGxl0EJRACNlPr7qQmmfGUhVIYLJ10aWpGp/zjQPLXFrtJK GizrciLO4H/QHw1/EuPcE7oIw984SvJkTzF4giTTj3B8i3IZzoGtce7wJ3dcICbBWiOZ OnRW0Y7/7TeueGhXdpT5g9OGFGI7IUQ8HcdiArEfFs73aS+ZmIkDL5JTSY6y/AsxTRtT dg19Fn/gs27RYASB2cEFLeh1LxndbVhdkt7QP32tE/2dL6SVA/Po89zUOXvsuewxdh5m 3YriyptiqG53N6hqv9GYHj5deCUcrroslTSQmrwV9uFNv2cOnGCZbtISYNSy0lTxFcOr aAAA== X-Gm-Message-State: AOAM533fnS8CP+1Lsz+I37M37jiCHqQdyxf8VGjK4rVpROMaIMUWVYgM x0EinBBy2gHxvb5ptjAD8ovGBg== X-Google-Smtp-Source: ABdhPJxe9PbpxcBhvQSj0hulWtyag+Vl/ZjYb/0ctfF5mTzI97NSwqkJyiWV2l8S/W8qmh5fUeTcmA== X-Received: by 2002:adf:e8c1:: with SMTP id k1mr4235381wrn.413.1623315658427; Thu, 10 Jun 2021 02:00:58 -0700 (PDT) Received: from localhost.localdomain (217-149-173-44.nat.highway.telekom.at. [217.149.173.44]) by smtp.gmail.com with ESMTPSA id n1sm2283022wms.18.2021.06.10.02.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 02:00:58 -0700 (PDT) Message-ID: Subject: Re: order by From: Laurenz Albe To: Luca Ferrari , Vijaykumar Jain Cc: pgsql-general Date: Thu, 10 Jun 2021 11:00:57 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2021-06-10 at 10:39 +0200, Luca Ferrari wrote: > I also realized that this "table to tuples" expansion works for GROUP BY too. > However, I'm not able to find this documented in GROUP BY, WHERE, > ORDER BY clauses sections into select documentation > ;. Could be > my fault, of course. I don't think it is really documented outside the source, but it is called a "whole-row reference" and behaves in SQL like composite data type that belongs to the table. So ordering is lexicographical, equality is equality of all members, and don't ask me about IS NULL and IS NOT NULL, else I point you to https://www.postgresql.org/message-id/flat/48BDABE9-88AB-46E9-BABE-F70DDBFB98BD%40kineticode.com Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com