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

From: "Farid Zidan" <farid(at)zidsoft(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Date: 2010-06-04 14:32:43
Message-ID: 201006041432.o54EWhsP038601@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5490
Logged by: Farid Zidan
Email address: farid(at)zidsoft(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-06-04 15:53:05 Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Previous Message Stephen Frost 2010-06-04 12:57:39 Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading