Re: Problem with null timestamp fields

From: Jason Earl <jdearl(at)yahoo(dot)com>
To: "Thomas T(dot) Veldhouse" <veldy(at)veldy(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with null timestamp fields
Date: 2001-06-28 03:15:55
Message-ID: 20010628031555.5488.qmail@web10003.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

There is a difference between "login_ts" and the
"login_ts " (notice the extra space) that I see in
your create statement.

I got the same error by using your example, but when I
changed the insert to look like this:

insert into user_history(id, userid, ipaddr,
"login_ts ") values (1, 2, '127.0.0.1', now());

Notice the " characters and the space.

Because of ambiguities like that I tend to create my
tables without the '"' character. I also don't use
the formal 'timestamp with time zone' (but mostly
because timestamp is easier to type).

Try this:

CREATE TABLE user_history (
id integer DEFAULT
nextval('user_history_id_seq'::text) NOT NULL,
userid integer NOT NULL ,
ipaddr character(15) NOT NULL,
login_ts timestamp with time zone,
logout_ts timestamp with time zone,
Constraint user_history_pkey Primary Key (id)
);

Jason

--- "Thomas T. Veldhouse" <veldy(at)veldy(dot)net> wrote:
> Here is the table I have.
>
> CREATE TABLE "user_history" (
> "id" integer DEFAULT
> nextval('"user_history_id_seq"'::text) NOT
> NULL,
> "userid" integer NOT NULL,
> "ipaddr" character(15) NOT NULL,
> "login_ts " timestamp with time zone,
> "logout_ts " timestamp with time zone,
> Constraint "user_history_pkey" Primary Key
> ("id")
> );
>
>
> I try this:
>
> insert into user_history(id, userid, ipaddr,
> login_ts)
> values (1, 2, '127.0.0.1', now())
>
> And I get this:
>
> PostgreSQL said: ERROR: Relation 'user_history' does
> not have attribute
> 'login_ts'
>
> Obviously, I DO have login_ts. The field is
> nullable, so why the headache?
>
> Thanks in advance,
>
> Tom Veldhouse
> veldy(at)veldy(dot)net
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas T. Veldhouse 2001-06-28 03:29:17 Re: Problem with null timestamp fields
Previous Message Philip Molter 2001-06-28 03:11:52 Re: Re: Red Hat to support PostgreSQL