From: | Joshua Moore-Oliva <josh(at)chatgris(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problem selecting rows with null value |
Date: | 2003-03-13 00:49:53 |
Message-ID: | 200303121949.53377.josh@chatgris.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
try this
CREATE TABLE pleah (
foo int NOT NULL,
bar timestamp );
INSERT INTO pleah ( foo ) VALUES ( 1 );
If the NOT NULL statement is missing, a NULL will automatically be inserted.
no need to specify a DEFAULT NULL.
Josh.
On March 12, 2003 07:47 pm, Matthew Phillips wrote:
> I am sure that I am doing something subtly wrong with my sql syntax
> here. I thought that it was a timestamp null column issue, but it
> doesn't work with int either. Is there a special way to denote the null
> value in a situation like this that I don't know about?
>
> tsc=# create table pleah(
> tsc(# foo INT NOT NULL,
> tsc(# bar timestamp DEFAULT NULL );
> CREATE TABLE
> tsc=# insert into pleah (foo) values (1);
> INSERT 206475246 1
>
> ###ok here I would just like to select that row that I just inserted...
> but no!
>
> tsc=# select * from pleah where bar = NULL;
> foo | bar
> -----+-----
> (0 rows)
>
> tsc=# select * from pleah;
> foo | bar
> -----+-----
> 1 |
> (1 row)
>
> thanks muchly
> matthew
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua Moore-Oliva | 2003-03-13 00:52:17 | Re: problem selecting rows with null value |
Previous Message | Matthew Phillips | 2003-03-13 00:47:30 | problem selecting rows with null value |