From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: 1165125080@qq.com
Subject: BUG #17364: Errors caused by views
Date: Wed, 12 Jan 2022 15:53:31 +0000
Message-ID: <17364-3072d21ebb3da224@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17364
Logged by: ERROR: invalid value "erro" for "YYYY"
Email address: 1165125080@qq.com
PostgreSQL version: 13.2
Operating system: centos
Description:
I run the following SQL statements on postgres13.2. They are simple, but an
error occurs.
create table test1 (id int, c_data varchar);
insert into test1 values (1, '201201');
insert into test1 values (2, 'error');
create table test2(id int, status varchar);
insert into test2 values (1, 'on');
insert into test2 values (2, 'off');
create view test_view as
SELECT test1.c_data
from test1 LEFT JOIN test2
ON (test2.id = test1.id)
WHERE (test2.status)::text = 'on'::text;
select * from test_view;
c_data
----------
20201101
(1 row)
select * from
(select to_date(c_data, 'YYYYMMDD') as date
from test_view) t1
where t1.date >= '2020 - 10 - 01':: TIMESTAMP;
ERROR: invalid value "erro" for "YYYY"
DETAIL: Value must be an integer.
` ` `
Obviously, the error data in the test table should not be displayed, but the
error data in the test table is displayed, which causes an error during SQL
execution.
It is hoped that the cause can be located and the problem can be rectified.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, 1165125080@qq.com
Subject: Re: BUG #17364: Errors caused by views
In-Reply-To: <17364-3072d21ebb3da224@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox