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 1nmrKC-000855-NP for pgsql-general@arkaria.postgresql.org; Fri, 06 May 2022 06:20:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nmrKB-0000fL-6q for pgsql-general@arkaria.postgresql.org; Fri, 06 May 2022 06:20:23 +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 1nmrKA-0000fC-QT for pgsql-general@lists.postgresql.org; Fri, 06 May 2022 06:20:22 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nmrK8-0004v2-Fj for pgsql-general@lists.postgresql.org; Fri, 06 May 2022 06:20:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=Content-Type:MIME-Version:Reply-To:Message-ID:Subject:To: Sender:From:Date:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ru5zQ+XwNzqfV0A3gmT6gCuBQfSNiHO+DlrwoHQjqJc=; b=kLBCa6V/5U3pxLtB7+JDB9It9q gettPCZrojNIjcXmmsm/o3yQYmOKlaACNkmKTZrmu46wR+XWcN2hFAgqQKkPdY1vDOnbYk6kSy/mT MQOn15EZRlRDcKE4XLbAQdSk6/vOKZAuP/xEEknKY2L5Ms24hfWm64j0A1y00o2yc4Y4=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1nmrK5-0002ry-UQ for pgsql-general@lists.postgresql.org; Fri, 06 May 2022 08:20:17 +0200 Date: Fri, 6 May 2022 08:20:17 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: PostgreSQL General Subject: Order of rows in statement triggers NEW/OLD tables Message-ID: <20220506062017.GA6811@depesz.com> Reply-To: depesz@depesz.com MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, when defining statement triggers on update I can use: REFERENCING OLD TABLE AS xxx NEW TABLE as YYY these "pseudo" tables contain rows that were before and after. Is the order guaranteed? Can I assume that "first" row returned by select from xxx, will be older version of first row returned by select from yyy? depesz