BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail

Поиск
Список
Период
Сортировка
The following bug has been logged online:

Bug reference:      5490
Logged by:          Farid Zidan
Email address:      farid@zidsoft.com
PostgreSQL version: 8.4.1
Operating system:   Windows XP 32-bit
Description:        Using distinct for select list causes insert of
timestamp string literal to fail
Details:

If you use keyword 'distinct' for the source select of the insert statement
the insert fails. Insert succeeds if 'distinct' is not used in select list.
Example,

create table test_insert (
col1 char(8) not null,
col2 TIMESTAMP not null default CURRENT_TIMESTAMP);

insert into
test_insert
(col1, col2) values
('a', '2010-04-30 00:00:00');

insert into test_insert
(col1, col2)
select distinct
'b',
'2010-04-30 00:00:00'


ERROR:  column "col2" is of type timestamp without time zone but expression
is of type text
LINE 16: '2010-04-30 00:00:00'
         ^
HINT:  You will need to rewrite or cast the expression.

********** Error **********

ERROR: column "col2" is of type timestamp without time zone but expression
is of type text
SQL state: 42804
Hint: You will need to rewrite or cast the expression.
Character: 282

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Hartmut Goebel
Дата:
Сообщение: Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail