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

From Farid Zidan
Subject BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Date
Msg-id 201006041432.o54EWhsP038601@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-bugs
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 by date:

Previous
From: Hartmut Goebel
Date:
Subject: Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading
Next
From: Tom Lane
Date:
Subject: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail