Thread: error: cast the timestam expression

error: cast the timestam expression

From
friendVU admin
Date:
When I execute this:
"insert into comments   (    date_posted    )     (select  date_published   from xyz    )"

I get :
"ERROR:  column "date_posted" is of type timestamp without time zone but 
expression is of type text
HINT:  You will need to rewrite or cast the expression."

Both dates are of type timesamp!
I searched how to cast, and can't find it.

What is the syntax to cast a timestamp to a timestamp?
tia,
.V


Re: error: cast the timestam expression

From
Tom Lane
Date:
friendVU admin <maillist@friendvu.com> writes:
> When I execute this:
> "insert into comments
>     (
>      date_posted
>      )  
>     (select  date_published
>     from xyz
>      )"

> I get :
> "ERROR:  column "date_posted" is of type timestamp without time zone but 
> expression is of type text
> HINT:  You will need to rewrite or cast the expression."

> Both dates are of type timesamp!

I don't think so.  Let's see the definitions of the comments and xyz
tables (\d in psql will do).
        regards, tom lane


Re: error: cast the timestam expression

From
Michael Glaesemann
Date:
On Jan 28, 2005, at 23:55, friendVU admin wrote:

> When I execute this:
> "insert into comments
>    (
>     date_posted
>     )
>      (select  date_published
>    from xyz
>     )"
>
> I get :
> "ERROR:  column "date_posted" is of type timestamp without time zone 
> but expression is of type text
> HINT:  You will need to rewrite or cast the expression."
>
> Both dates are of type timesamp!

Could you post the output to \d xyz and \d comments from psql?

Michael Glaesemann
grzm myrealbox com