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

From Tom Lane
Subject Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Date
Msg-id 18303.1275666785@sss.pgh.pa.us
Whole thread Raw
In response to BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail  ("Farid Zidan" <farid@zidsoft.com>)
List pgsql-bugs
"Farid Zidan" <farid@zidsoft.com> writes:
> 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.

This isn't a bug, it's a consequence of the fact that you're not
specifying the types of the literal constants.  DISTINCT forces
the parser to assign a data type to the constants (otherwise there
is no way to understand what duplicate-elimination means) and what
it will fall back to is "text".  Try attaching an explicit cast,
eg
    '2010-04-30 00:00:00'::timestamp

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Farid Zidan"
Date:
Subject: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail