Skip site navigation (1) Skip section navigation (2)

Re: You might need to add explicit type casts.

From: Andrew McMillan <andrew(at)morphoss(dot)com>
To: kulmacet101(at)kulmacet(dot)com
Cc: pgsql-php(at)postgresql(dot)org(dot)
Subject: Re: You might need to add explicit type casts.
Date: 2008-12-29 04:07:25
Message-ID: 1230523645.5932.4.camel@happy.mcmillan.net.nz (view raw or flat)
Thread:
Lists: pgsql-php
On Sun, 2008-12-28 at 21:30 -0600, kulmacet101(at)kulmacet(dot)com wrote:
> I have a table running on Linux\Postgresql 8.3.4:
> 
>  CREATE TABLE "public"."active_sessions" (
>    "id" VARCHAR(11) DEFAULT nextval('id_seq'::regclass) NOT NULL,
>    "browser_type" VARCHAR(100),
>    "session_id" VARCHAR(50),
>    "ip_address" INET,
>    "username" VARCHAR(50),
>    "access_time" TIMESTAMP WITHOUT TIME ZONE,
>    "user_rand" VARCHAR(15),
>    "user_activity" TIMESTAMP WITHOUT TIME ZONE,
>    CONSTRAINT "active_sessions_pkey" PRIMARY KEY("id")
>  ) WITHOUT OIDS;
> 
>  I can insert the TIMESTAMP('s) into this table without issue but when I
>  update the new entry the following error is received:

Hi,

You need to:

UPDATE active_sessions SET access_time = '12/28/2008 8:51:33PM'::timestamp without time zone WHERE id = 469

or alternatively:

UPDATE active_sessions SET access_time = current_timestamp::timestamp without time zone WHERE id = 469

I'm surprised that:

UPDATE active_sessions SET access_time = current_timestamp WHERE id = 469

doesn't also work fine though - it should cast timestamp => timestamp
without time zone without any trouble.

Cheers,
					Andrew.

------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com                            +64(272)DEBIAN
                      You fill a much-needed gap.
------------------------------------------------------------------------



In response to

pgsql-php by date

Next:From: kulmacet101Date: 2008-12-29 04:17:14
Subject: Re: You might need to add explicit type casts.
Previous:From: kulmacet101Date: 2008-12-29 03:30:05
Subject: You might need to add explicit type casts.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group