Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjZRo-001uBl-DS for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Aug 2024 07:20:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sjZRm-00GWfD-0A for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Aug 2024 07:19:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjZRl-00GWf5-Nd for pgsql-bugs@lists.postgresql.org; Thu, 29 Aug 2024 07:19:58 +0000 Received: from mail-yw1-x112c.google.com ([2607:f8b0:4864:20::112c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sjZRi-0022tF-Sy for pgsql-bugs@lists.postgresql.org; Thu, 29 Aug 2024 07:19:57 +0000 Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-690ad83d4d7so3197917b3.3 for ; Thu, 29 Aug 2024 00:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724915994; x=1725520794; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gLz0jXD7eIEsd9sxZiDmdVtT2/7Q4Sp83DS7N+3U5xA=; b=J9BSkOHeV+B8Ii3vw/yAYo9RnOVNi2SoDQz70xtzt+bakWM2Nk0jtZpPyckeEkRtjs 7m8pD6kkWW04HFrwtUrNQXy0qrcmR8SrGxuA2y0fbq4+4FrAB4Up3sW+rvVzhxPt1caX b2WaojMtnjzpEaw/xIoYUnIsIbrGwMyIO2EN+hwA8HdKWDrz4Ij9cigOtKBeLcb7LAky l0NRqQXt15u2gaamu3FOaS8ftL9Jej0dyuQed3fVrTh6MRAkhxtdMY+IaO/mA+8HKAOl rziJDnlYg5fuEq/D8bBGgqGKiq46boP4rNJIiX2J4fE0F7Op+XGrso++ygP2S7XapxCJ k/8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724915994; x=1725520794; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gLz0jXD7eIEsd9sxZiDmdVtT2/7Q4Sp83DS7N+3U5xA=; b=MCgHyZA5HYxpSDcSlnJSmvqmx9ka77hGoUWoNu+sjbFjgvOYhLMcrI3BNcqfu8f/OT dXLnj07mRTsSJV3mJuNhoZ85KFy4n+Kzun5G18hhT5AVajD3xHfWpq1T/trRp0MREIQ8 Xk6uq7d6X6otyFyfUulFYaX0h1FrOfrhb8kYKl7x3E/eFuvpCKaUwhlz9S65NioJNxGh szI1xUsdtC3CmWrpp7iU2eLEG3qfZSRzIbd3hW3hNP+NwwZ7KdmmJ6FIdQpuCqnhD38Y Tj3oJdumw09uya3kBYbDe5SlhNYN6mjLuQvv45gSnWfcGW7bHYbEYcFMt7iXEv9pU58v L1Kg== X-Forwarded-Encrypted: i=1; AJvYcCX/lT7f6PfPczVI8Z6stlBQruhUqZ5MbmmHXTZiZ+d/IVLCzoihS0b/1Qw7QpCzdWphgkRuvRKwZ8N3@lists.postgresql.org X-Gm-Message-State: AOJu0YzUbTFGbcqZa0tRx0Cci+nELInF+lZ0QncN5xTd4jswXwM1VSPu W0EPaKoGDEIdixHJKgyoj0n1VxwQnlrLWO250AI8cY8NEvLNqn+XmjIFyZeVwL7h/QOll1U924v D3Jqw08zwJAqJzyQjPngTnJ9plYw= X-Google-Smtp-Source: AGHT+IHbZOT2F3rNzAfgXQv2vsFNgvSCFaWkl4UYnMwtrn99OBIyEC4nY8RTKqmOsimwFPIMV2UlC+/z5XFJxqLMZSE= X-Received: by 2002:a05:690c:3486:b0:6b2:4154:e598 with SMTP id 00721157ae682-6d276adcf3cmr17844167b3.26.1724915994291; Thu, 29 Aug 2024 00:19:54 -0700 (PDT) MIME-Version: 1.0 References: <18589-70091cb81db1a3f1@postgresql.org> <2906775.1724692311@sss.pgh.pa.us> <3094457.1724769753@sss.pgh.pa.us> <3465444.1724871808@sss.pgh.pa.us> In-Reply-To: <3465444.1724871808@sss.pgh.pa.us> From: Richard Guo Date: Thu, 29 Aug 2024 15:19:43 +0800 Message-ID: Subject: Re: BUG #18589: pg_get_viewdef returns wrong query To: Tom Lane Cc: tlhquynh@gmail.com, pgsql-bugs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Aug 29, 2024 at 3:03=E2=80=AFAM Tom Lane wrote: > I was just about to commit v2 when I realized that it's wrong, because > what we need to be checking against is the output column name(s) that > get_target_list() will print, and that's not necessarily tle->resname. > You can in fact make v2 misbehave with ALTER VIEW RENAME COLUMN, as > shown by the added test cases in attached v3. Ah yes, we need to match the column name from the view's tuple descriptor, which may differ from tle->resname after column RENAME. +1 to v3. Thanks Richard